[wasm-sample] Make addTable take args

This commit is contained in:
Behdad Esfahbod committed 2023-03-31 17:33:44 -06:00
1 parent 551528a6e6
commit 5ab7f7a7d4
3 files changed
+9 -4

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ all: test.wasm.ttf
-o $@
%.wasm.ttf: %.ttf shape.so addTable.py
python addTable.py
python addTable.py $< $@ shape.so
clean:
$(RM) test.wasm.ttf shape.so
+8 -3
View File
@@ -1,11 +1,16 @@
import sys
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables.DefaultTable import DefaultTable
font = TTFont("test.ttf")
if len(sys.argv) == 1:
print("usage: python addTable.py input.ttf output.ttf Wasm.bin")
sys.exit(1)
font = TTFont(sys.argv[1])
wasm_table = DefaultTable("Wasm")
wasm_table.data = open("shape.so", "rb").read()
wasm_table.data = open(sys.argv[3], "rb").read()
font["Wasm"] = wasm_table
font.save("test.wasm.ttf")
font.save(sys.argv[2])
Binary file not shown.