Various registry-related PostScript driver enhancements.

This commit is contained in:
Ian Pilcher 2001-04-02 19:14:41 +00:00 committed by Alexandre Julliard
parent 9d4ae0eff9
commit 744820d014
12 changed files with 256 additions and 90 deletions

View File

@ -456,7 +456,7 @@ version/libversion.@LIBEXT@: liblz32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIB
win32s/libw32skrnl.@LIBEXT@: libkernel32.@LIBEXT@ libntdll.@LIBEXT@
winaspi/libwnaspi32.@LIBEXT@: libadvapi32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@
winedos/libwinedos.@LIBEXT@: libuser32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@
wineps/libwineps.@LIBEXT@: libuser32.@LIBEXT@ libgdi32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@
wineps/libwineps.@LIBEXT@: libuser32.@LIBEXT@ libgdi32.@LIBEXT@ libwinspool.drv.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@
wininet/libwininet.@LIBEXT@: libshlwapi.@LIBEXT@ libuser32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@
winmm/joystick/libjoystick.drv.@LIBEXT@: libwinmm.@LIBEXT@ libuser32.@LIBEXT@ libntdll.@LIBEXT@
winmm/libwinmm.@LIBEXT@: libuser32.@LIBEXT@ libadvapi32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@

View File

@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = wineps
SOVERSION = 1.0
ALTNAMES = wineps16
IMPORTS = user32 gdi32 kernel32 ntdll
IMPORTS = user32 gdi32 winspool.drv kernel32 ntdll
C_SRCS = \
afm.c \

View File

@ -74,6 +74,29 @@ HFONT16 PSDRV_FONT_SelectObject( DC * dc, HFONT16 hfont,
}
}
if (physDev->pi->FontSubTableSize != 0)
{
DWORD i;
for (i = 0; i < physDev->pi->FontSubTableSize; ++i)
{
if (!strcasecmp (FaceName,
physDev->pi->FontSubTable[i].pValueName))
{
TRACE ("substituting facename '%s' for '%s'\n",
(LPSTR) physDev->pi->FontSubTable[i].pData, FaceName);
if (strlen ((LPSTR) physDev->pi->FontSubTable[i].pData) <
LF_FACESIZE)
strcpy (FaceName,
(LPSTR) physDev->pi->FontSubTable[i].pData);
else
WARN ("Facename '%s' is too long; ignoring substitution\n",
(LPSTR) physDev->pi->FontSubTable[i].pData);
break;
}
}
}
TRACE("Trying to find facename '%s'\n", FaceName);
/* Look for a matching font family */

View File

