Skip to content

Commit

Permalink
Set font version using FontVersionFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Sep 30, 2024
1 parent 2ddd3b6 commit dcf7073
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ ${FONT}: ${GLYPHSFILE}
--verbose=WARNING \
--master-dir="{tmp}" \
--flatten-components \
--filter DecomposeTransformedComponentsFilter
--filter DecomposeTransformedComponentsFilter \
--filter "alifTools.filters::FontVersionFilter(fontVersion=${VERSION})"

${DFONT}: ${FONT}
$(info   DIST $(@F))
mkdir -p ${BUILDDIR}
${PYTHON} ${SCRIPTDIR}/dist.py $< $@ ${VERSION}
${PYTHON} ${SCRIPTDIR}/dist.py $< $@

${TESTDIR}/%.json: ${TESTDIR}/%.yaml ${FONT}
$(info   GEN $(@F))
Expand Down
Binary file modified fonts/Mada.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ufo2ft >= 2.30.0
fontmake
alifTools[shaping,sample] @ git+https://github.com/aliftype/tools.git@604c296c02d3015ed5d80c3970e86ec22f690a5a
alifTools[shaping,sample,filters] @ git+https://github.com/aliftype/tools.git@2557ec7593c511e9fc5c7ada36df4105003de527
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile requirements.in
#
aliftools[sample,shaping] @ git+https://github.com/aliftype/tools.git@604c296c02d3015ed5d80c3970e86ec22f690a5a
aliftools[filters,sample,shaping] @ git+https://github.com/aliftype/tools.git@2557ec7593c511e9fc5c7ada36df4105003de527
# via
# -r requirements.in
# aliftools
Expand Down Expand Up @@ -54,6 +54,7 @@ six==1.16.0
ufo2ft[compreffor]==3.3.0
# via
# -r requirements.in
# aliftools
# fontmake
ufolib2==0.16.0
# via
Expand Down
14 changes: 0 additions & 14 deletions scripts/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,12 @@ def main():
parser = argparse.ArgumentParser(description="Post process font for distribution.")
parser.add_argument("input", metavar="FILE", help="input font to process")
parser.add_argument("output", metavar="FILE", help="output font to save")
parser.add_argument("version", metavar="VERSION", help="Font version")

args = parser.parse_args()

font = TTFont(args.input)

version = args.version.split("-")[0]
if args.version[0] == "v":
version = version[1:]

font["head"].fontRevision = float(version)

font["name"].names = [n for n in font["name"].names if n.platformID == 3]
for name in font["name"].names:
if name.nameID == 5:
v = f"Version {version}"
name.string = v
if name.nameID == 3:
parts = [version] + str(name).split(";")[1:]
name.string = ";".join(parts)

unicodes = set(font.getBestCmap().keys())
options = subset.Options()
Expand Down

0 comments on commit dcf7073

Please sign in to comment.