Skip to content

Commit e14f9bd

Browse files
committed
Update requirements
1 parent 7ff18ee commit e14f9bd

File tree

5 files changed

+89
-18
lines changed

5 files changed

+89
-18
lines changed

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ ${DFONT}: ${FONT}
7070

7171
${TESTDIR}/%.json: ${TESTDIR}/%.yaml ${FONT}
7272
$(info   GEN $(@F))
73-
${PYTHON} ${SCRIPTDIR}/update-shaping-tests.py $< $@ ${FONT}
73+
${PYTHON} -m alifTools.shaping.update $< $@ ${FONT}
7474

7575
${TESTDIR}/shaping.html: ${FONT} ${TESTDIR}/shaping-config.yml
7676
$(info   SHAPE $(<F))
77-
${PYTHON} ${SCRIPTDIR}/check-shaping.py $< ${TESTDIR}/shaping-config.yml $@
77+
${PYTHON} -m alifTools.shaping.check $< ${TESTDIR}/shaping-config.yml $@
7878

7979
${SVG}: ${FONT}
8080
$(info   SVG $(@F))
81-
${PYTHON} ${SCRIPTDIR}/make-sample.py -t "${SAMPLE}" -o $@ $<
81+
${PYTHON} -m alifTools.sample -t "${SAMPLE}" -o $@ $<
8282

8383
dist: ${DFONT} ${SVG}
8484
$(info   DIST ${DIST}.zip)

Diff for: requirements.in

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
ufo2ft >= 2.30.0
2-
blackrenderer
32
fontmake
4-
fonttools
53
axisregistry
6-
vharfbuzz
7-
pyyaml
4+
alifTools[shaping,sample] @ git+https://github.com/aliftype/tools.git@2907f32967d5db55d164c98b07fa0e4d9652a794

Diff for: requirements.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
#
55
# pip-compile requirements.in
66
#
7+
aliftools[sample,shaping] @ git+https://github.com/aliftype/tools.git@2907f32967d5db55d164c98b07fa0e4d9652a794
8+
# via
9+
# -r requirements.in
10+
# aliftools
711
appdirs==1.4.4
812
# via fs
913
attrs==24.2.0
1014
# via ufolib2
1115
axisregistry==0.4.11
1216
# via -r requirements.in
1317
blackrenderer==0.6.0
14-
# via -r requirements.in
18+
# via aliftools
1519
booleanoperations==0.9.0
1620
# via ufo2ft
1721
cffsubr==0.3.0
@@ -26,7 +30,6 @@ fontmath==0.9.4
2630
# ufo2ft
2731
fonttools[lxml,ufo,unicode]==4.53.1
2832
# via
29-
# -r requirements.in
3033
# axisregistry
3134
# blackrenderer
3235
# booleanoperations
@@ -37,10 +40,9 @@ fonttools[lxml,ufo,unicode]==4.53.1
3740
# glyphslib
3841
# ufo2ft
3942
# ufolib2
40-
# vharfbuzz
4143
fs==2.4.16
4244
# via fonttools
43-
glyphslib==6.8.2
45+
glyphslib==6.9.0
4446
# via fontmake
4547
lxml==5.3.0
4648
# via fonttools
@@ -51,25 +53,23 @@ protobuf==3.20.3
5153
pyclipper==1.3.0.post5
5254
# via booleanoperations
5355
pyyaml==6.0.2
54-
# via -r requirements.in
56+
# via aliftools
5557
six==1.16.0
5658
# via fs
57-
ufo2ft[compreffor]==3.2.8
59+
ufo2ft[compreffor]==3.3.0
5860
# via
5961
# -r requirements.in
6062
# fontmake
6163
ufolib2==0.16.0
6264
# via
6365
# fontmake
6466
# glyphslib
65-
uharfbuzz==0.39.5
67+
uharfbuzz==0.40.1
6668
# via
69+
# aliftools
6770
# blackrenderer
68-
# vharfbuzz
6971
unicodedata2==15.1.0
7072
# via fonttools
71-
vharfbuzz==0.3.1
72-
# via -r requirements.in
7373

7474
# The following packages are considered to be unsafe in a requirements file:
7575
# setuptools

Diff for: scripts

Submodule scripts deleted from 66126a6

Diff for: scripts/dist.py

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import argparse
2+
3+
from fontTools import subset
4+
from fontTools.ttLib import TTFont, newTable
5+
from fontTools.ttLib.tables import ttProgram
6+
7+
8+
def fix_unhinted_font(font):
9+
gasp = newTable("gasp")
10+
# Set GASP so all sizes are smooth
11+
gasp.gaspRange = {0xFFFF: 15}
12+
13+
program = ttProgram.Program()
14+
assembly = ["PUSHW[]", "511", "SCANCTRL[]", "PUSHB[]", "4", "SCANTYPE[]"]
15+
program.fromAssembly(assembly)
16+
17+
prep = newTable("prep")
18+
prep.program = program
19+
20+
font["gasp"] = gasp
21+
font["prep"] = prep
22+
23+
24+
def main():
25+
parser = argparse.ArgumentParser(description="Post process font for distribution.")
26+
parser.add_argument("input", metavar="FILE", help="input font to process")
27+
parser.add_argument("output", metavar="FILE", help="output font to save")
28+
parser.add_argument("version", metavar="VERSION", help="Font version")
29+
30+
args = parser.parse_args()
31+
32+
font = TTFont(args.input)
33+
34+
version = args.version.split("-")[0]
35+
if args.version[0] == "v":
36+
version = version[1:]
37+
38+
font["head"].fontRevision = float(version)
39+
40+
font["name"].names = [n for n in font["name"].names if n.platformID == 3]
41+
for name in font["name"].names:
42+
if name.nameID == 5:
43+
v = f"Version {version}"
44+
name.string = v
45+
if name.nameID == 3:
46+
parts = [version] + str(name).split(";")[1:]
47+
name.string = ";".join(parts)
48+
49+
if "fvar" in font:
50+
from axisregistry import build_stat
51+
52+
build_stat(font, [])
53+
fix_unhinted_font(font)
54+
55+
unicodes = set(font.getBestCmap().keys())
56+
options = subset.Options()
57+
options.set(
58+
layout_features="*",
59+
layout_scripts="*",
60+
name_IDs="*",
61+
name_languages="*",
62+
notdef_outline=True,
63+
glyph_names=False,
64+
recalc_average_width=True,
65+
drop_tables=[],
66+
)
67+
subsetter = subset.Subsetter(options=options)
68+
subsetter.populate(unicodes=unicodes)
69+
subsetter.subset(font)
70+
71+
font.save(args.output)
72+
73+
74+
if __name__ == "__main__":
75+
main()

0 commit comments

Comments
 (0)