Update build

This commit is contained in:
weiweihuanghuang 2018-11-08 21:36:47 +11:00
parent 54626b4a1a
commit a9138612fa
5 changed files with 34 additions and 125 deletions

View File

@ -1,46 +0,0 @@
### Based on a script by Stephen Nixon
import os
import sys
import fontTools
from fontTools.ttLib import TTFont
from fontTools.varLib.featureVars import addFeatureVariations
from fontTools.ttx import makeOutputFileName
inputTTF = sys.argv[1]
# style = sys.argv[2]
# f = TTFont(fontPath)
f = TTFont(inputTTF)
condSubst = [
# A list of (Region, Substitution) tuples.
([{"wght": (0.158, 0.564)}], {"uniF8FF": "uniF8FF.001"}),
# ([{"wght": (0.868, 1)}], {"uni20B5": "uni20B5.201_230"}),
# ([{"wght": (0.868, 1)}], {"cent": "cent.201_230"}),
# ([{"wght": (0.868, 1)}], {"colonmonetary": "colonmonetary.201_230"}),
# ([{"wght": (0.868, 1)}], {"dollar": "dollar.201_230"}),
# ([{"wght": (0.868, 1)}], {"uni20B2": "uni20B2.201_230"}),
# ([{"wght": (0.868, 1)}], {"dollar.tf": "dollar.tf.201_230"}),
# ([{"wght": (0.868, 1)}], {"cent.tf": "cent.tf.201_230"}),
# ([{"wght": (0.71, 1)}], {"uni20A6": "uni20A6.169_230"}),
# ([{"wght": (0.71, 1)}], {"peseta": "peseta.169_230"}),
# ([{"wght": (0.71, 1)}], {"uni20A9": "uni20A9.169_230"}),
# ([{"wght": (0.564, 1)}], {"uni20B1": "uni20B1.136_230"}),
# ([{"wght": (0.424, 1)}], {"uni2761": "uni2761.79_230"}),
# ([{"wght": (0.424, 1)}], {"paragraph": "paragraph.79_230"}),
]
# if style == "Upright":
# condSubst += [
# ([{"wght": (0.564, 1)}], {"Adieresis.titl": "Adieresis.titl.136_230"}),
# ([{"wght": (0.564, 1)}], {"Odieresis.titl": "Odieresis.titl.136_230"}),
# ]
addFeatureVariations(f, condSubst)
# newFontPath = fontPath.split(".")[0] + "-italic.ttf"
# f.save(fontPath)
extension = os.path.splitext(inputTTF)[1]
outputTTF = makeOutputFileName(inputTTF, '', extension)
f.save(outputTTF)

View File

@ -22,26 +22,24 @@ rm -rf master_ufo
rm -rf instance_ufo rm -rf instance_ufo
rm -rf variable_ttf rm -rf variable_ttf
# Add featureVariation for bracket trick glyphs Add featureVariation for bracket trick glyphs
# python tools/swapBracketTrick.py ${VFname}.ttf "$1" python tools/swapBracketTrick.py ${VFname}.ttf "$1"
# mv ${VFname}-swap.ttf ${VFname}.ttf mv ${VFname}-swap.ttf ${VFname}.ttf
# Fix non-hinting, DSIG and GASP table # Fix non-hinting, DSIG and GASP table
gftools fix-nonhinting ${VFname}.ttf ${VFname}.ttf gftools fix-nonhinting ${VFname}.ttf ${VFname}.ttf
gftools fix-dsig --autofix ${VFname}.ttf
gftools fix-gasp ${VFname}.ttf gftools fix-gasp ${VFname}.ttf
echo "nonhinting, dsig, gasp fixed" echo "nonhinting, dsig, gasp fixed"
# Clean up backup file # Clean up backup file
rm -rf ${VFname}-backup-fonttools-prep-gasp.ttf rm -rf ${VFname}-backup-fonttools-prep-gasp.ttf
# Fix VF Metadata # # Fix VF Metadata
python tools/gftools-fix-vf-meta.py ${VFname}.ttf # python tools/gftools-fix-vf-meta.py ${VFname}.ttf
echo "vf-meta fixed" # echo "vf-meta fixed"
# # Clean up and rename VF
# Clean up and rename VF # rm ${VFname}.ttf
rm ${VFname}.ttf # mv ${VFname}.ttf.fix ${VFname}.ttf
mv ${VFname}.ttf.fix ${VFname}.ttf
# Correct nameID 6 (remove space) # Correct nameID 6 (remove space)
python tools/NAMEpatch.py ${VFname}.ttf python tools/NAMEpatch.py ${VFname}.ttf
@ -49,6 +47,9 @@ rm ${VFname}.ttf
mv ${VFname}#1.ttf ${VFname}.ttf mv ${VFname}#1.ttf ${VFname}.ttf
echo "nameID 6 fixed" echo "nameID 6 fixed"
# Fix DSIG
gftools fix-dsig --autofix ${VFname}.ttf
if [ "$1" = "Italic" ]; then if [ "$1" = "Italic" ]; then
# Rename *-ItalicItalic to -Italic # Rename *-ItalicItalic to -Italic
for i in *.ttf; do for i in *.ttf; do

