feaLab
![]()
Two small tools for people who wrestle with OpenType Layout features and the AFDKO .fea language.
hb_rendershapes and draws text the way HarfBuzz does, from Python. Ask it what glyphs a font produces for a word, or render that word to SVG, PNG or PDF — the same engine your browser and OS use.hb_scripts3fixes thelanguagesystemblock of a.feafile. Point it at a font and it lists every script the font actually covers, translated from Unicode’s names to OpenType’s, de-duplicated and sorted.
Install
brew install harfbuzz # macOS; provides hb-shape / hb-view
pip install feaLab
Script-tag conversion also needs the harfpy bindings:
pip install "feaLab[scripts]"
Shape text
from feaLab.hb_render import HarfBuzzRenderer
hb = HarfBuzzRenderer()
hb.openFont("EBGaramond12-Regular.otf")
hb.features = ["+dlig"]
hb.toPNG(text="Office staff", font_size=72, output_file="office.png")
Fix a languagesystem block
from fontTools.ttLib import TTFont
from feaLab.hb_scripts3 import updateLanguageSystemsInFea
print(updateLanguageSystemsInFea(feaText=open("features.fea").read(),
ftFont=TTFont("MyFont.ttf")))