wineps.drv: Add support for PostScript Format 2 standard glyph names.

This commit is contained in:
Erich E. Hoover 2015-09-03 16:16:31 -06:00 committed by Alexandre Julliard
parent ce0fbe4f1e
commit b66fcd68f7
1 changed files with 32 additions and 0 deletions

View File

@ -631,6 +631,19 @@ static void get_standard_glyph_name(WORD index, char *name)
snprintf(name, MAX_G_NAME + 1, "%s", glyph_table[index]->sz);
}
static int get_post2_name_index(BYTE *post2header, DWORD size, WORD index)
{
USHORT numberOfGlyphs = GET_BE_WORD(post2header);
DWORD offset = (1 + index) * sizeof(USHORT);
if(offset + sizeof(USHORT) > size || index >= numberOfGlyphs)
{
FIXME("Index '%d' exceeds PostScript Format 2 table size (%d)\n", index, numberOfGlyphs);
return -1;
}
return GET_BE_WORD(post2header + offset);
}
void get_glyph_name(HDC hdc, WORD index, char *name)
{
struct
@ -673,6 +686,25 @@ void get_glyph_name(HDC hdc, WORD index, char *name)
else
WARN("Font uses PostScript Format 1, but non-standard glyph (%d) requested.\n", index);
}
else if(post_header->format == MAKELONG(0, 2))
{
BYTE *post2header = post + sizeof(*post_header);
int glyphNameIndex;
size -= sizeof(*post_header);
if(size < sizeof(USHORT))
{
FIXME("PostScript Format 2 table is invalid (cannot fit header)\n");
goto cleanup;
}
glyphNameIndex = get_post2_name_index(post2header, size, index);
if(glyphNameIndex == -1)
goto cleanup; /* invalid index, use fallback name */
else if(glyphNameIndex < 258)
get_standard_glyph_name(glyphNameIndex, name);
else
FIXME("PostScript Format 2 custom glyphs are currently unsupported.\n");
}
else
FIXME("PostScript Format %d.%d glyph names are currently unsupported.\n",
HIWORD(post_header->format), LOWORD(post_header->format));