http://bugs.winehq.org/show_bug.cgi?id=30798
Bug #: 30798 Summary: gdiplus: GdipNewInstalledFontCollection fails in case system have got at least one OTF font installed Product: Wine Version: 1.5.5 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: gdiplus AssignedTo: wine-bugs@winehq.org ReportedBy: mooroon2@mail.ru CC: dmitry@baikal.ru Classification: Unclassified
Recently I had been investigating Wine testcase failures on my linux box and one of them being gdiplus testcase failing two tests at lines font.c:396 and font.c:397.
Wine tests results database have results from other linux boxes where this test does succeed so I was wondering what's wrong with it on my system. After digging into the code for about an hour it turned out that gdiplus implementation is flawed in a way that it doesn't expect font type to be anything other than RASTER_FONTTYPE or TRUETYPE_FONTTYPE. It is not the case with current Wine's freetype-based font engine driver for OpenType fonts (OTF) - they are treated to be DEVICE_FONTTYPE.
It results in situation when add_font_proc() callback trying to add/process OTF fonts followed by is_font_installed_proc() terminating enumeration process as soon as it encounters a font with type != TRUETYPE_FONTTYPE.
Trivial patch as I attach to this bug report workarounds the problem and makes testcase pass these tests. I'm not sure that there are no bad consequences in treating DEVICE_FONTTYPE fonts the same way it treats TRUETYPE_FONTTYPE in gdiplus, but looking through Wine's freetype font driver makes me believe that the only font type that gets assigned DEVICE_FONTTYPE is the OTF format - and AFAIK it is pretty much the same as TTF WRT its properties and capabilities.
Another way to "fix" the thing is to skip fonts which have type other than TRUETYPE_FONTTYPE in add_font_proc() callback or rewrite Wine's freetype font engine driver to report TRUETYPE_FONTTYPE for OTF fonts (and make sure that the behavior for these font types is just the same). I don't gave enough knowledge in this area so we need someone competent it this question to fix this bug.