Skip to content

Commit

Permalink
Merge pull request #670 from m4rc1e/test-builder
Browse files Browse the repository at this point in the history
add builder checks
  • Loading branch information
m4rc1e authored Apr 5, 2023
2 parents ed2979d + 97832e3 commit 59781a1
Show file tree
Hide file tree
Showing 20 changed files with 703 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Lib/gftools/builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,6 @@ def gen_stat_stylespace(self, stylespaceFile, varfonts):
def build_static(self):
if self.config["buildOTF"]:
self.build_a_static_format("otf", self.config["otDir"], self.post_process)
if self.config["buildWebfont"]:
self.mkdir(self.config["woffDir"], clean=True)
if self.config["buildTTF"]:
if "instances" in self.config:
self.instantiate_static_fonts(
Expand Down Expand Up @@ -593,11 +591,19 @@ def build_vtt(self, font_dir):
font.save(font.reader.file.name)

def move_webfont(self, filename):
wf_filename = filename.replace(".ttf", ".woff2")
os.rename(
wf_filename,
wf_filename.replace(self.config["ttDir"], self.config["woffDir"]),
)
woff_dir = self.config["woffDir"]
ttf_dir = self.config["ttDir"]
var_dir = self.config["vfDir"]

if not os.path.exists(self.config["woffDir"]):
self.mkdir(self.config["woffDir"])

src = filename.replace(".ttf", ".woff2")
dst = src
for p in (woff_dir, ttf_dir, var_dir):
dst = dst.replace(p, woff_dir)

shutil.move(src, dst)


def main(args=None):
Expand Down
174 changes: 174 additions & 0 deletions data/test/builder/basic_family_glyphs_0/TestFamily.glyphs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
.appVersion = "3108";
.formatVersion = 3;
axes = (
{
name = Weight;
tag = wght;
}
);
customParameters = (
{
name = "Axis Mappings";
value = {
};
}
);
date = "2023-03-23 13:10:20 +0000";
familyName = "Test Family";
fontMaster = (
{
axesValues = (
100
);
id = m01;
metricValues = (
{
over = 16;
pos = 800;
},
{
over = -16;
},
{
over = -16;
pos = -200;
},
{
},
{
}
);
name = Thin;
},
{
axesValues = (
900
);
id = "9DF3CCAA-57F5-4938-AE55-ABF45B80491E";
metricValues = (
{
pos = 800;
},
{
},
{
pos = -200;
},
{
pos = 700;
},
{
pos = 500;
}
);
name = Black;
}
);
glyphs = (
{
glyphname = A;
lastChange = "2023-03-23 13:12:50 +0000";
layers = (
{
layerId = m01;
shapes = (
{
closed = 1;
nodes = (
(50,0,l),
(618,0,l),
(618,667,l),
(50,667,l)
);
}
);
width = 668;
},
{
layerId = "9DF3CCAA-57F5-4938-AE55-ABF45B80491E";
shapes = (
{
closed = 1;
nodes = (
(50,0,l),
(618,0,l),
(618,667,l),
(50,667,l)
);
}
);
width = 668;
}
);
unicode = 65;
},
{
glyphname = space;
lastChange = "2023-03-23 13:10:46 +0000";
layers = (
{
layerId = m01;
width = 200;
},
{
layerId = "9DF3CCAA-57F5-4938-AE55-ABF45B80491E";
width = 600;
}
);
unicode = 32;
}
);
instances = (
{
axesValues = (
100
);
instanceInterpolations = {
m01 = 1;
};
name = Thin;
weightClass = 100;
},
{
axesValues = (
400
);
instanceInterpolations = {
"9DF3CCAA-57F5-4938-AE55-ABF45B80491E" = 0.375;
m01 = 0.625;
};
name = Regular;
},
{
axesValues = (
900
);
instanceInterpolations = {
"9DF3CCAA-57F5-4938-AE55-ABF45B80491E" = 1;
};
name = Black;
weightClass = 900;
}
);
metrics = (
{
type = ascender;
},
{
type = baseline;
},
{
type = descender;
},
{
type = "cap height";
},
{
type = "x-height";
}
);
unitsPerEm = 1000;
versionMajor = 1;
versionMinor = 0;
}
4 changes: 4 additions & 0 deletions data/test/builder/basic_family_glyphs_0/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
- TestFamily.glyphs
familyName: Test Family
autohintTTF: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ascender</key>
<integer>800</integer>
<key>capHeight</key>
<integer>700</integer>
<key>descender</key>
<integer>-200</integer>
<key>familyName</key>
<string>Test Family</string>
<key>italicAngle</key>
<integer>0</integer>
<key>openTypeHeadCreated</key>
<string>2023/03/23 13:10:20</string>
<key>openTypeOS2Type</key>
<array>
<integer>3</integer>
</array>
<key>postscriptUnderlinePosition</key>
<integer>-100</integer>
<key>postscriptUnderlineThickness</key>
<integer>50</integer>
<key>styleMapFamilyName</key>
<string>Test Family Black</string>
<key>styleMapStyleName</key>
<string>regular</string>
<key>styleName</key>
<string>Black</string>
<key>unitsPerEm</key>
<integer>1000</integer>
<key>versionMajor</key>
<integer>1</integer>
<key>versionMinor</key>
<integer>0</integer>
<key>xHeight</key>
<integer>500</integer>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="A" format="2">
<advance width="668"/>
<unicode hex="0041"/>
<outline>
<contour>
<point x="50" y="667" type="line"/>
<point x="50" y="0" type="line"/>
<point x="618" y="0" type="line"/>
<point x="618" y="667" type="line"/>
</contour>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>A</key>
<string>A_.glif</string>
<key>space</key>
<string>space.glif</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="space" format="2">
<advance width="600"/>
<unicode hex="0020"/>
<outline>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<string>public.default</string>
<string>glyphs</string>
</array>
</array>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.github.googlei18n.ufo2ft.filters</key>
<array>
<dict>
<key>name</key>
<string>eraseOpenCorners</string>
<key>namespace</key>
<string>glyphsLib.filters</string>
<key>pre</key>
<true/>
</dict>
</array>
<key>com.schriftgestaltung.customParameter.GSFont.Axis Mappings</key>
<dict/>
<key>com.schriftgestaltung.customParameter.GSFont.disablesAutomaticAlignment</key>
<false/>
<key>com.schriftgestaltung.customParameter.GSFont.useNiceNames</key>
<integer>1</integer>
<key>com.schriftgestaltung.customParameter.GSFontMaster.customValue</key>
<integer>0</integer>
<key>com.schriftgestaltung.customParameter.GSFontMaster.customValue1</key>
<integer>0</integer>
<key>com.schriftgestaltung.customParameter.GSFontMaster.customValue2</key>
<integer>0</integer>
<key>com.schriftgestaltung.customParameter.GSFontMaster.customValue3</key>
<integer>0</integer>
<key>com.schriftgestaltung.customParameter.GSFontMaster.iconName</key>
<string></string>
<key>com.schriftgestaltung.customParameter.GSFontMaster.weightValue</key>
<integer>900</integer>
<key>com.schriftgestaltung.customParameter.GSFontMaster.widthValue</key>
<integer>100</integer>
<key>com.schriftgestaltung.fontMasterOrder</key>
<integer>1</integer>
<key>com.schriftgestaltung.weightValue</key>
<integer>900</integer>
<key>com.schriftgestaltung.widthValue</key>
<integer>100</integer>
<key>public.glyphOrder</key>
<array>
<string>A</string>
<string>space</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>creator</key>
<string>com.github.fonttools.ufoLib</string>
<key>formatVersion</key>
<integer>3</integer>
</dict>
</plist>
Loading

0 comments on commit 59781a1

Please sign in to comment.