fontFeatures icon indicating copy to clipboard operation
fontFeatures copied to clipboard

ff.buildBinaryFeatures() somehow affects language systems in exported FEA

Open lianghai opened this issue 3 years ago • 0 comments

Build the same ff, apply one of them to a certain font using .buildBinaryFeatures(), then somehow the results of .asFea() aren’t the same anymore. Is this an intended behavior? Can I provide the test font in private?

from fontFeatures import FontFeatures, Routine, Substitution
from fontTools.ttLib import TTFont

language = "taml", "dflt"
font = TTFont("foo.otf")

ff_1 = FontFeatures()
ff_2 = FontFeatures()

ff_1.addFeature(
    "akhn",
    [
        Routine(
            languages=[language],
            rules=[
                Substitution([["kaTaml"]], [["kaTaml"]]),
            ],
        ),
    ],
)
ff_2.addFeature(
    "akhn",
    [
        Routine(
            languages=[language],
            rules=[
                Substitution([["kaTaml"]], [["kaTaml"]]),
            ],
        ),
    ],
)

ff_1.buildBinaryFeatures(font)

fea_1 = ff_1.asFea()
fea_2 = ff_2.asFea()

print(fea_1)

assert fea_1 == fea_2

lianghai avatar Apr 03 '22 19:04 lianghai