[feaLib] Fix handing of duplicate LigatureCaret

The spec has been updated for a while to allow only one rule per glyph,
and makeotf uses the first and ignores the rest.

See https://github.com/adobe-type-tools/afdko/issues/95, and
https://github.com/adobe-type-tools/afdko/issues/155
This commit is contained in:
Khaled Hosny 2019-09-26 16:44:46 +02:00
parent 7ed5c78dc1
commit b99ae0d469
5 changed files with 6 additions and 18 deletions

View File

@ -1049,11 +1049,13 @@ class Builder(object):
def add_ligatureCaretByIndex_(self, location, glyphs, carets):
for glyph in glyphs:
self.ligCaretPoints_.setdefault(glyph, set()).update(carets)
if glyph not in self.ligCaretPoints_:
self.ligCaretPoints_[glyph] = carets
def add_ligatureCaretByPos_(self, location, glyphs, carets):
for glyph in glyphs:
self.ligCaretCoords_.setdefault(glyph, set()).update(carets)
if glyph not in self.ligCaretCoords_:
self.ligCaretCoords_[glyph] = carets
def add_name_record(self, location, nameID, platformID, platEncID,
langID, string):

View File

@ -1,10 +1,6 @@
table GDEF {
LigatureCaretByIndex [c_t s_t] 11;
# The OpenType Feature File specification does not define what should
# happen when there are multiple LigatureCaretByIndex statements for
# the same glyph. Our behavior matches that of Adobe makeotf v2.0.90.
# https://github.com/adobe-type-tools/afdko/issues/95
LigatureCaretByIndex o_f_f_i 66 33;
LigatureCaretByIndex o_f_f_i 55;
} GDEF;

View File

@ -17,14 +17,11 @@
</CaretValue>
</LigGlyph>
<LigGlyph index="1">
<!-- CaretCount=3 -->
<!-- CaretCount=2 -->
<CaretValue index="0" Format="2">
<CaretValuePoint value="33"/>
</CaretValue>
<CaretValue index="1" Format="2">
<CaretValuePoint value="55"/>
</CaretValue>
<CaretValue index="2" Format="2">
<CaretValuePoint value="66"/>
</CaretValue>
</LigGlyph>

View File

@ -1,10 +1,6 @@
table GDEF {
LigatureCaretByPos [c_h c_k] 500;
# The OpenType Feature File specification does not define what should
# happen when there are multiple LigatureCaretByPos statements for
# the same glyph. Our behavior matches that of Adobe makeotf v2.0.90.
# https://github.com/adobe-type-tools/afdko/issues/95
LigatureCaretByPos o_f_f_i 700 300;
LigatureCaretByPos o_f_f_i 900;
} GDEF;

View File

@ -23,16 +23,13 @@
</CaretValue>
</LigGlyph>
<LigGlyph index="2">
<!-- CaretCount=3 -->
<!-- CaretCount=2 -->
<CaretValue index="0" Format="1">
<Coordinate value="300"/>
</CaretValue>
<CaretValue index="1" Format="1">
<Coordinate value="700"/>
</CaretValue>
<CaretValue index="2" Format="1">
<Coordinate value="900"/>
</CaretValue>
</LigGlyph>
</LigCaretList>
</GDEF>