Skip to content

Commit

Permalink
name 25
Browse files Browse the repository at this point in the history
  • Loading branch information
juandelperal committed Aug 27, 2020
1 parent ba150ef commit b76d6a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ done
echo
echo Fixing fonts
for VF in fonts/Piazzolla/variable/ttf/*.ttf; do
python tools/fixNameTable.py $VF
python tools/buildStat.py $VF
gftools fix-dsig -f $VF
gftools fix-nonhinting $VF "$VF.fix"
Expand All @@ -62,6 +63,7 @@ done

if $static; then
for ttf in fonts/Piazzolla/static/*.ttf; do
python tools/fixNameTable.py $ttf
gftools fix-dsig -f $ttf
gftools fix-nonhinting $ttf "$ttf.fix"
mv "$ttf.fix" $ttf
Expand All @@ -75,6 +77,7 @@ if $static; then
done

for otf in fonts/Piazzolla/static/*.otf; do
python tools/fixNameTable.py $VF
gftools fix-weightclass $otf
gftools fix-dsig -f $otf
gftools fix-nonhinting $otf "$otf.fix"
Expand Down
9 changes: 7 additions & 2 deletions tools/buildStat.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ def updateFvar(ttFont):
nametable = ttFont['name']
family_name = nametable.getName(16, 3, 1, 1033) or nametable.getName(1, 3, 1, 1033)
family_name = family_name.toUnicode().replace(" ", "")
nametable.setName(family_name, 25, 3, 1, 1033)
font_style = "Italic" if "Italic" in nametable.getName(2, 3, 1, 1033).toUnicode() else "Roman"
ps_family_name = f"{family_name.replace(' ', '')}{font_style}"
nametable.setName(ps_family_name, 25, 3, 1, 1033)

for instance in fvar.instances:
instance_style = nametable.getName(instance.subfamilyNameID, 3, 1, 1033).toUnicode()
ps_name = f"{family_name}-{instance_style.replace(' ', '')}"
instance_style = instance_style.replace("Italic", "").strip().replace(" ", "")
if instance_style == "":
instance_style = "Regular"
ps_name = f"{ps_family_name}-{instance_style}"
instance.postscriptNameID = _addName(nametable, ps_name, 256)


Expand Down

0 comments on commit b76d6a8

Please sign in to comment.