gdi32: Handle pre-Unicode "broken" symbol TTFs with symbols at U+00XX.
Konstantin L. Metlov
metlov at fti.dn.ua
Fri May 6 12:32:03 CDT 2011
There is a number of old pre-Unicode TrueType symbol fonts in circulation with wrong (or even absent) cmap tables, which maps (in
Freetype interpretation) their glyphs at U+00XX position instead of U+F0XX. This patch fixes interpretation of such TTFs by wine in a
non-intrusive way. It only changes the case when previously wine considered the symbol as missing (glyphId == 0).
Most notably this makes wine handle properly the Symbol_A.ttf font from an extensive Russian CAD software KOMPAS 3D. Making the
operation of this software completely flawless (previously some of the symbols, denoting "diameters", "degrees", etc. were shown as
black rectangles in drawings).
I have tested other symbol fonts and observed no side-effects from this patch.
With the best regards,
Konstantin L. Metlov.
dlls/gdi32/freetype.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index b329b33..af48ef0 100644
@@ -4556,6 +4556,13 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
if(font->ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL && glyph < 0x100)
glyph = glyph + 0xf000;
glyphId = pFT_Get_Char_Index(font->ft_face, glyph);
+ if ((glyphId == 0) && (font->ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL) && (glyph >= 0xf000) && (glyph < 0xf100))
+ /* for "normal" Symbol fonts this should return 0 and be redundant.
+ But there is a number of old pre-Unicode "broken" TTFs, which
+ do have symbols at U+00XX instead of U+f0XX */
+ glyphId = pFT_Get_Char_Index(font->ft_face, glyph - 0xf000);
More information about the wine-patches