Skip to content

[varLib instancer] should set up italic style linking as an option #2613

@RosaWagner

Description

@RosaWagner

When slicing a VF with ital or slant axis, varLib instancer could set up proper italic style bits + italic angle + caret slope if italic != 0 and if slant != 0. For example with and additional argument like --is-italic followed by an integer for italic angle.

For example when running:
fonttools varLib.instancer "../fonts/variable/Nunito[ital,wght].ttf" ital=1 wght=200:1000 -o "../fonts/variable/Nunito-Italic[wght].ttf"

Then we have to patch this kind of metadata:

for font_path in glob.glob("../fonts/variable/*Italic*.ttf"):
        with open(font_path, "rb") as f:
            print("Fix italic style linking in {}".format(font_path))
            ttFont = TTFont(f)
            ttFont["head"].macStyle = MacStyle.ITALIC
            ttFont["post"].italicAngle = -9
            ttFont["hhea"].caretSlopeRise = 1000
            ttFont["hhea"].caretSlopeRun = 158
            ttFont.save(font_path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions