GNOME Bugzilla – Bug 118456
IGNORE_SPECIAL_MARKS handled wrongly
Last modified: 2003-07-29 15:07:22 UTC
In ftxgdef.c, Check_Property() does not handle the IGNORE_SPECIAL_MARKS flag in the gsub lookup flags correctly. When this flag is seen, it should left shift the flags by 8 to find the required class and then match it against the class of the glyph. This causes the ligature rule for glyph269 in microsoft's tunga.ttf not to be honoured. A patch and screenshots and utf test case is attached to this bug report. Please also refer to the documentation for LookupFlag bit enumeration at http://www.microsoft.com/typography/otspec/chapter2.htm Note that it also means that the ftxgdef.c part of this patch is wrong: http://people.redhat.com/otaylor/opentype-patches/pango-08-special-marks
Created attachment 18660 [details] utf testcase
Created attachment 18661 [details] wrong rendering (no ligature) with this bug
Created attachment 18662 [details] correct rendering (with this fix)
Created attachment 18663 [details] [review] patch fix (cvs diff)
Created attachment 18666 [details] [review] please use THIS patch for fix (cvs diff)
Hmm. If you just wanted the standard classes, why would you use IGNORE_SPECIAL_MARKS? When I dump out the tunga.ttf using 'ttx' from fonttools.sourceforge.net, I see the MarkAttach table: <MarkAttachClassDef Format="2"> <ClassDef glyph=".notdef#65" class="2"/> <ClassDef glyph="u0C4D" class="1"/> </MarkAttachClassDef> Which looks perfectly set up for this ligature: <Lookup index="4"> <LookupType value="4"/> <LookupFlag value="512"/> <!-- SubTableCount=1 --> <LigatureSubst index="0" Format="1"> <LigatureSet glyph=".notdef#140"> <Ligature components=".notdef#65" glyph=".notdef#145"/> </LigatureSet> <LigatureSet glyph=".notdef#142"> <Ligature components=".notdef#65" glyph=".notdef#146"/> </LigatureSet> </LigatureSubst> </Lookup> Since 512 == 2 << 8. So, something seems to be going wrong with the lookup in the MarkAttachClassDef table. (.notdef#140 is glyph 269, .notdef#65 is glyph 194)
Created attachment 18696 [details] [review] My attempt at fixing CheckProperty
I've attached my attempt at fixing IGNORE_SPECIAL_MARKS special marks handling. The main change is that the current code says: "Ignore everything but marks of the specified attach type" While what the OpenType spec specificies is: "Ignore *marks* of types different than the specified attach type" I've also changed the handling of setting the high byte along with other bits in the flag; with my patch, if you (1 << 8) || IgnoreBaseGlyphs it will ignore marks of attach type other than 1 *and* base glyphs, rather than just marks of attach typeother than 1. It works for your test case for me ... if you want to test it with a wider set of text, that would be appreciated.
Created attachment 18700 [details] [review] Another attempt
It occurred to me, while doing my laundry, that the last attempt still wasn't right. So, I've attached another patch, written in an extremely verbose and careful style. None-the-less, it might be wrong, so testing is appreciated :-)
tested your latest patch. it's good.
Tue Jul 29 09:58:13 2003 Owen Taylor <otaylor@redhat.com> * pango/opentype/ftxgdef.c (Check_Property): Rewrite handling of IGNORE_SPECIAL_MARKS to be properly "ignore marks of attachment type different than specified. (#118456, Kailash C. Chowksey)