wineps.drv: Try to use the PostSript name of a font.
This commit is contained in:
parent
37b671c59a
commit
c0cb341adf
|
@ -52,6 +52,73 @@ static void get_download_name(PSDRV_PDEVICE *physDev, LPOUTLINETEXTMETRICA
|
|||
{
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue