Update build process

- Includes brace copying
This commit is contained in:
weiweihuanghuang 2018-11-09 16:49:25 +11:00
parent 5459550f4e
commit 8347ca1232
7 changed files with 551 additions and 46 deletions

View File

@ -3,10 +3,7 @@
DisplayStrings = (
"/Uhorn/Ohorn/uhorn/ohorn/Ahookabove/ahookabove \012/Acircumflexacute/Acircumflexgrave/Acircumflexhookabove/Acircumflextilde/acircumflexacute/acircumflexgrave/acircumflexhookabove/acircumflextilde \012/circumflexcomb_acutecomb/circumflexcomb_gravecomb/circumflexcomb_hookabovecomb/circumflexcomb_tildecomb \012/Ohornacute/Ohorngrave/Ohornhookabove/Ohorntilde \012/Uhornacute/Uhorngrave/Uhornhookabove/Uhorntilde \012/Abreveacute/Abrevegrave/Abrevehookabove/Abrevetilde \012/Acircumflexacute/Acircumflexgrave/Acircumflexhookabove/Acircumflextilde \012/Etilde/Ecircumflexacute/Ecircumflexgrave/Ecircumflexhookabove/Ecircumflextilde \012/Ocircumflexacute/Ocircumflexgrave/Ocircumflexhookabove/Ocircumflextilde \012/ohornacute/ohorngrave/ohornhookabove/ohorntilde \012/uhornacute/uhorngrave/uhornhookabove/uhorntilde \012/abreveacute/abrevegrave/abrevehookabove/abrevetilde \012/acircumflexacute/acircumflexgrave/acircumflexhookabove/acircumflextilde \012/ecircumflexacute/ecircumflexgrave/ecircumflexhookabove/ecircumflextilde \012/ocircumflexacute/ocircumflexgrave/ocircumflexhookabove/ocircumflextilde \012\012/Abreveacute/Abrevegrave/Abrevehookabove/Abrevetilde/abreveacute/abrevegrave/abrevehookabove/abrevetilde \012/Ohorn/Ohornacute/Ohorngrave/Ohornhookabove/Ohorntilde/ohorn/ohornacute/ohorngrave/ohornhookabove/ohorntilde \012/Uhorn/Uhornacute/Uhorngrave/Uhornhookabove/Uhorntilde/uhorn/uhornacute/uhorngrave/uhornhookabove/uhorntilde \012/Acircumflexacute/Acircumflexgrave/Acircumflexhookabove/Acircumflextilde/acircumflexacute/acircumflexgrave/acircumflexhookabove/acircumflextilde \012/Ecircumflexacute/Ecircumflexgrave/Ecircumflexhookabove/Ecircumflextilde/ecircumflexacute/ecircumflexgrave/ecircumflexhookabove/ecircumflextilde \012/Ocircumflexacute/Ocircumflexgrave/Ocircumflexhookabove/Ocircumflextilde/ocircumflexacute/ocircumflexgrave/ocircumflexhookabove/ocircumflextilde",
"/ldot/lslash //space\012\012\012L\012HUB/Germandbls EL/Lslash ZFPÞT/Tbar YVWARKXOØQGCS\012naqgudlijfrtoecðsßkxvz\0120917426583\012/zero.osf/one.osf/two.osf/four.osf/seven.osf/five.osf/three.osf/nine.osf/six.osf/eight.osf \012/zerosuperior ¹/foursuperior/sevensuperior/ninesuperior ²/sixsuperior/fivesuperior/eightsuperior ³/zeroinferior/oneinferior/fourinferior/seveninferior/nineinferior/twoinferior/sixinferior/fiveinferior/eightinferior/threeinferior/zerosuperior/sevensuperior/zeroinferior/seveninferior \012.,/quotesinglbase/quoteleft/quoteright ':;-/endash *!?¡¿/exclamdown.case/questiondown.case \012///backslash {}[]()/guilsinglleft/guilsinglright \012#/dagger \012\012R\012HUTZAÆYVWXOØSJ\012hlnijpuaoøðßftgsyvwxz\0120617238954\012/zero.osf/one.osf/two.osf/three.osf/nine.osf/five.osf/four.osf/seven.osf/six.osf/eight.osf \012.,/quotesinglbase/quoteleft/quoteright ':-*!?\012///backslash {}[]()/guilsinglleft/guilsinglright \012#/dagger °\012\012.,:;-/endash/guilsinglleft/guilsinglright {}[]()///backslash *!?&@#\012H, /quoteleft H/quoteright /quoteleft H/quoteleft /quoteright H/quoteright /quotesinglbase H/quoteright /quotesinglbase H/quoteleft 'H'\012\012L /leftArrow/rightArrow/northEastArrow/southWestArrow/downArrow/upArrow/southEastArrow/northWestArrow/leftHookArrow/anticlockwiseOpenCircleArrow/clockwiseOpenCircleArrow \012R /leftArrow/rightArrow/northEastArrow/southWestArrow/upArrow/downArrow/southEastArrow/northWestArrow/anticlockwiseOpenCircleArrow/clockwiseOpenCircleArrow \012\012Triple:\012h/hbar blnijpruoødqecðagsßftvywxkz\012HOTYAVWXZ",
"JGCOQSU/OE \012BPRÞGCOQDS/OE \012AÆEFCGJLPRSYVWMKXZ\012AÆKXZYVWMNR (diag)\012sðoceaæ/oe bpdqßgt \012ltfjy (bot top tail)\012kxzyvw (diag)\012",
"Done:\012/apple/apple.001 \012/cedi/cedi.201_230 ¢/cent.201_230/colonsign/colonsign.201_230 $/dollar.201_230/guarani/guarani.201_230/naira/naira.169_230/peseta/peseta.169_230/peso/peso.136_230/won/won.169_230/dollar.tf/dollar.tf.201_230/curvedStemParagraphSignOrnament/curvedStemParagraphSignOrnament.79_230 ¶/paragraph.79_230 ©®/cent.tf/cent.tf.201_230 \012\012Brace:\012æes",
"$/dollar.tf/dollar.201_230/dollar.tf.201_230",
"{"
"Done:\012/apple/apple.001 \012/cedi/cedi.201_230 ¢/cent.201_230/colonsign/colonsign.201_230 $/dollar.201_230/guarani/guarani.201_230/naira/naira.169_230/peseta/peseta.169_230/peso/peso.136_230/won/won.169_230/dollar.tf/dollar.tf.201_230/curvedStemParagraphSignOrnament/curvedStemParagraphSignOrnament.79_230 ¶/paragraph.79_230 ©®/cent.tf/cent.tf.201_230 \012\012Brace:\012æes"
);
classes = (
{
@ -70,6 +67,10 @@ value = 1;
{
name = "Use Line Breaks";
value = 1;
},
{
name = "Variable Font Origin";
value = "DBFAC7D3-9CB2-48DD-9F53-AD59A4BD1301";
}
);
date = "2018-11-06 02:08:55 +0000";
@ -115487,6 +115488,10 @@ customParameters = (
{
name = weightClass;
value = 250;
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115505,6 +115510,10 @@ customParameters = (
{
name = weightClass;
value = 275;
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115526,6 +115535,10 @@ name = "Rename Glyphs";
value = (
"apple.001=apple"
);
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115547,6 +115560,10 @@ name = "Rename Glyphs";
value = (
"apple.001=apple"
);
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115567,6 +115584,10 @@ value = (
"curvedStemParagraphSignOrnament.79_230=curvedStemParagraphSignOrnament",
"paragraph.79_230=paragraph"
);
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115590,6 +115611,10 @@ value = (
"curvedStemParagraphSignOrnament.79_230=curvedStemParagraphSignOrnament",
"paragraph.79_230=paragraph"
);
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115616,6 +115641,10 @@ value = (
"curvedStemParagraphSignOrnament.79_230=curvedStemParagraphSignOrnament",
"paragraph.79_230=paragraph"
);
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115649,6 +115678,10 @@ value = (
"curvedStemParagraphSignOrnament.79_230=curvedStemParagraphSignOrnament",
"paragraph.79_230=paragraph"
);
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115682,6 +115715,10 @@ value = (
"curvedStemParagraphSignOrnament.79_230=curvedStemParagraphSignOrnament",
"paragraph.79_230=paragraph"
);
},
{
name = "Save as TrueType";
value = 1;
}
);
interpolationCustom = -1;
@ -115733,10 +115770,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -115788,10 +115821,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -115846,10 +115875,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -115904,10 +115929,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -115961,10 +115982,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -116021,10 +116038,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -116084,10 +116097,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -116154,10 +116163,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;
@ -116224,10 +116229,6 @@ value = -343;
{
name = hheaAscender;
value = 1105;
},
{
name = Autohint;
value = 1;
}
);
interpolationCustom = -1;

View File

@ -88,6 +88,10 @@ value = 1;
{
name = "Use Line Breaks";
value = 1;
},
{
name = "Variable Font Origin";
value = "4A17B37A-CBFD-40E5-9E02-2080A0E1F76C";
}
);
date = "2018-11-06 02:08:55 +0000";

View File

@ -22,9 +22,9 @@ rm -rf master_ufo
rm -rf instance_ufo
rm -rf variable_ttf
# Add featureVariation for bracket trick glyphs
python tools/swapBracketTrick.py ${VFname}.ttf "$1"
mv ${VFname}-swap.ttf ${VFname}.ttf
# # Add featureVariation for bracket trick glyphs
# python tools/swapBracketTrick.py ${VFname}.ttf "$1"
# mv ${VFname}-swap.ttf ${VFname}.ttf
# Fix non-hinting, DSIG and GASP table
gftools fix-nonhinting ${VFname}.ttf ${VFname}.ttf

89
sources/buildTest.sh Normal file
View File

@ -0,0 +1,89 @@
### WIP macOS build script for Work Sans Upright and Italic VF, based on a build script by Mike LaGuttuta
# To add brace trick glyphs, define them in $BraceGlyphs variable, and save the source VF in the same folder as the script
# Setting the Source and VF name, determine if it's for Italic or Upright source from the argument passed to this script
glyphsSource="WorkSans.glyphs"
VFname="WorkSans-VF"
GXname="WorkSansGX"
if [ "$1" == "Upright" ]; then
# Setting which brace glyphs will get copied from the VF generated from glyphs app
BraceGlyphs="Odieresis.titl,Udieresis.titl,a,ae,e,s"
elif [ "$1" == "Italic" ]; then
BraceGlyphs="ae,e,s"
# Italic
glyphsSource=${glyphsSource/".glyphs"/"-Italic.glyphs"}
VFname=${VFname/"-VF"/"-Italic-VF"}
GXname=${GXname/"GX"/"ItalicGX"}
fi
# Call fontmake to generate variable font
fontmake -o variable -g $glyphsSource
echo "${VFname}.ttf generated"
# Clean up folders
mv variable_ttf/${VFname}.ttf ${VFname}.ttf
rm -rf master_ufo
rm -rf instance_ufo
rm -rf variable_ttf
ttx ${VFname}.ttf
rm ${VFname}.ttf
ttx ${GXname}.ttf
mv ${GXname}.ttx tools/${GXname}.ttx
# 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
xml tr tools/replaceBraceGlyphs.xsl \
-s replacements=${GXname}.ttx \
-s replacenames=$BraceGlyphs \
${VFname}.ttx > ${VFname}-brace.ttx
# Clean up folders
rm tools/${GXname}.ttx
rm ${VFname}.ttx
ttx ${VFname}-brace.ttx
rm ${VFname}-brace.ttx
mv ${VFname}-brace.ttf ${VFname}.ttf
# Add featureVariation for bracket trick glyphs
python tools/swapBracketTrick.py ${VFname}.ttf "$1"
mv ${VFname}-swap.ttf ${VFname}.ttf
# Fix non-hinting, DSIG and GASP table
gftools fix-nonhinting ${VFname}.ttf ${VFname}.ttf
gftools fix-gasp ${VFname}.ttf
echo "nonhinting, dsig, gasp fixed"
# Clean up backup file
rm ${VFname}-backup-fonttools-prep-gasp.ttf
# # Fix VF Metadata
# python tools/gftools-fix-vf-meta.py ${VFname}.ttf
# echo "vf-meta fixed"
# # Clean up and rename VF
# rm ${VFname}.ttf
# mv ${VFname}.ttf.fix ${VFname}.ttf
# # Correct nameID 6 (remove space)
# python tools/NAMEpatch.py ${VFname}.ttf
# rm ${VFname}.ttf
# mv ${VFname}#1.ttf ${VFname}.ttf
# echo "nameID 6 fixed"
# Fix DSIG
gftools fix-dsig --autofix ${VFname}.ttf
# if [ "$1" = "Italic" ]; then
# # Rename *-ItalicItalic to -Italic
# for i in *.ttf; do
# mv "$i" "${i//ItalicItalic/Italic}"
# done
# fi
# fontbakery check-googlefonts ${VFname}.ttf --ghmarkdown fontbakery-report.md
## move font into folder of dist/, with timestamp, then fontbake the font
# python3 tools/distdate-and-fontbake.py ${VFname}.ttf

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@ axis (covers 95% of GF cases).
"""
from argparse import ArgumentParser
from fontTools.ttLib import TTFont, newTable
from fontTools.ttLib.tables import otTablesos
from fontTools.ttLib.tables import otTables
import os
@ -121,7 +121,7 @@ def fix_nametable(ttfont):
fullname = '{} {}'.format(family_name, default_style)
table.setName(unicode(fullname), 4, 3, 1, 1033)
psname = '{}-{}'.format(family_name, default_style.replace(' ', ''))
psname = '{}-{}'.format(family_name.replace(' ', ''), default_style.replace(' ', ''))
table.setName(unicode(psname), 6, 3, 1, 1033)
# uniqueid basedon fontmake output version;vendorid;psname
@ -151,7 +151,7 @@ def create_stat_table(ttfont):
this, we'll create a STAT using the font's fvar table."""
stat = newTable('STAT')
stat.table = otTables.STAT()
stat.table.Version = 0x00010002
stat.table.Version = 0x00010001
# # Build DesignAxisRecords from fvar
stat.table.DesignAxisRecord = otTables.AxisRecordArray()

View File

@ -0,0 +1,47 @@
# Make a .glyphs file with only brace glyphs to export
import sys
import re
from glyphsLib import GSFont
from glyphsLib import GSGlyph
from glyphsLib import GSLayer
file = sys.argv[1]
print file
font = GSFont()
# font = GSFont(file)
# Clear all features
font.features = []
font.classes = []
font.featurePrefixes = []
# Find brace glyphs
listOfBraceGlyphs = []
for eachGlyph in font.glyphs:
for eachLayer in eachGlyph.layers:
if re.match('.*\d\}$', eachLayer.name):
listOfBraceGlyphs += [eachGlyph.name]
print "brace glyphs: ", listOfBraceGlyphs
listOfBraceGlyphs += ["space", ".notdef"]
# Append Italic to font family naame if Italics
style = sys.argv[2]
if style == "Italic":
font.familyName = "%s %s" % (font.familyName, style)
listOfGlyphsNotToExport = [g.name for g in font.glyphs if g not in listOfBraceGlyphs]
for eachGlyph in listOfGlyphsNotToExport:
font.glyphs[eachGlyph].export = 0
# for eachGlyph in listOfBraceGlyphs:
# try:
# font.glyphs[eachGlyph].export = 1
# except:
# pass
newFileName = file.replace(".glyphs", "-onlyBraceGlyphs.glyphs")
font.save(newFileName)