[wasm] Fix up samples

pull/4131/head
Behdad Esfahbod 2 years ago
parent 4ad659a608
commit 1023a80d39
  1. 0
      src/addTable.py
  2. 17
      src/wasm/graphite/Makefile
  3. 16
      src/wasm/sample/addTable.py
  4. 14
      src/wasm/sample/c/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

@ -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])

@ -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

Loading…
Cancel
Save