@ -416,18 +416,17 @@ static BOOL PSDRV_DeleteDC( DC *dc )
}
/**********************************************************************
* PSDRV_FindPrinterInfo
*/
PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
{
static PRINTERINFO *PSDRV_PrinterList;
DWORD type = REG_BINARY, needed, res;
DWORD type = REG_BINARY, needed, res, dwPaperSize;
PRINTERINFO *pi = PSDRV_PrinterList, **last = &PSDRV_PrinterList;
FONTNAME *font;
AFM *afm;
HANDLE hPrinter;
TRACE("'%s'\n", name);
@ -454,10 +453,134 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
(LPBYTE)pi->Devmode, needed, &needed);
}
PROFILE_GetWineIniString("psdrv", "ppdfile", "default.ppd",
pi->Devmode->dmDrvPrivate.ppdFileName, 256);
if (OpenPrinterA (pi->FriendlyName, &hPrinter, NULL) == 0)
{
ERR ("OpenPrinterA failed with code %li\n", GetLastError ());
if (HeapFree (PSDRV_Heap, 0, pi->FriendlyName) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree (PSDRV_Heap, 0, pi->Devmode) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree (PSDRV_Heap, 0, pi) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
*last = NULL;
return NULL;
}
res = GetPrinterDataA (hPrinter, "PPD File", NULL,
pi->Devmode->dmDrvPrivate.ppdFileName, 256, &needed);
if (res != ERROR_SUCCESS)
{
ERR ("Error %li getting PPD file name for printer '%s'\n", res, name);
if (ClosePrinter (hPrinter) == 0)
WARN ("ClosePrinter failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
*last = NULL;
return NULL;
}
res = GetPrinterDataA (hPrinter, "Paper Size", NULL, (LPBYTE) &dwPaperSize,
sizeof (DWORD), &needed);
if (res == ERROR_SUCCESS)
pi->Devmode->dmPublic.u1.s1.dmPaperSize = (SHORT) dwPaperSize;
else if (res == ERROR_FILE_NOT_FOUND)
TRACE ("No 'Paper Size' for printer '%s'\n", name);
else
{
ERR ("GetPrinterDataA returned %li\n", res);
if (ClosePrinter (hPrinter) == 0)
WARN ("ClosePrinter failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
*last = NULL;
return NULL;
}
res = EnumPrinterDataExA (hPrinter, "PrinterDriverData\\FontSubTable", NULL,
0, &needed, &pi->FontSubTableSize);
if (res == ERROR_SUCCESS)
TRACE ("No 'FontSubTable' for printer '%s'\n", name);
else if (res == ERROR_MORE_DATA)
{
pi->FontSubTable = HeapAlloc (PSDRV_Heap, 0, needed);
if (pi->FontSubTable == NULL)
{
ERR ("Failed to allocate %li bytes from heap\n", needed);
if (ClosePrinter (hPrinter) == 0)
WARN ("ClosePrinter failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
*last = NULL;
return NULL;
}
res = EnumPrinterDataExA (hPrinter, "PrinterDriverData\\FontSubTable",
(LPBYTE) pi->FontSubTable, needed, &needed,
&pi->FontSubTableSize);
if (res != ERROR_SUCCESS)
{
ERR ("EnumPrinterDataExA returned %li\n", res);
if (ClosePrinter (hPrinter) == 0)
WARN ("ClosePrinter failed with code %li\n", GetLastError ());
if (HeapFree (PSDRV_Heap, 0, pi->FontSubTable) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
*last = NULL;
return NULL;
}
}
else /* error in 1st call to EnumPrinterDataExA */
{
ERR ("EnumPrinterDataExA returned %li\n", res);
if (ClosePrinter (hPrinter) == 0)
WARN ("ClosePrinter failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
*last = NULL;
return NULL;
}
if (ClosePrinter (hPrinter) == 0)
{
ERR ("ClosePrinter failed with code %li\n", GetLastError ());
if (ClosePrinter (hPrinter) == 0)
WARN ("ClosePrinter failed with code %li\n", GetLastError ());
if (HeapFree (PSDRV_Heap, 0, pi->FontSubTable) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
if (HeapFree(PSDRV_Heap, 0, pi) == 0)
WARN ("HeapFree failed with code %li\n", GetLastError ());
*last = NULL;
return NULL;
}
pi->ppd = PSDRV_ParsePPD(pi->Devmode->dmDrvPrivate.ppdFileName);
if(!pi->ppd) {
HeapFree(PSDRV_Heap, 0, pi->FontSubTable);
HeapFree(PSDRV_Heap, 0, pi->FriendlyName);
HeapFree(PSDRV_Heap, 0, pi->Devmode);
HeapFree(PSDRV_Heap, 0, pi);

View File

@ -12,6 +12,7 @@
#include "pen.h"
#include "brush.h"
#include "wine/wingdi16.h"
#include "winspool.h"
typedef struct {
float llx, lly, urx, ury;
@ -163,11 +164,13 @@ numInstalledOptions of OPTIONs
} PSDRV_DEVMODEA;
typedef struct _tagPI {
char *FriendlyName;
PPD *ppd;
PSDRV_DEVMODEA *Devmode;
FONTFAMILY *Fonts;
struct _tagPI *next;
char *FriendlyName;
PPD *ppd;
PSDRV_DEVMODEA *Devmode;
FONTFAMILY *Fonts;
PPRINTER_ENUM_VALUESA FontSubTable;
DWORD FontSubTableSize;
struct _tagPI *next;
} PRINTERINFO;
typedef struct {
@ -379,6 +382,7 @@ extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
WORD fwCapability, LPSTR lpszOutput,
LPDEVMODEA lpdm);
VOID PSDRV_DrawLine( DC *dc );
#endif

View File

@ -5,6 +5,7 @@ rsrc rsrc.res
import user32.dll
import gdi32.dll
import winspool.drv
import kernel32.dll
import ntdll.dll

View File

@ -1850,6 +1850,10 @@ diff -u the_backup_file_you_made windows/x11drv/keyboard.c > layout.diff
Good luck.
</para>
</sect1>
&fonts;
&printing;
</chapter>
<!-- Keep this comment at the end of the file

View File

@ -1,7 +1,7 @@
<chapter id="fonts">
<sect1 id="fonts">
<title>Dealing with Fonts</title>
<sect1 id="windows-fonts">
<sect2 id="windows-fonts">
<title>Fonts</title>
<para>
@ -23,7 +23,7 @@
</note>
</para>
<sect2>
<sect3>
<title>How To Convert Windows Fonts</title>
<para>
If you have access to a Windows installation you should use
@ -109,9 +109,9 @@ STUB: AddFontResource( SOMEFILE.FON )
However, there is a possibility of the native TrueType
support via FreeType renderer in the future (hint, hint :-)
</para>
</sect2>
</sect3>
<sect2>
<sect3>
<title>How To Add Font Aliases To <filename>~/.wine/config</filename></title>
<para>
Many Windows applications assume that fonts included in
@ -323,9 +323,9 @@ Default = -adobe-times-
<filename>../fonts/Type1</filename> and
<filename>../fonts/Speedo</filename> directories.
</para>
</sect2>
</sect3>
<sect2>
<sect3>
<title>How To Manage Cached Font Metrics</title>
<para>
WINE stores detailed information about available fonts in
@ -342,9 +342,9 @@ FontMetrics = &lt;file with metrics&gt;
<filename>~/.wine/.cachedmetrics</filename> with the new
information. This process can take a while.
</para>
</sect2>
</sect3>
<sect2>
<sect3>
<title>Too Small Or Too Large Fonts</title>
<para>
Windows programs may ask WINE to render a font with the
@ -363,9 +363,9 @@ Resolution = &lt;integer value&gt;
experiment with values in the 60 - 120 range. 96 is a good
starting point.
</para>
</sect2>
</sect3>
<sect2>
<sect3>
<title>"FONT_Init: failed to load ..." Messages On Startup</title>
<para>
The most likely cause is a broken
@ -376,10 +376,10 @@ Resolution = &lt;integer value&gt;
machine as you are not root, use <command>xset -fp
xxx</command> to remove the broken font path.
</para>
</sect2>
</sect1>
</sect3>
</sect2>
<sect1 id="ttfont-server">
<sect2 id="ttfont-server">
<title>Setting up a TrueType Font Server</title>
<para>
written by ???
@ -486,9 +486,9 @@ FontPath "tcp/localhost:7100"
<para>
Hope this helps...
</para>
</sect1>
</sect2>
</chapter>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@ -1,8 +1,8 @@
<chapter id="printing">
<sect1 id="printing">
<title>Printing in Wine</title>
<para>How to print documents in Wine...</para>
<sect1 id="wine-printing">
<sect2 id="wine-printing">
<title>Printing</title>
<para>
@ -33,7 +33,7 @@
their Windows printer drivers. It is unclear whether they ever will.
</para>
<sect2>
<sect3>
<title>External printer drivers</title>
<para>
At present only 16 bit drivers will work (note that these include win9x
@ -55,19 +55,18 @@ printer=on
to the [TrueType] section of <filename>~/.wine/config</filename>. The code for
the driver interface is in <filename>graphics/win16drv</filename>.
</para>
</sect2>
</sect3>
<sect2>
<sect3>
<title>Builtin Wine PostScript driver</title>
<para>
Enables printing of PostScript files via a driver built into Wine. See
<filename>documentation/psdriver</filename> for installation
instructions. The code for the PostScript driver is in
<filename>graphics/psdrv</filename>.
below for installation instructions. The code for the PostScript
driver is in <filename>graphics/psdrv</filename>.
</para>
</sect2>
</sect3>
<sect2>
<sect3>
<title>Spooling</title>
<para>
Spooling is rather primitive. The [spooler] section of
@ -85,10 +84,10 @@ printer=on
with that port's name e.g. for <systemitem>LPT3:</systemitem> a file
called <systemitem>LPT3:</systemitem> would be created.
</para>
</sect2>
</sect1>
</sect3>
</sect2>
<sect1 id="psdriver">
<sect2 id="psdriver">
<title>The Wine PostScript Driver</title>
<para>
@ -104,7 +103,7 @@ printer=on
non PostScript printer by filtering the output through ghostscript.
</para>
<sect2>
<sect3>
<title>Installation</title>
<para>
The driver behaves as if it were a DRV file called
@ -136,16 +135,34 @@ printer=on
<emphasis>[sic]</emphasis>
</para>
<para>
To run 32 bit apps (and 16 bit apps using the
<literal>builtin</literal> commdlg) you also need to add certain
entries to the registry. The easiest way to do that at the moment is
to use the winelib program <command>programs/regapi/regapi</command>
with the file <filename>documentation/psdrv.reg</filename>. To do this
<command>cd</command> to <filename>programs/regapi/regapi</filename>
and type <userinput>make</userinput> to actually make the program, then
type <userinput>./regapi setValue
&lt;../../documentation/psdrv.reg</userinput>. You can obviously
edit <filename>psdrv.reg</filename> to suit your requirements.
You also need to add certain entries to the registry. The easiest way
to do this is to customise the contents of
<filename>documentation/psdrv.reg</filename> (see below) and use the
Winelib program <command>programs/regapi/regapi</command>. For
example, if you have installed the Wine source tree in
<filename>/usr/src/wine</filename>, you could use the following
series of commands:
<itemizedlist>
<listitem>
<para>
<userinput>cp /usr/src/wine/documentation/psdrv.reg ~</userinput>
</para>
</listitem>
<listitem>
<para><userinput>vi ~/psdrv.reg</userinput></para>
</listitem>
<listitem>
<para>
Edit the copy of <filename>psdrv.reg</filename> to suit your
requirements. At a minimum, you must specify a PPD file for
each printer.
</para>
</listitem>
<para>
<userinput>regapi setValue &lt; ~/psdrv.reg</userinput>
</para>
</listitem>
</itemizedlist>
</para>
<para>
You will need Adobe Font Metric (AFM) files for the (type 1 PostScript)
@ -156,35 +173,33 @@ printer=on
are good places to start. Note that these are only the font metrics and
not the fonts themselves. At the moment the driver does not download
additional fonts, so you can only use fonts that are already present on
the printer.
the printer. (Actually, the driver can use any font that is listed in
the PPD file, for which it has an AFM file. If you use fonts that are
<emphasis>not</emphasis> installed in your printer, or in
Ghostscript, you will need to use some means of embedding the font in
the print job or downloading the font to the printer. Note also that
the driver does not yet properly list required fonts in its DSC
comments, so a print manager that depends on these comments to
download the proper fonts to the printer may not work properly.)
</para>
<para>
Then create a [afmfiles] section in your
Then create a [afmdirs] section in your
<filename>wine.conf</filename> (or
<filename>~/.wine/config</filename>) and add a line of the form
</para>
<screen>
"file&lt;n&gt;" = "/unix/path/name/filename.afm"
"dir&lt;n&gt;" = "/unix/path/name/"
</screen>
<para>
for each AFM file that you wish to use. [This might change in the future]
for each directory that contains AFM files you wish to use.
</para>
<para>
You also require a PPD file for your printer. This describes certain
characteristics of the printer such as which fonts are installed, how
to select manual feed etc. Adobe also has many of these on its website,
have a look in <ulink url="ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/">
ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/</ulink>. Create
a [psdrv] section in your <filename>wine.conf</filename> (or
<filename>~/.wine/config</filename>) and add the following entry:
</para>
<screen>
"ppdfile" = "/somewhere/file.ppd"
</screen>
<para>
By default, the driver will look for a file named
<filename>default.ppd</filename> in the directory from which
you started wine.
ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/</ulink>. See
above for information on configuring the driver to use this file.
</para>
<para>
To enable colour printing you need to have the
@ -196,7 +211,7 @@ printer=on
Note that you need not set <literal>printer=on</literal> in
the [wine] section of <filename>wine.conf</filename>, this
enables printing via external printer drivers and does not
affect wineps.
affect the builtin PostScript driver.
</para>
<para>
If you're lucky you should now be able to produce PS files
@ -208,9 +223,9 @@ printer=on
Powerpoint2000 with some degree of success - you should be
able to get something out, it may not be in the right place.
</para>
</sect2>
</sect3>
<sect2>
<sect3>
<title>TODO / Bugs</title>
<itemizedlist>
@ -258,9 +273,9 @@ printer=on
<para>
&name-huw-davies; <email>&email-huw-davies;</email>
</para>
</sect2>
</sect1>
</chapter>
</sect3>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@ -10,6 +10,15 @@
"Status"="dword:00000000"
"Until Time"="dword:00000000"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\Wine PostScript Driver\PrinterDriverData]
"PPD File"="/unix/path/to/PPD/file"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\Wine PostScript Driver\PrinterDriverData\FontSubTable]
"Courier New"="Courier"
"Arial"="Helvetica"
"Helv"="Helvetica"
"Times New Roman"="Times"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Environments\Windows 4.0\Drivers\PS Driver]
"Configuration File"="WINEPS.DRV"
"Data File"=""

View File

@ -10,12 +10,10 @@
<!entity installing SYSTEM "installing.sgml">
<!entity configuring SYSTEM "configuring.sgml">
<!entity registry SYSTEM "registry.sgml">
<!entity running SYSTEM "running.sgml">
<!entity bugs SYSTEM "bugs.sgml">
<!-- *** Not currently used (???) *** -->
<!entity fonts SYSTEM "fonts.sgml">
<!entity printing SYSTEM "printing.sgml">
<!entity running SYSTEM "running.sgml">
<!entity bugs SYSTEM "bugs.sgml">
<!-- *** Entities for Wine Developer Guide *** -->
<!entity compiling SYSTEM "compiling.sgml">
@ -79,10 +77,6 @@
&configuring;
&running;
&bugs;
<!--
&fonts;
&printing;
-->
</book>
<!-- *** Wine Developer Guide *** -->

View File

@ -8,13 +8,11 @@
<!entity getting SYSTEM "getting.sgml">
<!entity installing SYSTEM "installing.sgml">
<!entity configuring SYSTEM "configuring.sgml">
<!entity running SYSTEM "running.sgml">
<!entity bugs SYSTEM "bugs.sgml">
<!-- *** Not currently used *** -->
<!entity registry SYSTEM "registry.sgml">
<!entity fonts SYSTEM "fonts.sgml">
<!entity printing SYSTEM "printing.sgml">
<!entity running SYSTEM "running.sgml">
<!entity bugs SYSTEM "bugs.sgml">
]>
<book id="index">
@ -29,10 +27,5 @@
&configuring;
&running;
&bugs;
<!--
&registry;
&fonts;
&printing;
-->
</book>