gdi32/tests: Fix some font test failures on non-English machines

Greg Geldorp ggeldorp at vmware.com
Sun Jan 9 14:48:57 CST 2011


It appears that some text metrics are not intrinsic to the font but are
synthesized by Windows. In particular, I looked at the tmDefaultChar for
the "MS Gothic" font (responsible most of the failures seen at
http://test.winehq.org/data/fe6735b184d0067424647fdb69eba4a2a67a6165/xp_wtb-wxpprojasp3/gdi32:font.html).
When taking the msgothic.ttc font file from the Japanese machine and
installing it on an English machine, tmDefaultChar returned by Windows
changes from \uff65 ('HALFWIDTH KATAKANA MIDDLE DOT') to \u001f. Also,
when changing the system default language on the Japanese machine from
Japanese to English (United States), the same change happens.

I've gone through the TrueType font specification to find out how the
default char/missing glyph is stored. The only place I could find was in
the OS/2 table, but only in version 2 of that table. The OS/2 table in
msgothic.ttc is version 1 and so doesn't have the usDefaultChar member. I
could find no reference in any of the other tables (which makes kind of
sense, if the default char was stored in another table already they
wouldn't have had to add it to the OS/2 table in version 2).
Also, the FreeType library doesn't appear to be able to provide the
default char for TrueType fonts, only for Windows .fon files.

Therefore, I conclude that Windows computes some of the metrics. What I
can't figure out is exactly what algorithm it uses to compute them.
Obviously the system language is involved, as can be seen from the
different metrics for the same font when switching system languages. But
that's not the whole story, somehow the font is involved too because the
change on language switch only takes place for a couple of fonts and not
for others. What is clear is that tests are not correct and sometimes
compute an incorrect expected value. Since I can't correct the test
because the algorithm is unknown, I opted for marking them broken on
Windows, which makes sure they still get executed on Wine.

---
 dlls/gdi32/tests/font.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-gdi32-tests-Fix-some-font-test-failures-on-non-Engli.patch
Type: text/x-patch
Size: 2444 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20110109/929a757b/attachment.bin>


More information about the wine-patches mailing list