diff --git a/src/wasm/graphite/addTable.py b/src/addTable.py similarity index 100% rename from src/wasm/graphite/addTable.py rename to src/addTable.py diff --git a/src/wasm/graphite/Makefile b/src/wasm/graphite/Makefile index 593212cc1..6584df96d 100644 --- a/src/wasm/graphite/Makefile +++ b/src/wasm/graphite/Makefile @@ -1,8 +1,11 @@ -all: CharisSIL-R.wasm.ttf Scheherazade-R.wasm.ttf AwamiNastaliq-Regular.wasm.ttf +FONTS = CharisSIL-R.wasm.ttf Scheherazade-R.wasm.ttf AwamiNastaliq-Regular.wasm.ttf +ADD_TABLE = ../../addTable.py -%.wasm: %.cc ../hb-wasm-api.h +all: $(FONTS) + +%.wasm: %.cc ../../hb-wasm-api.h emcc \ - -I .. \ + -I ../.. \ -I ~/graphite/include/ \ -fvisibility=hidden \ -Wl,--allow-undefined \ @@ -13,10 +16,10 @@ all: CharisSIL-R.wasm.ttf Scheherazade-R.wasm.ttf AwamiNastaliq-Regular.wasm.ttf $< \ -o $@ -%.wasm.ttf: %.ttf shape.wasm addTable.py - python addTable.py $< $@ shape.wasm +%.wasm.ttf: %.ttf shape.wasm $(ADD_TABLE) + python $(ADD_TABLE) $< $@ shape.wasm clean: - $(RM) test.wasm.ttf shape.wasm + $(RM) shape.wasm $(FONTS) -.PRECIOUS: shape.wasm +.PRECIOUS: shap.wasm diff --git a/src/wasm/sample/addTable.py b/src/wasm/sample/addTable.py deleted file mode 100644 index 103f292dd..000000000 --- a/src/wasm/sample/addTable.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -from fontTools.ttLib import TTFont -from fontTools.ttLib.tables.DefaultTable import DefaultTable - -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(sys.argv[3], "rb").read() - -font["Wasm"] = wasm_table - -font.save(sys.argv[2]) diff --git a/src/wasm/sample/c/Makefile b/src/wasm/sample/c/Makefile index 60606e359..4ee073b64 100644 --- a/src/wasm/sample/c/Makefile +++ b/src/wasm/sample/c/Makefile @@ -1,21 +1,23 @@ +ADD_TABLE = ../../../addTable.py + all: test-fallback.wasm.ttf test-ot.wasm.ttf -%.wasm: %.cc ../hb-wasm-api.h +%.wasm: %.cc ../../../hb-wasm-api.h clang \ --target=wasm32-unknown-wasi \ -Wl,--no-entry \ -fvisibility=hidden \ -Wl,--allow-undefined \ -nostdlib \ - -I .. \ + -I ../../.. \ $< \ -o $@ -test-fallback.wasm.ttf: test.ttf shape-fallback.wasm addTable.py - python addTable.py $< $@ shape-fallback.wasm +test-fallback.wasm.ttf: test.ttf shape-fallback.wasm $(ADD_TABLE) + python $(ADD_TABLE) $< $@ shape-fallback.wasm -test-ot.wasm.ttf: test.ttf shape-ot.wasm addTable.py - python addTable.py $< $@ shape-ot.wasm +test-ot.wasm.ttf: test.ttf shape-ot.wasm $(ADD_TABLE) + python $(ADD_TABLE) $< $@ shape-ot.wasm clean: $(RM) test-fallback.wasm.ttf test-ot.wasm.ttf shape-fallback.wasm shape-ot.wasm