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 )
155 INT width = 0, height = 0, resx = 0, resy = 0;
157 if (physDev->Devmode->dmPublic.dmFields & (DM_PRINTQUALITY | DM_YRESOLUTION | DM_LOGPIXELS))
159 if (physDev->Devmode->dmPublic.dmFields & DM_PRINTQUALITY)
160 resx = resy = physDev->Devmode->dmPublic.u1.s1.dmPrintQuality;
162 if (physDev->Devmode->dmPublic.dmFields & DM_YRESOLUTION)
163 resy = physDev->Devmode->dmPublic.dmYResolution;
165 if (physDev->Devmode->dmPublic.dmFields & DM_LOGPIXELS)
166 resx = resy = physDev->Devmode->dmPublic.dmLogPixels;
168 LIST_FOR_EACH_ENTRY(res, &physDev->pi->ppd->Resolutions, RESOLUTION, entry)
170 if (res->resx == resx && res->resy == resy)
172 physDev->logPixelsX = resx;
173 physDev->logPixelsY = resy;
178 if (&res->entry == &physDev->pi->ppd->Resolutions)
180 WARN("Requested resolution %dx%d is not supported by device\n", resx, resy);
181 physDev->logPixelsX = physDev->pi->ppd->DefaultResolution;
182 physDev->logPixelsY = physDev->logPixelsX;
187 WARN("Using default device resolution %d\n", physDev->pi->ppd->DefaultResolution);
188 physDev->logPixelsX = physDev->pi->ppd->DefaultResolution;
189 physDev->logPixelsY = physDev->logPixelsX;
192 if(physDev->Devmode->dmPublic.dmFields & DM_PAPERSIZE) {
193 LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) {
194 if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize)
198 if(&page->entry == &physDev->pi->ppd->PageSizes) {
199 FIXME("Can't find page\n");
200 physDev->ImageableArea.left = 0;
201 physDev->ImageableArea.right = 0;
202 physDev->ImageableArea.bottom = 0;
203 physDev->ImageableArea.top = 0;
204 physDev->PageSize.cx = 0;
205 physDev->PageSize.cy = 0;
206 } else if(page->ImageableArea) {
207 /* physDev sizes in device units; ppd sizes in 1/72" */
208 physDev->ImageableArea.left = page->ImageableArea->llx *
209 physDev->logPixelsX / 72;
210 physDev->ImageableArea.right = page->ImageableArea->urx *
211 physDev->logPixelsX / 72;
212 physDev->ImageableArea.bottom = page->ImageableArea->lly *
213 physDev->logPixelsY / 72;
214 physDev->ImageableArea.top = page->ImageableArea->ury *
215 physDev->logPixelsY / 72;
216 physDev->PageSize.cx = page->PaperDimension->x *
217 physDev->logPixelsX / 72;
218 physDev->PageSize.cy = page->PaperDimension->y *
219 physDev->logPixelsY / 72;
221 physDev->ImageableArea.left = physDev->ImageableArea.bottom = 0;
222 physDev->ImageableArea.right = physDev->PageSize.cx =
223 page->PaperDimension->x * physDev->logPixelsX / 72;
224 physDev->ImageableArea.top = physDev->PageSize.cy =
225 page->PaperDimension->y * physDev->logPixelsY / 72;
227 } else if((physDev->Devmode->dmPublic.dmFields & DM_PAPERLENGTH) &&
228 (physDev->Devmode->dmPublic.dmFields & DM_PAPERWIDTH)) {
229 /* physDev sizes in device units; Devmode sizes in 1/10 mm */
230 physDev->ImageableArea.left = physDev->ImageableArea.bottom = 0;
231 physDev->ImageableArea.right = physDev->PageSize.cx =
232 physDev->Devmode->dmPublic.u1.s1.dmPaperWidth *
233 physDev->logPixelsX / 254;
234 physDev->ImageableArea.top = physDev->PageSize.cy =
235 physDev->Devmode->dmPublic.u1.s1.dmPaperLength *
236 physDev->logPixelsY / 254;
238 FIXME("Odd dmFields %x\n", physDev->Devmode->dmPublic.dmFields);
239 physDev->ImageableArea.left = 0;
240 physDev->ImageableArea.right = 0;
241 physDev->ImageableArea.bottom = 0;
242 physDev->ImageableArea.top = 0;
243 physDev->PageSize.cx = 0;
244 physDev->PageSize.cy = 0;
247 TRACE("ImageableArea = %d,%d - %d,%d: PageSize = %dx%d\n",
248 physDev->ImageableArea.left, physDev->ImageableArea.bottom,
249 physDev->ImageableArea.right, physDev->ImageableArea.top,
250 physDev->PageSize.cx, physDev->PageSize.cy);
252 /* these are in device units */
253 width = physDev->ImageableArea.right - physDev->ImageableArea.left;
254 height = physDev->ImageableArea.top - physDev->ImageableArea.bottom;
256 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_PORTRAIT) {
257 physDev->horzRes = width;
258 physDev->vertRes = height;
260 physDev->horzRes = height;
261 physDev->vertRes = width;
264 /* these are in mm */
265 physDev->horzSize = (physDev->horzRes * 25.4) / physDev->logPixelsX;
266 physDev->vertSize = (physDev->vertRes * 25.4) / physDev->logPixelsY;
268 TRACE("devcaps: horzSize = %dmm, vertSize = %dmm, "
269 "horzRes = %d, vertRes = %d\n",
270 physDev->horzSize, physDev->vertSize,
271 physDev->horzRes, physDev->vertRes);
274 static PSDRV_PDEVICE *create_psdrv_physdev( PRINTERINFO *pi )
276 PSDRV_PDEVICE *physDev;
278 physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) );
279 if (!physDev) return NULL;
281 physDev->Devmode = HeapAlloc( GetProcessHeap(), 0, sizeof(PSDRV_DEVMODE) );
282 if (!physDev->Devmode)
284 HeapFree( GetProcessHeap(), 0, physDev );
288 *physDev->Devmode = *pi->Devmode;
290 physDev->logPixelsX = pi->ppd->DefaultResolution;
291 physDev->logPixelsY = pi->ppd->DefaultResolution;
295 /**********************************************************************
298 static BOOL PSDRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
299 LPCWSTR output, const DEVMODEW* initData )
301 PSDRV_PDEVICE *physDev;
304 TRACE("(%s %s %s %p)\n", debugstr_w(driver), debugstr_w(device),
305 debugstr_w(output), initData);
307 if (!device) return FALSE;
308 pi = PSDRV_FindPrinterInfo( device );
309 if(!pi) return FALSE;
312 RASTERIZER_STATUS status;
313 if(!GetRasterizerCaps(&status, sizeof(status)) ||
314 !(status.wFlags & TT_AVAILABLE) ||
315 !(status.wFlags & TT_ENABLED)) {
316 MESSAGE("Disabling printer %s since it has no builtin fonts and there are no TrueType fonts available.\n",
322 if (!(physDev = create_psdrv_physdev( pi ))) return FALSE;
324 if (output && *output) physDev->job.output = strdupW( output );
327 PSDRV_MergeDevmodes(physDev->Devmode, (const PSDRV_DEVMODE *)initData, pi);
329 PSDRV_UpdateDevCaps(physDev);
330 SelectObject( (*pdev)->hdc, PSDRV_DefaultFont );
331 push_dc_driver( pdev, &physDev->dev, &psdrv_funcs );
336 /**********************************************************************
337 * PSDRV_CreateCompatibleDC
339 static BOOL PSDRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
341 HDC hdc = (*pdev)->hdc;
342 PSDRV_PDEVICE *physDev, *orig_dev = get_psdrv_dev( orig );
343 PRINTERINFO *pi = PSDRV_FindPrinterInfo( orig_dev->pi->friendly_name );
345 if (!pi) return FALSE;
346 if (!(physDev = create_psdrv_physdev( pi ))) return FALSE;
347 PSDRV_MergeDevmodes( physDev->Devmode, orig_dev->Devmode, pi );
348 PSDRV_UpdateDevCaps(physDev);
349 SelectObject( hdc, PSDRV_DefaultFont );
350 push_dc_driver( pdev, &physDev->dev, &psdrv_funcs );
356 /**********************************************************************
359 static BOOL PSDRV_DeleteDC( PHYSDEV dev )
361 PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
365 HeapFree( GetProcessHeap(), 0, physDev->Devmode );
366 HeapFree( GetProcessHeap(), 0, physDev->job.output );
367 HeapFree( GetProcessHeap(), 0, physDev );
373 /**********************************************************************
376 static HDC PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData )
378 PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
382 PSDRV_MergeDevmodes(physDev->Devmode, (const PSDRV_DEVMODE *)lpInitData, physDev->pi);
383 PSDRV_UpdateDevCaps(physDev);
388 /***********************************************************************
389 * GetDeviceCaps (WINEPS.@)
391 static INT PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
393 PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
395 TRACE("%p,%d\n", dev->hdc, cap);
402 return DT_RASPRINTER;
404 return MulDiv(physDev->horzSize, 100,
405 physDev->Devmode->dmPublic.u1.s1.dmScale);
407 return MulDiv(physDev->vertSize, 100,
408 physDev->Devmode->dmPublic.u1.s1.dmScale);
411 return physDev->horzRes;
414 return physDev->vertRes;
416 return (physDev->pi->ppd->ColorDevice != CD_False) ? 32 : 1;
430 return sizeof(PSDRV_PDEVICE);
432 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
433 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
435 return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
436 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
438 return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
439 PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
441 return TC_CR_ANY | TC_VA_ABLE; /* psdrv 0x59f7 */
445 return (RC_BITBLT | RC_BITMAP64 | RC_GDI20_OUTPUT | RC_DIBTODEV |
446 RC_STRETCHBLT | RC_STRETCHDIB); /* psdrv 0x6e99 */
448 return physDev->logPixelsX;
450 return physDev->logPixelsY;
452 return (int)hypot( (double)physDev->logPixelsX,
453 (double)physDev->logPixelsY );
455 return MulDiv(physDev->logPixelsX,
456 physDev->Devmode->dmPublic.u1.s1.dmScale, 100);
458 return MulDiv(physDev->logPixelsY,
459 physDev->Devmode->dmPublic.u1.s1.dmScale, 100);
467 return (physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) ?
468 physDev->PageSize.cy : physDev->PageSize.cx;
470 return (physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) ?
471 physDev->PageSize.cx : physDev->PageSize.cy;
472 case PHYSICALOFFSETX:
473 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
474 if(physDev->pi->ppd->LandscapeOrientation == -90)
475 return physDev->PageSize.cy - physDev->ImageableArea.top;
477 return physDev->ImageableArea.bottom;
479 return physDev->ImageableArea.left;
481 case PHYSICALOFFSETY:
482 if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
483 if(physDev->pi->ppd->LandscapeOrientation == -90)
484 return physDev->PageSize.cx - physDev->ImageableArea.right;
486 return physDev->ImageableArea.left;
488 return physDev->PageSize.cy - physDev->ImageableArea.top;
498 FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
503 static PRINTER_ENUM_VALUESA *load_font_sub_table( HANDLE printer, DWORD *num_entries )
505 DWORD res, needed, num;
506 PRINTER_ENUM_VALUESA *table = NULL;
507 static const char fontsubkey[] = "PrinterDriverData\\FontSubTable";
511 res = EnumPrinterDataExA( printer, fontsubkey, NULL, 0, &needed, &num );
512 if (res != ERROR_MORE_DATA) return NULL;
514 table = HeapAlloc( PSDRV_Heap, 0, needed );
515 if (!table) return NULL;
517 res = EnumPrinterDataExA( printer, fontsubkey, (LPBYTE)table, needed, &needed, &num );
518 if (res != ERROR_SUCCESS)
520 HeapFree( PSDRV_Heap, 0, table );
528 static PSDRV_DEVMODE *get_printer_devmode( HANDLE printer )
530 DWORD needed, dm_size;
532 PRINTER_INFO_9W *info;
535 GetPrinterW( printer, 9, NULL, 0, &needed );
536 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return NULL;
538 info = HeapAlloc( PSDRV_Heap, 0, needed );
539 res = GetPrinterW( printer, 9, (BYTE *)info, needed, &needed );
540 if (!res || !info->pDevMode)
542 HeapFree( PSDRV_Heap, 0, info );
546 /* sanity check the sizes */
547 dm_size = info->pDevMode->dmSize + info->pDevMode->dmDriverExtra;
548 if ((char *)info->pDevMode - (char *)info + dm_size > needed)
550 HeapFree( PSDRV_Heap, 0, info );
554 dm = (PSDRV_DEVMODE*)info;
555 memmove( dm, info->pDevMode, dm_size );
559 static PSDRV_DEVMODE *get_devmode( HANDLE printer, const WCHAR *name, BOOL *is_default )
561 PSDRV_DEVMODE *dm = get_printer_devmode( printer );
565 if (dm && dm->dmPublic.dmSize + dm->dmPublic.dmDriverExtra >= sizeof(DefaultDevmode))
567 TRACE( "Retrieved devmode from winspool\n" );
570 HeapFree( PSDRV_Heap, 0, dm );
572 TRACE( "Using default devmode\n" );
573 dm = HeapAlloc( PSDRV_Heap, 0, sizeof(DefaultDevmode) );
576 *dm = DefaultDevmode;
577 lstrcpynW( (WCHAR *)dm->dmPublic.dmDeviceName, name, CCHDEVICENAME );
583 static BOOL set_devmode( HANDLE printer, PSDRV_DEVMODE *dm )
585 PRINTER_INFO_9W info;
586 info.pDevMode = &dm->dmPublic;
588 return SetPrinterW( printer, 9, (BYTE *)&info, 0 );
591 static char *get_ppd_filename( HANDLE printer )
594 DRIVER_INFO_2W *info;
597 GetPrinterDriverW( printer, NULL, 2, NULL, 0, &needed );
598 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return NULL;
599 info = HeapAlloc( GetProcessHeap(), 0, needed );
600 if (!info) return NULL;
601 GetPrinterDriverW( printer, NULL, 2, (BYTE*)info, needed, &needed );
602 unixname = wine_get_unix_file_name( info->pDataFile );
603 HeapFree( GetProcessHeap(), 0, info );
608 static struct list printer_list = LIST_INIT( printer_list );
610 /**********************************************************************
611 * PSDRV_FindPrinterInfo
613 PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
619 char *ppd_filename = NULL, *nameA = NULL;
620 BOOL using_default_devmode = FALSE;
623 TRACE("'%s'\n", debugstr_w(name));
625 LIST_FOR_EACH_ENTRY( pi, &printer_list, PRINTERINFO, entry )
627 if (!strcmpW( pi->friendly_name, name ))
631 pi = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) );
632 if (pi == NULL) return NULL;
634 if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (strlenW(name)+1)*sizeof(WCHAR) ))) goto fail;
635 strcpyW( pi->friendly_name, name );
637 if (OpenPrinterW( pi->friendly_name, &hPrinter, NULL ) == 0) {
638 ERR ("OpenPrinter failed with code %i\n", GetLastError ());
642 len = WideCharToMultiByte( CP_ACP, 0, name, -1, NULL, 0, NULL, NULL );
643 nameA = HeapAlloc( GetProcessHeap(), 0, len );
644 WideCharToMultiByte( CP_ACP, 0, name, -1, nameA, len, NULL, NULL );
646 pi->Devmode = get_devmode( hPrinter, name, &using_default_devmode );
647 if (!pi->Devmode) goto fail;
649 ppd_filename = get_ppd_filename( hPrinter );
650 if (!ppd_filename) goto fail;
652 pi->ppd = PSDRV_ParsePPD( ppd_filename, hPrinter );
655 WARN( "Couldn't parse PPD file '%s'\n", ppd_filename );
659 if(using_default_devmode) {
662 if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE | LOCALE_RETURN_NUMBER,
663 (LPWSTR)&papersize, sizeof(papersize)/sizeof(WCHAR))) {
665 memset(&dm, 0, sizeof(dm));
666 dm.dmPublic.dmFields = DM_PAPERSIZE;
667 dm.dmPublic.u1.s1.dmPaperSize = papersize;
668 PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
672 if(pi->ppd->DefaultPageSize) { /* We'll let the ppd override the devmode */
674 memset(&dm, 0, sizeof(dm));
675 dm.dmPublic.dmFields = DM_PAPERSIZE;
676 dm.dmPublic.u1.s1.dmPaperSize = pi->ppd->DefaultPageSize->WinPage;
677 PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
680 /* Duplex is indicated by the setting of the DM_DUPLEX bit in dmFields.
681 WinDuplex == 0 is a special case which means that the ppd has a
682 *DefaultDuplex: NotCapable entry. In this case we'll try not to confuse
683 apps and set dmDuplex to DMDUP_SIMPLEX but leave the DM_DUPLEX clear.
684 PSDRV_WriteHeader understands this and copes. */
685 pi->Devmode->dmPublic.dmFields &= ~DM_DUPLEX;
686 if(pi->ppd->DefaultDuplex) {
687 pi->Devmode->dmPublic.dmDuplex = pi->ppd->DefaultDuplex->WinDuplex;
688 if(pi->Devmode->dmPublic.dmDuplex != 0)
689 pi->Devmode->dmPublic.dmFields |= DM_DUPLEX;
691 pi->Devmode->dmPublic.dmDuplex = DMDUP_SIMPLEX;
694 set_devmode( hPrinter, pi->Devmode );
696 pi->FontSubTable = load_font_sub_table( hPrinter, &pi->FontSubTableSize );
698 LIST_FOR_EACH_ENTRY( font, &pi->ppd->InstalledFonts, FONTNAME, entry )
700 afm = PSDRV_FindAFMinList(PSDRV_AFMFontList, font->Name);
702 TRACE( "Couldn't find AFM file for installed printer font '%s' - "
703 "ignoring\n", font->Name);
707 if (PSDRV_AddAFMtoList(&pi->Fonts, afm, &added) == FALSE) {
708 PSDRV_FreeAFMList(pi->Fonts);
714 ClosePrinter( hPrinter );
715 HeapFree( GetProcessHeap(), 0, nameA );
716 HeapFree( GetProcessHeap(), 0, ppd_filename );
717 list_add_head( &printer_list, &pi->entry );
721 if (hPrinter) ClosePrinter( hPrinter );
722 HeapFree(PSDRV_Heap, 0, pi->FontSubTable);
723 HeapFree(PSDRV_Heap, 0, pi->friendly_name);
724 HeapFree(PSDRV_Heap, 0, pi->Devmode);
725 HeapFree(PSDRV_Heap, 0, pi);
726 HeapFree( GetProcessHeap(), 0, nameA );
727 HeapFree( GetProcessHeap(), 0, ppd_filename );
732 static const struct gdi_dc_funcs psdrv_funcs =
734 NULL, /* pAbortDoc */
735 NULL, /* pAbortPath */
736 NULL, /* pAlphaBlend */
737 NULL, /* pAngleArc */
738 PSDRV_Arc, /* pArc */
740 NULL, /* pBeginPath */
741 NULL, /* pBlendImage */
742 PSDRV_Chord, /* pChord */
743 NULL, /* pCloseFigure */
744 PSDRV_CreateCompatibleDC, /* pCreateCompatibleDC */
745 PSDRV_CreateDC, /* pCreateDC */
746 PSDRV_DeleteDC, /* pDeleteDC */
747 NULL, /* pDeleteObject */
748 PSDRV_DeviceCapabilities, /* pDeviceCapabilities */
749 PSDRV_Ellipse, /* pEllipse */
750 PSDRV_EndDoc, /* pEndDoc */
751 PSDRV_EndPage, /* pEndPage */
753 PSDRV_EnumFonts, /* pEnumFonts */
754 NULL, /* pEnumICMProfiles */
755 NULL, /* pExcludeClipRect */
756 PSDRV_ExtDeviceMode, /* pExtDeviceMode */
757 PSDRV_ExtEscape, /* pExtEscape */
758 NULL, /* pExtFloodFill */
759 NULL, /* pExtSelectClipRgn */
760 PSDRV_ExtTextOut, /* pExtTextOut */
761 PSDRV_FillPath, /* pFillPath */
763 NULL, /* pFlattenPath */
764 NULL, /* pFontIsLinked */
765 NULL, /* pFrameRgn */
766 NULL, /* pGdiComment */
767 NULL, /* pGdiRealizationInfo */
768 NULL, /* pGetBoundsRect */
769 NULL, /* pGetCharABCWidths */
770 NULL, /* pGetCharABCWidthsI */
771 PSDRV_GetCharWidth, /* pGetCharWidth */
772 PSDRV_GetDeviceCaps, /* pGetDeviceCaps */
773 NULL, /* pGetDeviceGammaRamp */
774 NULL, /* pGetFontData */
775 NULL, /* pGetFontUnicodeRanges */
776 NULL, /* pGetGlyphIndices */
777 NULL, /* pGetGlyphOutline */
778 NULL, /* pGetICMProfile */
779 NULL, /* pGetImage */
780 NULL, /* pGetKerningPairs */
781 NULL, /* pGetNearestColor */
782 NULL, /* pGetOutlineTextMetrics */
783 NULL, /* pGetPixel */
784 NULL, /* pGetSystemPaletteEntries */
785 NULL, /* pGetTextCharsetInfo */
786 PSDRV_GetTextExtentExPoint, /* pGetTextExtentExPoint */
787 NULL, /* pGetTextExtentExPointI */
788 NULL, /* pGetTextFace */
789 PSDRV_GetTextMetrics, /* pGetTextMetrics */
790 NULL, /* pGradientFill */
791 NULL, /* pIntersectClipRect */
792 NULL, /* pInvertRgn */
793 PSDRV_LineTo, /* pLineTo */
794 NULL, /* pModifyWorldTransform */
796 NULL, /* pOffsetClipRgn */
797 NULL, /* pOffsetViewportOrg */
798 NULL, /* pOffsetWindowOrg */
799 PSDRV_PaintRgn, /* pPaintRgn */
800 PSDRV_PatBlt, /* pPatBlt */
801 PSDRV_Pie, /* pPie */
802 PSDRV_PolyBezier, /* pPolyBezier */
803 PSDRV_PolyBezierTo, /* pPolyBezierTo */
804 NULL, /* pPolyDraw */
805 PSDRV_PolyPolygon, /* pPolyPolygon */
806 PSDRV_PolyPolyline, /* pPolyPolyline */
808 NULL, /* pPolyline */
809 NULL, /* pPolylineTo */
810 PSDRV_PutImage, /* pPutImage */
811 NULL, /* pRealizeDefaultPalette */
812 NULL, /* pRealizePalette */
813 PSDRV_Rectangle, /* pRectangle */
814 PSDRV_ResetDC, /* pResetDC */
815 NULL, /* pRestoreDC */
816 PSDRV_RoundRect, /* pRoundRect */
818 NULL, /* pScaleViewportExt */
819 NULL, /* pScaleWindowExt */
820 NULL, /* pSelectBitmap */
821 PSDRV_SelectBrush, /* pSelectBrush */
822 NULL, /* pSelectClipPath */
823 PSDRV_SelectFont, /* pSelectFont */
824 NULL, /* pSelectPalette */
825 PSDRV_SelectPen, /* pSelectPen */
826 NULL, /* pSetArcDirection */
827 PSDRV_SetBkColor, /* pSetBkColor */
828 NULL, /* pSetBkMode */
829 NULL, /* pSetBoundsRect */
830 PSDRV_SetDCBrushColor, /* pSetDCBrushColor */
831 PSDRV_SetDCPenColor, /* pSetDCPenColor */
832 NULL, /* pSetDIBitsToDevice */
833 NULL, /* pSetDeviceClipping */
834 NULL, /* pSetDeviceGammaRamp */
835 NULL, /* pSetLayout */
836 NULL, /* pSetMapMode */
837 NULL, /* pSetMapperFlags */
838 PSDRV_SetPixel, /* pSetPixel */
839 NULL, /* pSetPolyFillMode */
841 NULL, /* pSetRelAbs */
842 NULL, /* pSetStretchBltMode */
843 NULL, /* pSetTextAlign */
844 NULL, /* pSetTextCharacterExtra */
845 PSDRV_SetTextColor, /* pSetTextColor */
846 NULL, /* pSetTextJustification */
847 NULL, /* pSetViewportExt */
848 NULL, /* pSetViewportOrg */
849 NULL, /* pSetWindowExt */
850 NULL, /* pSetWindowOrg */
851 NULL, /* pSetWorldTransform */
852 PSDRV_StartDoc, /* pStartDoc */
853 PSDRV_StartPage, /* pStartPage */
854 NULL, /* pStretchBlt */
855 NULL, /* pStretchDIBits */
856 PSDRV_StrokeAndFillPath, /* pStrokeAndFillPath */
857 PSDRV_StrokePath, /* pStrokePath */
858 NULL, /* pUnrealizePalette */
859 NULL, /* pWidenPath */
860 NULL, /* wine_get_wgl_driver */
861 GDI_PRIORITY_GRAPHICS_DRV /* priority */
865 /******************************************************************************
866 * PSDRV_get_gdi_driver
868 const struct gdi_dc_funcs * CDECL PSDRV_get_gdi_driver( unsigned int version )
870 if (version != WINE_GDI_DRIVER_VERSION)
872 ERR( "version mismatch, gdi32 wants %u but wineps has %u\n", version, WINE_GDI_DRIVER_VERSION );