View File

@ -19,7 +19,8 @@ axis (covers 95% of GF cases).
""" """
from argparse import ArgumentParser from argparse import ArgumentParser
from fontTools.ttLib import TTFont, newTable from fontTools.ttLib import TTFont, newTable
from fontTools.ttLib.tables import otTables from fontTools.ttLib.tables import otTablesos
import os
OS_2_WEIGHT_CLASS = { OS_2_WEIGHT_CLASS = {

View File

@ -1,46 +0,0 @@
### Based on a script by Stephen Nixon
import os
import sys
import fontTools
from fontTools.ttLib import TTFont
from fontTools.varLib.featureVars import addFeatureVariations
from fontTools.ttx import makeOutputFileName
inputTTF = sys.argv[1]
style = sys.argv[2]
# f = TTFont(fontPath)
f = TTFont(inputTTF)
condSubst = [
# A list of (Region, Substitution) tuples.
([{"wght": (0.158, 0.564)}], {"apple": "apple.001"}),
([{"wght": (0.868, 1)}], {"cedi": "cedi.201_230"}),
([{"wght": (0.868, 1)}], {"cent": "cent.201_230"}),
([{"wght": (0.868, 1)}], {"colonsign": "colonsign.201_230"}),
([{"wght": (0.868, 1)}], {"dollar": "dollar.201_230"}),
([{"wght": (0.868, 1)}], {"guarani": "guarani.201_230"}),
([{"wght": (0.868, 1)}], {"dollar.tf": "dollar.tf.201_230"}),
([{"wght": (0.868, 1)}], {"cent.tf": "cent.tf.201_230"}),
([{"wght": (0.71, 1)}], {"naira": "naira.169_230"}),
([{"wght": (0.71, 1)}], {"peseta": "peseta.169_230"}),
([{"wght": (0.71, 1)}], {"won": "won.169_230"}),
([{"wght": (0.564, 1)}], {"peso": "peso.136_230"}),
([{"wght": (0.424, 1)}], {"curvedStemParagraphSignOrnament": "curvedStemParagraphSignOrnament.79_230"}),
([{"wght": (0.424, 1)}], {"paragraph": "paragraph.79_230"}),
]
if style == "Upright":
condSubst += [
([{"wght": (0.564, 1)}], {"Adieresis.titl": "Adieresis.titl.136_230"}),
([{"wght": (0.564, 1)}], {"Odieresis.titl": "Odieresis.titl.136_230"}),
]
addFeatureVariations(f, condSubst)
# newFontPath = fontPath.split(".")[0] + "-italic.ttf"
# f.save(fontPath)
extension = os.path.splitext(inputTTF)[1]
outputTTF = makeOutputFileName(inputTTF, '', extension)
f.save(outputTTF)

View File

@ -6,34 +6,33 @@ import fontTools
from fontTools.ttLib import TTFont from fontTools.ttLib import TTFont
from fontTools.varLib.featureVars import addFeatureVariations from fontTools.varLib.featureVars import addFeatureVariations
inputTTF = sys.argv[-1] inputTTF = sys.argv[1]
print(inputTTF) style = sys.argv[2]
f = TTFont(inputTTF) f = TTFont(inputTTF)
condSubst = [ condSubst = [
# A list of (Region, Substitution) tuples. # A list of (Region, Substitution) tuples.
([{"wght": (0.158, 0.564)}], {"uniF8FF": "uniF8FF.001"}), ([{"wght": (0.158, 0.564)}], {"uniF8FF": "uniF8FF.001"}),
# ([{"wght": (0.868, 1)}], {"uni20B5": "uni20B5.201_230"}), ([{"wght": (0.868, 1)}], {"uni20B5": "uni20B5.201_230"}),
# ([{"wght": (0.868, 1)}], {"cent": "cent.201_230"}), ([{"wght": (0.868, 1)}], {"cent": "cent.201_230"}),
# ([{"wght": (0.868, 1)}], {"colonmonetary": "colonmonetary.201_230"}), ([{"wght": (0.868, 1)}], {"colonmonetary": "colonmonetary.201_230"}),
# ([{"wght": (0.868, 1)}], {"dollar": "dollar.201_230"}), ([{"wght": (0.868, 1)}], {"dollar": "dollar.201_230"}),
# ([{"wght": (0.868, 1)}], {"uni20B2": "uni20B2.201_230"}), ([{"wght": (0.868, 1)}], {"uni20B2": "uni20B2.201_230"}),
# ([{"wght": (0.868, 1)}], {"dollar.tf": "dollar.tf.201_230"}), ([{"wght": (0.868, 1)}], {"dollar.tf": "dollar.tf.201_230"}),
# ([{"wght": (0.868, 1)}], {"cent.tf": "cent.tf.201_230"}), ([{"wght": (0.868, 1)}], {"cent.tf": "cent.tf.201_230"}),
# ([{"wght": (0.71, 1)}], {"uni20A6": "uni20A6.169_230"}), ([{"wght": (0.71, 1)}], {"uni20A6": "uni20A6.169_230"}),
# ([{"wght": (0.71, 1)}], {"peseta": "peseta.169_230"}), ([{"wght": (0.71, 1)}], {"peseta": "peseta.169_230"}),
# ([{"wght": (0.71, 1)}], {"uni20A9": "uni20A9.169_230"}), ([{"wght": (0.71, 1)}], {"uni20A9": "uni20A9.169_230"}),
# ([{"wght": (0.564, 1)}], {"uni20B1": "uni20B1.136_230"}), ([{"wght": (0.564, 1)}], {"uni20B1": "uni20B1.136_230"}),
# ([{"wght": (0.424, 1)}], {"uni2761": "uni2761.79_230"}), ([{"wght": (0.424, 1)}], {"uni2761": "uni2761.79_230"}),
# ([{"wght": (0.424, 1)}], {"paragraph": "paragraph.79_230"}), ([{"wght": (0.424, 1)}], {"paragraph": "paragraph.79_230"}),
] ]
# if style == "Upright": if style == "Upright":
# condSubst += [ condSubst += [
# ([{"wght": (0.564, 1)}], {"Adieresis.titl": "Adieresis.titl.136_230"}), ([{"wght": (0.564, 1)}], {"Adieresis.titl": "Adieresis.titl.136_230"}),
# ([{"wght": (0.564, 1)}], {"Odieresis.titl": "Odieresis.titl.136_230"}), ([{"wght": (0.564, 1)}], {"Odieresis.titl": "Odieresis.titl.136_230"}),
# ] ]
addFeatureVariations(f, condSubst) addFeatureVariations(f, condSubst)