You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternative title: possible kerning data loss when glyph is group-kerned in LTR and RTL mode
As far as I understand, the way glyphsLib folds RTL into LTR kerning is like this:
Gather all glyphs touched by RTL kerning in the Glyphs.app file.
When generating UFO kerning groups, for each glyph check if it is in the set generated in step 1.
a. If not, put the glyph's (leftKerningGroup, rightKerningGroup) into the corresponding (public.kern1, public.kern2) group
b. If so, put the glyph's (leftKerningGroup, rightKerningGroup) into the corresponding (public.kern2, public.kern1) group
For each kerning pair in kerningRTL, flip the kerning group name (kern1 -> kern2 and vice versa) and then merge them into the regular UFO kerning dictionary
The either-or logic in step two implies that a glyph must be used either in LTR or RTL group kerning, but never in both. Glyph-to-glyph kerning has no such limitation because it obviously works without groups.
This means that neutral glyphs like period should, if they are put in a group, kerned only in LTR or in RTL mode, but not both, because currently the LTR kerning will point at the wrong kerning name.
Some test cases:
KerningRTL2.zip: No RTL kerning, just group kerning of a against period.
Resulting kerning groups:
public.kern1.a: [a]
public.kern1.period_right: [period]
public.kern2.alef: [alef-ar]
public.kern2.period_left: [period]
Resulting kerning:
(public.kern1.a, public.kern2.period_left) = -10
KerningRTL.zip: Additional RTL group kerning of alef against period.
Note how the presence of RTL kerning flips the side of the period_right and period_left group, as well as the alef group. Also note how the first kerning between a and period_left gets voided because there is no public.kern2.period_left anymore. glyphs2ufo indeed logs a warning saying "Non-existent glyph class public.kern2.period_left found in kerning rules".
Do I understand correctly that this is a known limitation of folding RTL into LTR kerning and that group kerning must be strictly separated into LTR and RTL? I.e. if you want to group-kern period, you should make a period-ar for RTL and group-kern that instead?
The text was updated successfully, but these errors were encountered:
, a flipped class will overwrite any unflipped class that was there before from LTR kerning. I.e. if you have a pair like (public.kern1.one, public.kern2.b), and you also group-kerned one against some RTL glyph, you'd get an RTL pair like (public.kern1.one, public.kern2.hah), the highlighted code would drop all LTR kerning pairs starting with public.kern1.one in favor of RTL pairs starting with the same group name. You can see this in Kerning.zip where the LTR pair (public.kern1.one, public.kern2.b): -121 is dropped from the resulting UFO.
Alternative title: possible kerning data loss when glyph is group-kerned in LTR and RTL mode
As far as I understand, the way glyphsLib folds RTL into LTR kerning is like this:
a. If not, put the glyph's (
leftKerningGroup
,rightKerningGroup
) into the corresponding (public.kern1
,public.kern2
) groupb. If so, put the glyph's (
leftKerningGroup
,rightKerningGroup
) into the corresponding (public.kern2
,public.kern1
) groupThe either-or logic in step two implies that a glyph must be used either in LTR or RTL group kerning, but never in both. Glyph-to-glyph kerning has no such limitation because it obviously works without groups.
This means that neutral glyphs like
period
should, if they are put in a group, kerned only in LTR or in RTL mode, but not both, because currently the LTR kerning will point at the wrong kerning name.Some test cases:
a
againstperiod
.public.kern1.a
: [a
]public.kern1.period_right
: [period
]public.kern2.alef
: [alef-ar
]public.kern2.period_left
: [period
]public.kern1.a
,public.kern2.period_left
) = -10alef
againstperiod
.public.kern1.a
: [a
]public.kern1.alef
: [alef-ar
]public.kern1.period_left
: [period
]public.kern2.period_right
: [period
]public.kern1.a
,public.kern2.period_left
) = -10public.kern1.alef
,public.kern2.period_right
) = -20Note how the presence of RTL kerning flips the side of the
period_right
andperiod_left
group, as well as thealef
group. Also note how the first kerning betweena
andperiod_left
gets voided because there is nopublic.kern2.period_left
anymore.glyphs2ufo
indeed logs a warning saying "Non-existent glyph class public.kern2.period_left found in kerning rules".Do I understand correctly that this is a known limitation of folding RTL into LTR kerning and that group kerning must be strictly separated into LTR and RTL? I.e. if you want to group-kern
period
, you should make aperiod-ar
for RTL and group-kern that instead?The text was updated successfully, but these errors were encountered: