mirror of
https://github.com/weiweihuanghuang/Work-Sans.git
synced 2024-11-26 09:20:15 +03:00
Fixed Build process for bracket trick
This commit is contained in:
parent
b00a65215f
commit
32e70e1270
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -21,12 +21,12 @@ elif [ "$1" == "Italic" ]; then
|
|||||||
GXname=${GXname/"GX"/"ItalicGX"}
|
GXname=${GXname/"GX"/"ItalicGX"}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python tools/makeGlyphsFileWithExportingBracketGlyphs.py "${glyphsSource}" "$1"
|
python tools/makeBuildGlyphsFile.py "${glyphsSource}" "$1"
|
||||||
glyphsBuildSource=${glyphsSource/".glyphs"/"-build.glyphs"}
|
glyphsBuildSource=${glyphsSource/".glyphs"/"-build.glyphs"}
|
||||||
|
|
||||||
# Call fontmake to generate variable font
|
# Call fontmake to generate variable font
|
||||||
fontmake -o variable -g $glyphsBuildSource
|
fontmake -o variable -g $glyphsBuildSource
|
||||||
echo "${VFname}.ttf generated"
|
echo "\t${VFname}.ttf generated"
|
||||||
|
|
||||||
# Clean up files
|
# Clean up files
|
||||||
mv variable_ttf/${VFname}.ttf ${VFname}.ttf
|
mv variable_ttf/${VFname}.ttf ${VFname}.ttf
|
||||||
@ -42,11 +42,11 @@ mv ${GXname}.ttx tools/${GXname}.ttx
|
|||||||
|
|
||||||
# Copy brace glyphs from variable font generated from Glyphs App
|
# Copy brace glyphs from variable font generated from Glyphs App
|
||||||
# Run script to find and copy TTGlyph and glyphVariations elements from source file and copy into target file
|
# Run script to find and copy TTGlyph and glyphVariations elements from source file and copy into target file
|
||||||
|
echo "\tAdding brace glyphs..."
|
||||||
xml tr tools/replaceBraceGlyphs.xsl \
|
xml tr tools/replaceBraceGlyphs.xsl \
|
||||||
-s replacements=${GXname}.ttx \
|
-s replacements=${GXname}.ttx \
|
||||||
-s replacenames=$BraceGlyphs \
|
-s replacenames=$BraceGlyphs \
|
||||||
${VFname}.ttx > ${VFname}-brace.ttx
|
${VFname}.ttx > ${VFname}-brace.ttx
|
||||||
echo "Brace glyphs added"
|
|
||||||
|
|
||||||
# Clean up files
|
# Clean up files
|
||||||
rm tools/${GXname}.ttx
|
rm tools/${GXname}.ttx
|
||||||
@ -56,9 +56,9 @@ rm ${VFname}-brace.ttx
|
|||||||
mv ${VFname}-brace.ttf ${VFname}.ttf
|
mv ${VFname}-brace.ttf ${VFname}.ttf
|
||||||
|
|
||||||
# Add featureVariation for bracket trick glyphs
|
# Add featureVariation for bracket trick glyphs
|
||||||
|
echo "\tAdding bracket glyphs..."
|
||||||
python tools/replaceBracketTrick.py ${VFname}.ttf "$1"
|
python tools/replaceBracketTrick.py ${VFname}.ttf "$1"
|
||||||
mv ${VFname}-swap.ttf ${VFname}.ttf
|
mv ${VFname}-swap.ttf ${VFname}.ttf
|
||||||
echo "Bracket glyphs added"
|
|
||||||
|
|
||||||
# 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
|
||||||
|
85
sources/tools/makeBuildGlyphsFile.py
Normal file
85
sources/tools/makeBuildGlyphsFile.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# Create build glyphs file :
|
||||||
|
# Turn on Export for Bracket Glyphs (given as argument from shell) and disable non ttf instances
|
||||||
|
# Add extra opentype code for rvrn glyphs that are substituted by another feature as well
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from glyphsLib import GSFont
|
||||||
|
from glyphsLib import GSGlyph
|
||||||
|
|
||||||
|
file = sys.argv[1]
|
||||||
|
|
||||||
|
font = GSFont(file)
|
||||||
|
print "\tPreparing %s" % file
|
||||||
|
|
||||||
|
# Glyphs to re-enable export, in the Glyphs App export these are not active but get swapped with a custom parameter
|
||||||
|
italicBracketGlyphs = [
|
||||||
|
"cedi.201_230",
|
||||||
|
"colonsign.136_230",
|
||||||
|
"guarani.201_230",
|
||||||
|
"cent.201_230",
|
||||||
|
"dollar.201_230",
|
||||||
|
"dollar.tf.201_230",
|
||||||
|
"cent.tf.201_230",
|
||||||
|
"naira.169_230",
|
||||||
|
"peseta.169_230",
|
||||||
|
"won.169_230",
|
||||||
|
"peso.136_230",
|
||||||
|
"curvedStemParagraphSignOrnament.79_230",
|
||||||
|
"paragraph.79_230"
|
||||||
|
]
|
||||||
|
|
||||||
|
uprightBracketGlyphs = italicBracketGlyphs + [
|
||||||
|
"apple.001",
|
||||||
|
"Adieresis.136_230",
|
||||||
|
"Odieresis.106_230",
|
||||||
|
"Udieresis.136_230",
|
||||||
|
"Adieresis.titl.136_230",
|
||||||
|
"Odieresis.titl.106_230",
|
||||||
|
"Udieresis.titl.136_230",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Extra FEA code so that the glyphs swapped by rvrn can be substituted again by another opentype feature
|
||||||
|
# https://github.com/fonttools/fonttools/issues/1371#issuecomment-437613378
|
||||||
|
uprightFeaCode = [
|
||||||
|
("tnum", """sub cent.201_230 by cent.tf.201_230; # for rvrn
|
||||||
|
sub dollar.201_230 by dollar.tf.201_230; # for rvrn"""),
|
||||||
|
("titl", """# for rvrn
|
||||||
|
sub Adieresis.136_230 by Adieresis.titl.136_230;
|
||||||
|
sub Odieresis.106_230 by Odieresis.titl.106_230;
|
||||||
|
sub Udieresis.136_230 by Udieresis.titl.136_230;""")
|
||||||
|
]
|
||||||
|
|
||||||
|
italicFeaCode = [
|
||||||
|
("tnum", """sub cent.201_230 by cent.tf.201_230; # for rvrn
|
||||||
|
sub dollar.201_230 by dollar.tf.201_230; # for rvrn""")
|
||||||
|
]
|
||||||
|
|
||||||
|
for instance in font.instances:
|
||||||
|
deavtivateThisInstance = True
|
||||||
|
for customParam in instance.customParameters:
|
||||||
|
if customParam.name == "Save as TrueType" and customParam.value == 1:
|
||||||
|
deavtivateThisInstance = False
|
||||||
|
if deavtivateThisInstance == True:
|
||||||
|
instance.active = 0
|
||||||
|
|
||||||
|
style = sys.argv[2]
|
||||||
|
if style == "Italic":
|
||||||
|
glyphsToActivateExport = italicBracketGlyphs
|
||||||
|
appendFeatureCode = italicFeaCode
|
||||||
|
elif style == "Upright":
|
||||||
|
glyphsToActivateExport = uprightBracketGlyphs
|
||||||
|
appendFeatureCode = uprightFeaCode
|
||||||
|
|
||||||
|
for eachGlyph in glyphsToActivateExport:
|
||||||
|
font.glyphs[eachGlyph].export = 1
|
||||||
|
|
||||||
|
for feaCode in appendFeatureCode:
|
||||||
|
for f in font.features:
|
||||||
|
if f.name == feaCode[0]:
|
||||||
|
f.code += "\n" + feaCode[1]
|
||||||
|
f.automatic = False
|
||||||
|
# print f.code
|
||||||
|
|
||||||
|
newFileName = file.replace(".glyphs", "-build.glyphs")
|
||||||
|
|
||||||
|
font.save(newFileName)
|
@ -1,52 +0,0 @@
|
|||||||
# Turn on Export for Bracket Glyphs (given as argument from shell) and disable non ttf instances
|
|
||||||
import sys
|
|
||||||
from glyphsLib import GSFont
|
|
||||||
from glyphsLib import GSGlyph
|
|
||||||
|
|
||||||
file = sys.argv[1]
|
|
||||||
font = GSFont(file)
|
|
||||||
print "Preparing %s" % file
|
|
||||||
|
|
||||||
italicBracketGlyphs = [
|
|
||||||
"apple.001",
|
|
||||||
"cedi.201_230",
|
|
||||||
"cent.201_230",
|
|
||||||
"colonsign.201_230",
|
|
||||||
"dollar.201_230",
|
|
||||||
"guarani.201_230",
|
|
||||||
"dollar.tf.201_230",
|
|
||||||
"cent.tf.201_230",
|
|
||||||
"naira.169_230",
|
|
||||||
"peseta.169_230",
|
|
||||||
"won.169_230",
|
|
||||||
"peso.136_230",
|
|
||||||
"curvedStemParagraphSignOrnament.79_230",
|
|
||||||
"paragraph.79_230"
|
|
||||||
]
|
|
||||||
|
|
||||||
uprightBracketGlyphs = italicBracketGlyphs + [
|
|
||||||
"Adieresis.titl.136_230",
|
|
||||||
"Odieresis.titl.106_230",
|
|
||||||
"Udieresis.titl.136_230",
|
|
||||||
]
|
|
||||||
|
|
||||||
for instance in font.instances:
|
|
||||||
deavtivateThisInstance = True
|
|
||||||
for customParam in instance.customParameters:
|
|
||||||
if customParam.name == "Save as TrueType" and customParam.value == 1:
|
|
||||||
deavtivateThisInstance = False
|
|
||||||
if deavtivateThisInstance == True:
|
|
||||||
instance.active = 0
|
|
||||||
|
|
||||||
style = sys.argv[2]
|
|
||||||
if style == "Italic":
|
|
||||||
glyphsToActivateExport = italicBracketGlyphs
|
|
||||||
elif style == "Upright":
|
|
||||||
glyphsToActivateExport = uprightBracketGlyphs
|
|
||||||
|
|
||||||
for eachGlyph in glyphsToActivateExport:
|
|
||||||
font.glyphs[eachGlyph].export = 1
|
|
||||||
|
|
||||||
newFileName = file.replace(".glyphs", "-build.glyphs")
|
|
||||||
|
|
||||||
font.save(newFileName)
|
|
@ -7,7 +7,7 @@ from glyphsLib import GSLayer
|
|||||||
|
|
||||||
file = sys.argv[1]
|
file = sys.argv[1]
|
||||||
font = GSFont(file)
|
font = GSFont(file)
|
||||||
print "Preparing %s" % file
|
print "\tPreparing %s" % file
|
||||||
|
|
||||||
# Append Italic to font family naame if Italics
|
# Append Italic to font family naame if Italics
|
||||||
style = sys.argv[2]
|
style = sys.argv[2]
|
||||||
@ -32,7 +32,7 @@ for eachGlyph in font.glyphs:
|
|||||||
if re.match('.*\d\}$', eachLayer.name):
|
if re.match('.*\d\}$', eachLayer.name):
|
||||||
listOfBraceGlyphs += [eachGlyph.name]
|
listOfBraceGlyphs += [eachGlyph.name]
|
||||||
|
|
||||||
print "Brace glyphs found: ", listOfBraceGlyphs
|
print "\tBrace glyphs found: ", listOfBraceGlyphs
|
||||||
listOfBraceGlyphs += ["space", ".notdef"]
|
listOfBraceGlyphs += ["space", ".notdef"]
|
||||||
|
|
||||||
listOfGlyphsNotToExport = [g.name for g in font.glyphs if g.name not in listOfBraceGlyphs]
|
listOfGlyphsNotToExport = [g.name for g in font.glyphs if g.name not in listOfBraceGlyphs]
|
||||||
|
@ -16,7 +16,6 @@ if style == "Upright":
|
|||||||
([{"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",
|
||||||
"cent": "cent.201_230",
|
"cent": "cent.201_230",
|
||||||
"colonmonetary": "colonmonetary.201_230",
|
|
||||||
"dollar": "dollar.201_230",
|
"dollar": "dollar.201_230",
|
||||||
"uni20B2": "uni20B2.201_230",
|
"uni20B2": "uni20B2.201_230",
|
||||||
"dollar.tf": "dollar.tf.201_230",
|
"dollar.tf": "dollar.tf.201_230",
|
||||||
@ -25,16 +24,19 @@ if style == "Upright":
|
|||||||
"peseta": "peseta.169_230",
|
"peseta": "peseta.169_230",
|
||||||
"uni20A9": "uni20A9.169_230"}),
|
"uni20A9": "uni20A9.169_230"}),
|
||||||
([{"wght": (0.564, 1)}], {"uni20B1": "uni20B1.136_230",
|
([{"wght": (0.564, 1)}], {"uni20B1": "uni20B1.136_230",
|
||||||
|
"Adieresis": "Adieresis.136_230",
|
||||||
|
"Udieresis": "Udieresis.136_230",
|
||||||
"Adieresis.titl": "Adieresis.titl.136_230",
|
"Adieresis.titl": "Adieresis.titl.136_230",
|
||||||
"Udieresis.titl": "Udieresis.titl.136_230"}),
|
"Udieresis.titl": "Udieresis.titl.136_230",
|
||||||
|
"colonmonetary": "colonmonetary.136_230"}),
|
||||||
([{"wght": (0.424, 1)}], {"uni2761": "uni2761.79_230",
|
([{"wght": (0.424, 1)}], {"uni2761": "uni2761.79_230",
|
||||||
"paragraph": "paragraph.79_230",
|
"paragraph": "paragraph.79_230",
|
||||||
"Odieresis.titl": "Odieresis.titl.106_230"}),
|
"Odieresis.titl": "Odieresis.titl.106_230",
|
||||||
|
"Odieresis": "Odieresis.106_230"}),
|
||||||
]
|
]
|
||||||
elif style == "Italic":
|
elif style == "Italic":
|
||||||
condSubst = [
|
condSubst = [
|
||||||
# A list of (Region, Substitution) tuples.
|
# 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)}], {"uni20B5": "uni20B5.201_230",
|
||||||
"cent": "cent.201_230",
|
"cent": "cent.201_230",
|
||||||
"colonmonetary": "colonmonetary.201_230",
|
"colonmonetary": "colonmonetary.201_230",
|
||||||
@ -45,7 +47,8 @@ elif style == "Italic":
|
|||||||
([{"wght": (0.71, 1)}], {"uni20A6": "uni20A6.169_230",
|
([{"wght": (0.71, 1)}], {"uni20A6": "uni20A6.169_230",
|
||||||
"peseta": "peseta.169_230",
|
"peseta": "peseta.169_230",
|
||||||
"uni20A9": "uni20A9.169_230"}),
|
"uni20A9": "uni20A9.169_230"}),
|
||||||
([{"wght": (0.564, 1)}], {"uni20B1": "uni20B1.136_230"}),
|
([{"wght": (0.564, 1)}], {"uni20B1": "uni20B1.136_230",
|
||||||
|
"colonmonetary": "colonmonetary.136_230"}),
|
||||||
([{"wght": (0.424, 1)}], {"uni2761": "uni2761.79_230",
|
([{"wght": (0.424, 1)}], {"uni2761": "uni2761.79_230",
|
||||||
"paragraph": "paragraph.79_230"}),
|
"paragraph": "paragraph.79_230"}),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user