2 * PostScript driver initialization functions
4 * Copyright 1998 Huw D M Davies
5 * Copyright 2001 Marcus Meissner
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/port.h"
28 #define NONAMELESSUNION
29 #define NONAMELESSSTRUCT
38 #include "wine/library.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
43 static const PSDRV_DEVMODE DefaultDevmode =
46 /* dmDeviceName */ {'W','i','n','e',' ','P','o','s','t','S','c','r','i','p','t',' ','D','r','i','v','e','r',0},
47 /* dmSpecVersion */ 0x30a,
48 /* dmDriverVersion */ 0x001,
49 /* dmSize */ sizeof(DEVMODEW),
50 /* dmDriverExtra */ sizeof(PSDRV_DEVMODE)-sizeof(DEVMODEW),
51 /* dmFields */ DM_ORIENTATION | DM_PAPERSIZE | DM_PAPERLENGTH | DM_PAPERWIDTH |
52 DM_SCALE | DM_COPIES | DM_DEFAULTSOURCE | DM_PRINTQUALITY |
53 DM_COLOR | DM_DUPLEX | DM_YRESOLUTION | DM_TTOPTION |
54 DM_COLLATE | DM_FORMNAME,
57 /* dmOrientation */ DMORIENT_PORTRAIT,
58 /* dmPaperSize */ DMPAPER_LETTER,
59 /* dmPaperLength */ 2794,
60 /* dmPaperWidth */ 2159,
63 /* dmDefaultSource */ DMBIN_AUTO,
64 /* dmPrintQuality */ 300
67 /* dmColor */ DMCOLOR_COLOR,
68 /* dmDuplex */ DMDUP_SIMPLEX,
69 /* dmYResolution */ 300,
70 /* dmTTOption */ DMTT_SUBDEV,
71 /* dmCollate */ DMCOLLATE_FALSE,
72 /* dmFormName */ {'L','e','t','t','e','r',0},
78 /* dmDisplayFlags */ 0
80 /* dmDisplayFrequency */ 0,
87 /* dmPanningWidth */ 0,
88 /* dmPanningHeight */ 0
94 /* numInstalledOptions */ 0
98 HINSTANCE PSDRV_hInstance = 0;
99 HANDLE PSDRV_Heap = 0;
101 static HFONT PSDRV_DefaultFont = 0;
102 static const LOGFONTA DefaultLogFont = {
103 100, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, 0, 0,
104 DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, ""
107 static const struct gdi_dc_funcs psdrv_funcs;
109 /*********************************************************************
112 * Initializes font metrics and registers driver. wineps dll entry point.
115 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
117 TRACE("(%p, %d, %p)\n", hinst, reason, reserved);
121 case DLL_PROCESS_ATTACH:
122 PSDRV_hInstance = hinst;
123 DisableThreadLibraryCalls(hinst);
125 PSDRV_Heap = HeapCreate(0, 0x10000, 0);
126 if (PSDRV_Heap == NULL)
129 if (PSDRV_GetFontMetrics() == FALSE) {
130 HeapDestroy(PSDRV_Heap);
134 PSDRV_DefaultFont = CreateFontIndirectA(&DefaultLogFont);
135 if (PSDRV_DefaultFont == NULL) {
136 HeapDestroy(PSDRV_Heap);
141 case DLL_PROCESS_DETACH:
143 DeleteObject( PSDRV_DefaultFont );
144 HeapDestroy( PSDRV_Heap );
151 static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
154 INT width = 0, height = 0;
156 if (physDev->Devmode->dmPublic.dmFields & DM_PRINTQUALITY)
158 physDev->logPixelsX = physDev->Devmode->dmPublic.u1.s1.dmPrintQuality;
159 physDev->logPixelsY = physDev->logPixelsX;
163 physDev->logPixelsX = physDev->pi->ppd->DefaultResolution;
164 physDev->logPixelsY = physDev->logPixelsX;
166 if (physDev->Devmode->dmPublic.dmFields & DM_YRESOLUTION)
167 physDev->logPixelsY = physDev->Devmode->dmPublic.dmYResolution;
169 if(physDev->Devmode->dmPublic.dmFields & DM_PAPERSIZE) {
170 LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) {
171 if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize)
175 if(&page->entry == &physDev->pi->ppd->PageSizes) {
176 FIXME("Can't find page\n");
177 physDev->ImageableArea.left = 0;
178 physDev->ImageableArea.right = 0;
179 physDev->ImageableArea.bottom = 0;
180 physDev->ImageableArea.top = 0;
181 physDev->PageSize.cx = 0;
182 physDev->PageSize.cy = 0;
183 } else if(page->ImageableArea) {
184 /* physDev sizes in device units; ppd sizes in 1/72" */
185 physDev->ImageableArea.left = page->ImageableArea->llx *
186 physDev->logPixelsX / 72;
187 physDev->ImageableArea.right = page->ImageableArea->urx *
188 physDev->logPixelsX / 72;
189 physDev->ImageableArea.bottom = page->ImageableArea->lly *
190 physDev->logPixelsY / 72;
191 physDev->ImageableArea.top = page->ImageableArea->ury *
192 physDev->logPixelsY / 72;
193 physDev->PageSize.cx = page->PaperDimension->x *
194 physDev->logPixelsX / 72;
195 physDev->PageSize.cy = page->PaperDimension->y *
196 physDev->logPixelsY / 72;
198 physDev->ImageableArea.left = physDev->ImageableArea.bottom = 0;
199 physDev->ImageableArea.right = physDev->PageSize.cx =
200 page->PaperDimension->x * physDev->logPixelsX / 72;
201 physDev->ImageableArea.top = physDev->PageSize.cy =
202 page->PaperDimension->y * physDev->logPixelsY / 72;
204 } else if((physDev->Devmode->dmPublic.dmFields & DM_PAPERLENGTH) &&
205 (physDev->Devmode->dmPublic.dmFields & DM_PAPERWIDTH)) {
206 /* physDev sizes in device units; Devmode sizes in 1/10 mm */
207 physDev->ImageableArea.left = physDev->ImageableArea.bottom = 0;
208 physDev->ImageableArea.right = physDev->PageSize.cx =
209 physDev->Devmode->dmPublic.u1.s1.dmPaperWidth *
210 physDev->logPixelsX / 254;
211 physDev->ImageableArea.top = physDev->PageSize.cy =
212 physDev->Devmode->dmPublic.u1.s1.dmPaperLength *
213 physDev->logPixelsY / 254;
215 FIXME("Odd dmFields %x\n", physDev->Devmode->dmPublic.dmFields);
216 physDev->ImageableArea.left = 0;
217 physDev->ImageableArea.right = 0;
218 physDev->ImageableArea.bottom = 0;
219 physDev->ImageableArea.top = 0;
220 physDev->PageSize.cx = 0;
221 physDev->PageSize.cy = 0;
224 TRACE("ImageableArea = %d,%d - %d,%d: PageSize = %dx%d\n",
225 physDev->ImageableArea.left, physDev->ImageableArea.bottom,
226 physDev->ImageableArea.right, physDev->ImageableArea.top,
227 physDev->PageSize.cx, physDev->PageSize.cy);
229 /* these are in device units */
230 width = physDev->ImageableArea.right - physDev->ImageableArea.left;
231 height = physDev->ImageableArea.top - physDev->ImageableArea.bottom;
233 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_PORTRAIT) {
234 physDev->horzRes = width;
235 physDev->vertRes = height;
237 physDev->horzRes = height;
238 physDev->vertRes = width;
241 /* these are in mm */
242 physDev->horzSize = (physDev->horzRes * 25.4) / physDev->logPixelsX;
243 physDev->vertSize = (physDev->vertRes * 25.4) / physDev->logPixelsY;
245 TRACE("devcaps: horzSize = %dmm, vertSize = %dmm, "
246 "horzRes = %d, vertRes = %d\n",
247 physDev->horzSize, physDev->vertSize,
248 physDev->horzRes, physDev->vertRes);
251 static PSDRV_PDEVICE *create_psdrv_physdev( PRINTERINFO *pi )
253 PSDRV_PDEVICE *physDev;
255 physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) );
256 if (!physDev) return NULL;
258 physDev->Devmode = HeapAlloc( GetProcessHeap(), 0, sizeof(PSDRV_DEVMODE) );
259 if (!physDev->Devmode)
261 HeapFree( GetProcessHeap(), 0, physDev );
265 *physDev->Devmode = *pi->Devmode;
267 physDev->logPixelsX = pi->ppd->DefaultResolution;
268 physDev->logPixelsY = pi->ppd->DefaultResolution;
272 /**********************************************************************
275 static BOOL PSDRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
276 LPCWSTR output, const DEVMODEW* initData )
278 PSDRV_PDEVICE *physDev;
281 TRACE("(%s %s %s %p)\n", debugstr_w(driver), debugstr_w(device),
282 debugstr_w(output), initData);
284 if (!device) return FALSE;
285 pi = PSDRV_FindPrinterInfo( device );
286 if(!pi) return FALSE;
289 RASTERIZER_STATUS status;
290 if(!GetRasterizerCaps(&status, sizeof(status)) ||
291 !(status.wFlags & TT_AVAILABLE) ||
292 !(status.wFlags & TT_ENABLED)) {
293 MESSAGE("Disabling printer %s since it has no builtin fonts and there are no TrueType fonts available.\n",
299 if (!(physDev = create_psdrv_physdev( pi ))) return FALSE;
301 if (output && *output) physDev->job.output = strdupW( output );
304 PSDRV_MergeDevmodes(physDev->Devmode, (PSDRV_DEVMODE *)initData, pi);
306 PSDRV_UpdateDevCaps(physDev);
307 SelectObject( (*pdev)->hdc, PSDRV_DefaultFont );
308 push_dc_driver( pdev, &physDev->dev, &psdrv_funcs );
313 /**********************************************************************
314 * PSDRV_CreateCompatibleDC
316 static BOOL PSDRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
318 HDC hdc = (*pdev)->hdc;
319 PSDRV_PDEVICE *physDev, *orig_dev = get_psdrv_dev( orig );
320 PRINTERINFO *pi = PSDRV_FindPrinterInfo( orig_dev->pi->friendly_name );
322 if (!pi) return FALSE;
323 if (!(physDev = create_psdrv_physdev( pi ))) return FALSE;
324 PSDRV_MergeDevmodes( physDev->Devmode, orig_dev->Devmode, pi );
325 PSDRV_UpdateDevCaps(physDev);
326 SelectObject( hdc, PSDRV_DefaultFont );
327 push_dc_driver( pdev, &physDev->dev, &psdrv_funcs );
333 /**********************************************************************
336 static BOOL PSDRV_DeleteDC( PHYSDEV dev )
338 PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
342 HeapFree( GetProcessHeap(), 0, physDev->Devmode );
343 HeapFree( GetProcessHeap(), 0, physDev->job.output );
344 HeapFree( GetProcessHeap(), 0, physDev );
350 /**********************************************************************
353 static HDC PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData )
355 PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
359 PSDRV_MergeDevmodes(physDev->Devmode, (PSDRV_DEVMODE *)lpInitData, physDev->pi);
360 PSDRV_UpdateDevCaps(physDev);
365 /***********************************************************************
366 * GetDeviceCaps (WINEPS.@)
368 static INT PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
370 PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
372 TRACE("%p,%d\n", dev->hdc, cap);
379 return DT_RASPRINTER;
381 return MulDiv(physDev->horzSize, 100,
382 physDev->Devmode->dmPublic.u1.s1.dmScale);
384 return MulDiv(physDev->vertSize, 100,
385 physDev->Devmode->dmPublic.u1.s1.dmScale);
388 return physDev->horzRes;
391 return physDev->vertRes;
393 return (physDev->pi->ppd->ColorDevice != CD_False) ? 32 : 1;
407 return sizeof(PSDRV_PDEVICE);
409 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
410 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
412 return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
413 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
415 return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
416 PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
418 return TC_CR_ANY | TC_VA_ABLE; /* psdrv 0x59f7 */
422 return (RC_BITBLT | RC_BITMAP64 | RC_GDI20_OUTPUT | RC_DIBTODEV |
423 RC_STRETCHBLT | RC_STRETCHDIB); /* psdrv 0x6e99 */
425 return physDev->logPixelsX;
427 return physDev->logPixelsY;
429 return (int)hypot( (double)physDev->logPixelsX,
430 (double)physDev->logPixelsY );
432 return MulDiv(physDev->logPixelsX,
433 physDev->Devmode->dmPublic.u1.s1.dmScale, 100);
435 return MulDiv(physDev->logPixelsY,
436 physDev->Devmode->dmPublic.u1.s1.dmScale, 100);
444 return (physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) ?
445 physDev->PageSize.cy : physDev->PageSize.cx;
447 return (physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) ?
448 physDev->PageSize.cx : physDev->PageSize.cy;
449 case PHYSICALOFFSETX:
450 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
451 if(physDev->pi->ppd->LandscapeOrientation == -90)
452 return physDev->PageSize.cy - physDev->ImageableArea.top;
454 return physDev->ImageableArea.bottom;
456 return physDev->ImageableArea.left;
458 case PHYSICALOFFSETY:
459 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
460 if(physDev->pi->ppd->LandscapeOrientation == -90)
461 return physDev->PageSize.cx - physDev->ImageableArea.right;
463 return physDev->ImageableArea.left;
465 return physDev->PageSize.cy - physDev->ImageableArea.top;
475 FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
480 static PRINTER_ENUM_VALUESA *load_font_sub_table( HANDLE printer, DWORD *num_entries )
482 DWORD res, needed, num;
483 PRINTER_ENUM_VALUESA *table = NULL;
484 static const char fontsubkey[] = "PrinterDriverData\\FontSubTable";
488 res = EnumPrinterDataExA( printer, fontsubkey, NULL, 0, &needed, &num );
489 if (res != ERROR_MORE_DATA) return NULL;
491 table = HeapAlloc( PSDRV_Heap, 0, needed );
492 if (!table) return NULL;
494 res = EnumPrinterDataExA( printer, fontsubkey, (LPBYTE)table, needed, &needed, &num );
495 if (res != ERROR_SUCCESS)
497 HeapFree( PSDRV_Heap, 0, table );
505 static PSDRV_DEVMODE *get_printer_devmode( HANDLE printer )
507 DWORD needed, dm_size;
509 PRINTER_INFO_9W *info;
512 GetPrinterW( printer, 9, NULL, 0, &needed );
513 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return NULL;
515 info = HeapAlloc( PSDRV_Heap, 0, needed );
516 res = GetPrinterW( printer, 9, (BYTE *)info, needed, &needed );
517 if (!res || !info->pDevMode)
519 HeapFree( PSDRV_Heap, 0, info );
523 /* sanity check the sizes */
524 dm_size = info->pDevMode->dmSize + info->pDevMode->dmDriverExtra;
525 if ((char *)info->pDevMode - (char *)info + dm_size > needed)
527 HeapFree( PSDRV_Heap, 0, info );
531 dm = (PSDRV_DEVMODE*)info;
532 memmove( dm, info->pDevMode, dm_size );
536 static PSDRV_DEVMODE *get_devmode( HANDLE printer, const WCHAR *name, BOOL *is_default )
538 PSDRV_DEVMODE *dm = get_printer_devmode( printer );
542 if (dm && dm->dmPublic.dmSize + dm->dmPublic.dmDriverExtra >= sizeof(DefaultDevmode))
544 TRACE( "Retrieved devmode from winspool\n" );
547 HeapFree( PSDRV_Heap, 0, dm );
549 TRACE( "Using default devmode\n" );
550 dm = HeapAlloc( PSDRV_Heap, 0, sizeof(DefaultDevmode) );
553 *dm = DefaultDevmode;
554 lstrcpynW( (WCHAR *)dm->dmPublic.dmDeviceName, name, CCHDEVICENAME );
560 static BOOL set_devmode( HANDLE printer, PSDRV_DEVMODE *dm )
562 PRINTER_INFO_9W info;
563 info.pDevMode = &dm->dmPublic;
565 return SetPrinterW( printer, 9, (BYTE *)&info, 0 );
568 static char *get_ppd_filename( HANDLE printer )
571 DRIVER_INFO_2W *info;
574 GetPrinterDriverW( printer, NULL, 2, NULL, 0, &needed );
575 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return NULL;
576 info = HeapAlloc( GetProcessHeap(), 0, needed );
577 if (!info) return NULL;
578 GetPrinterDriverW( printer, NULL, 2, (BYTE*)info, needed, &needed );
579 unixname = wine_get_unix_file_name( info->pDataFile );
580 HeapFree( GetProcessHeap(), 0, info );
585 static struct list printer_list = LIST_INIT( printer_list );
587 /**********************************************************************
588 * PSDRV_FindPrinterInfo
590 PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
592 DWORD needed, res, dwPaperSize;
597 char *ppd_filename = NULL, *nameA = NULL;
598 BOOL using_default_devmode = FALSE;
601 TRACE("'%s'\n", debugstr_w(name));
603 LIST_FOR_EACH_ENTRY( pi, &printer_list, PRINTERINFO, entry )
605 if (!strcmpW( pi->friendly_name, name ))
609 pi = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) );
610 if (pi == NULL) return NULL;
612 if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (strlenW(name)+1)*sizeof(WCHAR) ))) goto fail;
613 strcpyW( pi->friendly_name, name );
615 if (OpenPrinterW( pi->friendly_name, &hPrinter, NULL ) == 0) {
616 ERR ("OpenPrinter failed with code %i\n", GetLastError ());
620 len = WideCharToMultiByte( CP_ACP, 0, name, -1, NULL, 0, NULL, NULL );
621 nameA = HeapAlloc( GetProcessHeap(), 0, len );
622 WideCharToMultiByte( CP_ACP, 0, name, -1, nameA, len, NULL, NULL );
624 pi->Devmode = get_devmode( hPrinter, name, &using_default_devmode );
625 if (!pi->Devmode) goto fail;
627 ppd_filename = get_ppd_filename( hPrinter );
628 if (!ppd_filename) goto fail;
630 pi->ppd = PSDRV_ParsePPD( ppd_filename, hPrinter );
633 WARN( "Couldn't parse PPD file '%s'\n", ppd_filename );
637 if(using_default_devmode) {
640 if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE | LOCALE_RETURN_NUMBER,
641 (LPWSTR)&papersize, sizeof(papersize)/sizeof(WCHAR))) {
643 memset(&dm, 0, sizeof(dm));
644 dm.dmPublic.dmFields = DM_PAPERSIZE;
645 dm.dmPublic.u1.s1.dmPaperSize = papersize;
646 PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
650 if(pi->ppd->DefaultPageSize) { /* We'll let the ppd override the devmode */
652 memset(&dm, 0, sizeof(dm));
653 dm.dmPublic.dmFields = DM_PAPERSIZE;
654 dm.dmPublic.u1.s1.dmPaperSize = pi->ppd->DefaultPageSize->WinPage;
655 PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
659 * This is a hack. The default paper size should be read in as part of
660 * the Devmode structure, but Wine doesn't currently provide a convenient
661 * way to configure printers.
663 res = GetPrinterDataExA(hPrinter, "PrinterDriverData", "Paper Size", NULL,
664 (LPBYTE)&dwPaperSize, sizeof(DWORD), &needed);
665 if (res == ERROR_SUCCESS)
666 pi->Devmode->dmPublic.u1.s1.dmPaperSize = (SHORT) dwPaperSize;
667 else if (res == ERROR_FILE_NOT_FOUND)
668 TRACE ("No 'Paper Size' for printer '%s'\n", debugstr_w(name));
670 ERR ("GetPrinterDataA returned %i\n", res);
674 /* Duplex is indicated by the setting of the DM_DUPLEX bit in dmFields.
675 WinDuplex == 0 is a special case which means that the ppd has a
676 *DefaultDuplex: NotCapable entry. In this case we'll try not to confuse
677 apps and set dmDuplex to DMDUP_SIMPLEX but leave the DM_DUPLEX clear.
678 PSDRV_WriteHeader understands this and copes. */
679 pi->Devmode->dmPublic.dmFields &= ~DM_DUPLEX;
680 if(pi->ppd->DefaultDuplex) {
681 pi->Devmode->dmPublic.dmDuplex = pi->ppd->DefaultDuplex->WinDuplex;
682 if(pi->Devmode->dmPublic.dmDuplex != 0)
683 pi->Devmode->dmPublic.dmFields |= DM_DUPLEX;
685 pi->Devmode->dmPublic.dmDuplex = DMDUP_SIMPLEX;
688 set_devmode( hPrinter, pi->Devmode );
690 pi->FontSubTable = load_font_sub_table( hPrinter, &pi->FontSubTableSize );
692 LIST_FOR_EACH_ENTRY( font, &pi->ppd->InstalledFonts, FONTNAME, entry )
694 afm = PSDRV_FindAFMinList(PSDRV_AFMFontList, font->Name);
696 TRACE( "Couldn't find AFM file for installed printer font '%s' - "
697 "ignoring\n", font->Name);
701 if (PSDRV_AddAFMtoList(&pi->Fonts, afm, &added) == FALSE) {
702 PSDRV_FreeAFMList(pi->Fonts);
708 ClosePrinter( hPrinter );
709 HeapFree( GetProcessHeap(), 0, nameA );
710 HeapFree( GetProcessHeap(), 0, ppd_filename );
711 list_add_head( &printer_list, &pi->entry );
715 if (hPrinter) ClosePrinter( hPrinter );
716 HeapFree(PSDRV_Heap, 0, pi->FontSubTable);
717 HeapFree(PSDRV_Heap, 0, pi->friendly_name);
718 HeapFree(PSDRV_Heap, 0, pi->Devmode);
719 HeapFree(PSDRV_Heap, 0, pi);
720 HeapFree( GetProcessHeap(), 0, nameA );
721 HeapFree( GetProcessHeap(), 0, ppd_filename );
726 static const struct gdi_dc_funcs psdrv_funcs =
728 NULL, /* pAbortDoc */
729 NULL, /* pAbortPath */
730 NULL, /* pAlphaBlend */
731 NULL, /* pAngleArc */
732 PSDRV_Arc, /* pArc */
734 NULL, /* pBeginPath */
735 NULL, /* pBlendImage */
736 PSDRV_Chord, /* pChord */
737 NULL, /* pCloseFigure */
738 PSDRV_CreateCompatibleDC, /* pCreateCompatibleDC */
739 PSDRV_CreateDC, /* pCreateDC */
740 PSDRV_DeleteDC, /* pDeleteDC */
741 NULL, /* pDeleteObject */
742 PSDRV_DeviceCapabilities, /* pDeviceCapabilities */
743 PSDRV_Ellipse, /* pEllipse */
744 PSDRV_EndDoc, /* pEndDoc */
745 PSDRV_EndPage, /* pEndPage */
747 PSDRV_EnumFonts, /* pEnumFonts */
748 NULL, /* pEnumICMProfiles */
749 NULL, /* pExcludeClipRect */
750 PSDRV_ExtDeviceMode, /* pExtDeviceMode */
751 PSDRV_ExtEscape, /* pExtEscape */
752 NULL, /* pExtFloodFill */
753 NULL, /* pExtSelectClipRgn */
754 PSDRV_ExtTextOut, /* pExtTextOut */
755 PSDRV_FillPath, /* pFillPath */
757 NULL, /* pFlattenPath */
758 NULL, /* pFontIsLinked */
759 NULL, /* pFrameRgn */
760 NULL, /* pGdiComment */
761 NULL, /* pGdiRealizationInfo */
762 NULL, /* pGetBoundsRect */
763 NULL, /* pGetCharABCWidths */
764 NULL, /* pGetCharABCWidthsI */
765 PSDRV_GetCharWidth, /* pGetCharWidth */
766 PSDRV_GetDeviceCaps, /* pGetDeviceCaps */
767 NULL, /* pGetDeviceGammaRamp */
768 NULL, /* pGetFontData */
769 NULL, /* pGetFontUnicodeRanges */
770 NULL, /* pGetGlyphIndices */
771 NULL, /* pGetGlyphOutline */
772 NULL, /* pGetICMProfile */
773 NULL, /* pGetImage */
774 NULL, /* pGetKerningPairs */
775 NULL, /* pGetNearestColor */
776 NULL, /* pGetOutlineTextMetrics */
777 NULL, /* pGetPixel */
778 NULL, /* pGetSystemPaletteEntries */
779 NULL, /* pGetTextCharsetInfo */
780 PSDRV_GetTextExtentExPoint, /* pGetTextExtentExPoint */
781 NULL, /* pGetTextExtentExPointI */
782 NULL, /* pGetTextFace */
783 PSDRV_GetTextMetrics, /* pGetTextMetrics */
784 NULL, /* pGradientFill */
785 NULL, /* pIntersectClipRect */
786 NULL, /* pInvertRgn */
787 PSDRV_LineTo, /* pLineTo */
788 NULL, /* pModifyWorldTransform */
790 NULL, /* pOffsetClipRgn */
791 NULL, /* pOffsetViewportOrg */
792 NULL, /* pOffsetWindowOrg */
793 PSDRV_PaintRgn, /* pPaintRgn */
794 PSDRV_PatBlt, /* pPatBlt */
795 PSDRV_Pie, /* pPie */
796 PSDRV_PolyBezier, /* pPolyBezier */
797 PSDRV_PolyBezierTo, /* pPolyBezierTo */
798 NULL, /* pPolyDraw */
799 PSDRV_PolyPolygon, /* pPolyPolygon */
800 PSDRV_PolyPolyline, /* pPolyPolyline */
802 NULL, /* pPolyline */
803 NULL, /* pPolylineTo */
804 PSDRV_PutImage, /* pPutImage */
805 NULL, /* pRealizeDefaultPalette */
806 NULL, /* pRealizePalette */
807 PSDRV_Rectangle, /* pRectangle */
808 PSDRV_ResetDC, /* pResetDC */
809 NULL, /* pRestoreDC */
810 PSDRV_RoundRect, /* pRoundRect */
812 NULL, /* pScaleViewportExt */
813 NULL, /* pScaleWindowExt */
814 NULL, /* pSelectBitmap */
815 PSDRV_SelectBrush, /* pSelectBrush */
816 NULL, /* pSelectClipPath */
817 PSDRV_SelectFont, /* pSelectFont */
818 NULL, /* pSelectPalette */
819 PSDRV_SelectPen, /* pSelectPen */
820 NULL, /* pSetArcDirection */
821 PSDRV_SetBkColor, /* pSetBkColor */
822 NULL, /* pSetBkMode */
823 NULL, /* pSetBoundsRect */
824 PSDRV_SetDCBrushColor, /* pSetDCBrushColor */
825 PSDRV_SetDCPenColor, /* pSetDCPenColor */
826 NULL, /* pSetDIBitsToDevice */
827 NULL, /* pSetDeviceClipping */
828 NULL, /* pSetDeviceGammaRamp */
829 NULL, /* pSetLayout */
830 NULL, /* pSetMapMode */
831 NULL, /* pSetMapperFlags */
832 PSDRV_SetPixel, /* pSetPixel */
833 NULL, /* pSetPolyFillMode */
835 NULL, /* pSetRelAbs */
836 NULL, /* pSetStretchBltMode */
837 NULL, /* pSetTextAlign */
838 NULL, /* pSetTextCharacterExtra */
839 PSDRV_SetTextColor, /* pSetTextColor */
840 NULL, /* pSetTextJustification */
841 NULL, /* pSetViewportExt */
842 NULL, /* pSetViewportOrg */
843 NULL, /* pSetWindowExt */
844 NULL, /* pSetWindowOrg */
845 NULL, /* pSetWorldTransform */
846 PSDRV_StartDoc, /* pStartDoc */
847 PSDRV_StartPage, /* pStartPage */
848 NULL, /* pStretchBlt */
849 NULL, /* pStretchDIBits */
850 PSDRV_StrokeAndFillPath, /* pStrokeAndFillPath */
851 PSDRV_StrokePath, /* pStrokePath */
852 NULL, /* pUnrealizePalette */
853 NULL, /* pWidenPath */
854 NULL, /* wine_get_wgl_driver */
855 GDI_PRIORITY_GRAPHICS_DRV /* priority */
859 /******************************************************************************
860 * PSDRV_get_gdi_driver
862 const struct gdi_dc_funcs * CDECL PSDRV_get_gdi_driver( unsigned int version )
864 if (version != WINE_GDI_DRIVER_VERSION)
866 ERR( "version mismatch, gdi32 wants %u but wineps has %u\n", version, WINE_GDI_DRIVER_VERSION );