don't sort product of liga components to keep declaration order

technically we are tweaking the original example from the spec but it keeps the spirit, so that the product of glyph classes produces the same representation in the font as if the sequences were manually enumerated (while keeping the declaration order)
This commit is contained in:
Cosimo Lupo 2024-01-24 12:34:48 +00:00
parent f96b2128a1
commit 957b5fb45a
No known key found for this signature in database
GPG Key ID: DF65A8A5A119C9A8
3 changed files with 11 additions and 11 deletions

View File

@ -1338,7 +1338,7 @@ class Builder(object):
# substitutions to be specified on target sequences that contain # substitutions to be specified on target sequences that contain
# glyph classes, the implementation software will enumerate # glyph classes, the implementation software will enumerate
# all specific glyph sequences if glyph classes are detected" # all specific glyph sequences if glyph classes are detected"
for g in sorted(itertools.product(*glyphs)): for g in itertools.product(*glyphs):
lookup.ligatures[g] = replacement lookup.ligatures[g] = replacement
# GSUB 5/6 # GSUB 5/6

View File

@ -2,7 +2,7 @@
# http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html # http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
feature F1 { feature F1 {
sub [one one.oldstyle] [slash fraction] [two two.oldstyle] by onehalf; sub [one one.oldstyle] [fraction slash] [two two.oldstyle] by onehalf;
} F1; } F1;
# Since the OpenType specification does not allow ligature substitutions # Since the OpenType specification does not allow ligature substitutions
@ -12,12 +12,12 @@ feature F1 {
# example produces an identical representation in the font as if all # example produces an identical representation in the font as if all
# the sequences were manually enumerated by the font editor: # the sequences were manually enumerated by the font editor:
feature F2 { feature F2 {
sub one slash two by onehalf;
sub one.oldstyle slash two by onehalf;
sub one fraction two by onehalf; sub one fraction two by onehalf;
sub one.oldstyle fraction two by onehalf;
sub one slash two.oldstyle by onehalf;
sub one.oldstyle slash two.oldstyle by onehalf;
sub one fraction two.oldstyle by onehalf; sub one fraction two.oldstyle by onehalf;
sub one slash two by onehalf;
sub one slash two.oldstyle by onehalf;
sub one.oldstyle fraction two by onehalf;
sub one.oldstyle fraction two.oldstyle by onehalf; sub one.oldstyle fraction two.oldstyle by onehalf;
sub one.oldstyle slash two by onehalf;
sub one.oldstyle slash two.oldstyle by onehalf;
} F2; } F2;

View File

@ -62,16 +62,16 @@
<!-- SubTableCount=1 --> <!-- SubTableCount=1 -->
<LigatureSubst index="0"> <LigatureSubst index="0">
<LigatureSet glyph="one"> <LigatureSet glyph="one">
<Ligature components="slash,two" glyph="onehalf"/>
<Ligature components="fraction,two" glyph="onehalf"/> <Ligature components="fraction,two" glyph="onehalf"/>
<Ligature components="slash,two.oldstyle" glyph="onehalf"/>
<Ligature components="fraction,two.oldstyle" glyph="onehalf"/> <Ligature components="fraction,two.oldstyle" glyph="onehalf"/>
<Ligature components="slash,two" glyph="onehalf"/>
<Ligature components="slash,two.oldstyle" glyph="onehalf"/>
</LigatureSet> </LigatureSet>
<LigatureSet glyph="one.oldstyle"> <LigatureSet glyph="one.oldstyle">
<Ligature components="slash,two" glyph="onehalf"/>
<Ligature components="fraction,two" glyph="onehalf"/> <Ligature components="fraction,two" glyph="onehalf"/>
<Ligature components="slash,two.oldstyle" glyph="onehalf"/>
<Ligature components="fraction,two.oldstyle" glyph="onehalf"/> <Ligature components="fraction,two.oldstyle" glyph="onehalf"/>
<Ligature components="slash,two" glyph="onehalf"/>
<Ligature components="slash,two.oldstyle" glyph="onehalf"/>
</LigatureSet> </LigatureSet>
</LigatureSubst> </LigatureSubst>
</Lookup> </Lookup>