Apache OpenOffice (AOO) Bugzilla – Issue 102911
kerning fails for "DejaVu Serif" on Windows
Last modified: 2009-11-09 08:04:49 UTC
When using the DejaVu Serif font, kerning works on Ubuntu Linux 9.04, but not on Windows XP. I will attach an ODT file with two identical lines, the upper one with kerning disabled, the lower one with kerning enabled. When you open the attached file on a Windows XP system, both lines have the same length. When you open it on a Linux system, the lower line is shortened by kerning. I would like kerning to work on Windows, too. DejaVu is a set of fonts that can be obtained here: http://dejavu-fonts.org/
Created attachment 63068 [details] The ODF file showing the problem
please have a look
reassign
Windows XP Prof SP3, DejaVu Serif v2.21 (from OS), v2.29 from dejavu-fonts.org It seems to be a Windows--DejaVu trouble. Ms word viewer can't render this case too, but both OOo and WV can render Times New Roman with and without kerning.
Created attachment 63217 [details] WV screenshot
DejaVu has both GPOS.kern and SFNT.kern tables. OOo currently only supports SFNT.kerning, but since both tables are available and both are expected to provide the same pairs they should work... unless the information they provide is different. Or the kerning is not expressible in SFNT.kern, which can only cover horizontal pair kerning.
Would that mean that OpenOffice does the exact same thing on Linux (where it works) and Windows (where it doesn’t)? In that case, the problem would be the font, Ubuntu maybe having modified the SFNT.kern tables.
Confirming as per bormant.
On WinXP GetKerningPairsA() returns 0 when "DejaVu Serif" or DejaVu Serif Condensed" are selected into the HDC. The same call works for "DejaVu Sans" "DejaVu Sans Condensed" and ""DejaVu Sans Light". Analyzing...
Interestingly GetKerningPairsW() works for the problematic fonts when it is asked for the number of pairs, but if fails when asked for the actual pairs.
Maybe the WIN GDI call GetKerningPairs() fails because it cannot map every glyph pair referenced in the SFNT.kern.fmt1 array back to a unicode pair. E.g. "DejaVu Serif 2.2.1" has 1316 kerning pairs, two of which are problematic. They reference glyph 2408 ("Circumflex") which is not covered in the CMAP tables, so GDI cannot map that glyph back to its code point. The pairs are "CircumFlex"+"Comma"-73 and "CircumFlex"+"Period"-73. Could someone experienced with fontforge remove these two pairs and test with the fixed fonts?
Created attachment 63292 [details] fixed DejaVuSerif with kerning fix for WIN32
With the font I attached above WIN GDI is happy. For the test I just assigned a random unicode point to glyph2008 and GetKerningPairs() now works as expected. WordViewer seems to trust this API too and so has the same problem as OOo with the original "DejaVu Serif". If GetKerningPairs() would only return the pairs it knows about everything would be fine too. I guess nobody would complain if a circumflex+comma or period wouldn't kern perfectly. The only way work around problematic fonts of this kind is is to parse the kern tables ourselves on Windows too, like we do on UNX... darn. The much simpler way is to get the most important FOSS fonts checked. Maybe fontforge should warn in this case.
Created attachment 63298 [details] patch for FontForge
Every windows application that relies on the GDI call GetKerningPairs() will fail with these problematic fonts. On the other hand the font's kern table is valid and OOo is right that it trusts GDI to provide the kerning pairs. There are four ways to fix it: 1. fix Windows so that GetKerningPairs() ignores pairs it cannot handle 2. remove the problematic kernings from the DejaVu Serif fonts 3. make sure that every glyph mentioned in the kern table has a (proper or dummy) unicode inside the baseplane 4. make OOo and all other Windows applications avoid GDI calls and parse all font tables themselves Fixing the problematic fonts seems to be the best way. To identify them I sent a patch for fontforge which warns when such a problematic font is being generated. The mail should show up in http://sourceforge.net/mailarchive/forum.php?forum_name=fontforge- devel&max_rows=25&style=ultimate&viewmonth=200907 soon.
invalid -> closed
@hdu: when OO.o cares about something in fonts *please make sure it is detected by fontforge's fontlint* (and with a message people can actually understand) There are thousands of ways fonts can differ, some of them are detected but do not matter because apps learned how to workaround them, others do matter but are not detected (or hidden behind black vodoo messages) If you don't give people the means to detect problems that affect OO.o, you'll continue to get fed problem fonts
Fontforge itself now warns about the problematic fonts: See http://thread.gmane.org/gmane.comp.fonts.fontforge.devel/6359/focus=640 and http://fontforge.cvs.sourceforge.net/viewvc/fontforge/fontforge/fontforge/tottfaat.c? r1=1.41&r2=1.42 > and with a message people can actually understand I'm not a native speaker so I apologize that I just came up with this message "Kerning is likely to fail on Windows" "On Windows many apps will have problems with this font's kerning, because %d of its glyph kern pairs cannot be mapped to unicode-BMP kern pairs" Suggestions on a new wording that make the problem much clearer are very welcome.