Huw Davies : wineps.drv: Try to use the PostSript name of a font.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Feb 5 07:44:59 CST 2007
Module: wine
Branch: master
Commit: c0cb341adf307c11e870c9c39e1de28c594f303c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c0cb341adf307c11e870c9c39e1de28c594f303c
Author: Huw Davies <huw at codeweavers.com>
Date: Thu Feb 1 15:00:44 2007 +0000
wineps.drv: Try to use the PostSript name of a font.
---
dlls/wineps.drv/download.c | 67 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/dlls/wineps.drv/download.c b/dlls/wineps.drv/download.c
index 5d35f5d..fdc8a7c 100644
--- a/dlls/wineps.drv/download.c
+++ b/dlls/wineps.drv/download.c
@@ -52,6 +52,73 @@ static void get_download_name(PSDRV_PDEV
{
int len;
char *p;
+ DWORD size;
+
+ size = GetFontData(physDev->hdc, MS_MAKE_TAG('n','a','m','e'), 0, NULL, 0);
+ if(size != 0 && size != GDI_ERROR)
+ {
+ BYTE *name = HeapAlloc(GetProcessHeap(), 0, size);
+ if(name)
+ {
+ USHORT count, i;
+ BYTE *strings;
+ struct
+ {
+ USHORT platform_id;
+ USHORT encoding_id;
+ USHORT language_id;
+ USHORT name_id;
+ USHORT length;
+ USHORT offset;
+ } *name_record;
+
+ GetFontData(physDev->hdc, MS_MAKE_TAG('n','a','m','e'), 0, name, size);
+ count = GET_BE_WORD(name + 2);
+ strings = name + GET_BE_WORD(name + 4);
+ name_record = (typeof(name_record))(name + 6);
+ for(i = 0; i < count; i++, name_record++)
+ {
+ name_record->platform_id = GET_BE_WORD(&name_record->platform_id);
+ name_record->encoding_id = GET_BE_WORD(&name_record->encoding_id);
+ name_record->language_id = GET_BE_WORD(&name_record->language_id);
+ name_record->name_id = GET_BE_WORD(&name_record->name_id);
+ name_record->length = GET_BE_WORD(&name_record->length);
+ name_record->offset = GET_BE_WORD(&name_record->offset);
+
+ if(name_record->platform_id == 1 && name_record->encoding_id == 0 &&
+ name_record->language_id == 0 && name_record->name_id == 6)
+ {
+ TRACE("Got Mac PS name %s\n", debugstr_an((char*)strings + name_record->offset, name_record->length));
+ *str = HeapAlloc(GetProcessHeap(), 0, name_record->length + 1);
+ memcpy(*str, strings + name_record->offset, name_record->length);
+ *(*str + name_record->length) = '\0';
+ HeapFree(GetProcessHeap(), 0, name);
+ return;
+ }
+ if(name_record->platform_id == 3 && name_record->encoding_id == 1 &&
+ name_record->language_id == 0x409 && name_record->name_id == 6)
+ {
+ WCHAR *unicode = HeapAlloc(GetProcessHeap(), 0, name_record->length + 2);
+ DWORD len;
+ int c;
+
+ for(c = 0; c < name_record->length / 2; c++)
+ unicode[c] = GET_BE_WORD(strings + name_record->offset + c * 2);
+ unicode[c] = 0;
+ TRACE("Got Windows PS name %s\n", debugstr_w(unicode));
+ len = WideCharToMultiByte(1252, 0, unicode, -1, NULL, 0, NULL, NULL);
+ *str = HeapAlloc(GetProcessHeap(), 0, len);
+ WideCharToMultiByte(1252, 0, unicode, -1, *str, len, NULL, NULL);
+ HeapFree(GetProcessHeap(), 0, unicode);
+ HeapFree(GetProcessHeap(), 0, name);
+ return;
+ }
+ }
+ TRACE("Unable to find PostScript name\n");
+ HeapFree(GetProcessHeap(), 0, name);
+ }
+ }
+
len = strlen((char*)potm + (ptrdiff_t)potm->otmpFullName) + 1;
*str = HeapAlloc(GetProcessHeap(),0,len);
strcpy(*str, (char*)potm + (ptrdiff_t)potm->otmpFullName);
More information about the wine-cvs
mailing list