diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml
index 229d8bda..e609f7c1 100644
--- a/.github/workflows/playground.yml
+++ b/.github/workflows/playground.yml
@@ -26,24 +26,42 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
+ - name: "Install harfbuzz"
+ run: sudo apt-get update && sudo apt-get install -y libharfbuzz-bin
+ - name: "Subset fonts"
+ run: make subset
- name: Setup Pages
- uses: actions/configure-pages@v5
+ uses: actions/configure-pages@v6
- name: "Install Rust toolchain"
run: rustup target add wasm32-unknown-unknown
- - uses: actions/setup-node@v4
- with:
- node-version: 20
- - uses: qmaru/wasm-pack-action@v0.5.0
- uses: Swatinem/rust-cache@v2
- - name: "Run wasm-pack"
+ - name: "Get wasm-bindgen version"
+ id: wasm-bindgen-version
+ run: |
+ VERSION=$(grep -A 1 'name = "wasm-bindgen"' Cargo.lock | grep version | sed 's/.*"\(.*\)".*/\1/')
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+ echo "version=$VERSION"
+
+ - name: "Install wasm-bindgen-cli"
+ uses: taiki-e/install-action@v2
+ with:
+ tool: wasm-bindgen-cli@${{ steps.wasm-bindgen-version.outputs.version }}
+ - name: "Install wasm-opt"
+ uses: jaxxstorm/action-install-gh-release@v2.1.0
+ with:
+ repo: WebAssembly/binaryen
+ tag: version_128
+ binaries-location: binaryen-version_128/bin
+ chmod: 0755
+ - name: "Generate playground"
run: |
- wasm-pack build --target web --out-dir ../../playground/pkg --no-typescript --no-pack crates/math-core-wasm
- - name: "Create comparison page"
+ make playground
+ - name: "Generate comparison page"
run: |
make comparison
- name: Upload artifact
- uses: actions/upload-pages-artifact@v3
+ uses: actions/upload-pages-artifact@v4
with:
path: "./playground"
@@ -57,4 +75,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
- uses: actions/deploy-pages@v4
+ uses: actions/deploy-pages@v5
diff --git a/.github/workflows/wasm_ci.yml b/.github/workflows/wasm_ci.yml
index 6342bc06..5effc225 100644
--- a/.github/workflows/wasm_ci.yml
+++ b/.github/workflows/wasm_ci.yml
@@ -14,39 +14,54 @@ jobs:
name: "cargo test (wasm)"
steps:
- name: "Checkout PR branch"
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
with:
path: pr-branch
- name: "Checkout base branch"
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
with:
ref: ${{ github.base_ref }}
path: base-branch
- name: "Install Rust toolchain"
run: rustup target add wasm32-unknown-unknown
- - uses: actions/setup-node@v4
- with:
- node-version: 20
- - uses: qmaru/wasm-pack-action@v0.5.0
- uses: Swatinem/rust-cache@v2
with:
workspaces: "./pr-branch -> target"
+ - name: "Get wasm-bindgen version"
+ id: wasm-bindgen-version
+ working-directory: ./pr-branch
+ run: |
+ VERSION=$(grep -A 1 'name = "wasm-bindgen"' Cargo.lock | grep version | sed 's/.*"\(.*\)".*/\1/')
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+ echo "version=$VERSION"
+
+ - name: "Install wasm-bindgen-cli"
+ uses: taiki-e/install-action@v2
+ with:
+ tool: wasm-bindgen-cli@${{ steps.wasm-bindgen-version.outputs.version }}
+ - name: "Install wasm-opt"
+ uses: jaxxstorm/action-install-gh-release@v2.1.0
+ with:
+ repo: WebAssembly/binaryen
+ tag: version_128
+ binaries-location: binaryen-version_128/bin
+ chmod: 0755
- name: "Get wasm size on PR"
working-directory: ./pr-branch
run: |
- wasm-pack build --target web --out-dir ../../playground/pkg --no-typescript --no-pack crates/math-core-wasm
+ make playground
SIZE_BYTES=$(stat -c %s playground/pkg/math_core_wasm_bg.wasm)
echo "Wasm size on PR: $SIZE_BYTES bytes"
echo "PR_SIZE_BYTES=$SIZE_BYTES" >> $GITHUB_ENV
- name: "Get wasm size on base branch"
working-directory: ./base-branch
run: |
- wasm-pack build --target web --out-dir ../../playground/pkg --no-typescript --no-pack crates/math-core-wasm
+ make playground
SIZE_BYTES=$(stat -c %s playground/pkg/math_core_wasm_bg.wasm)
echo "Wasm size on base: $SIZE_BYTES bytes"
echo "BASE_SIZE_BYTES=$SIZE_BYTES" >> $GITHUB_ENV
- name: "Comment on PR with WASM sizes"
- uses: actions/github-script@v7
+ uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
diff --git a/.gitignore b/.gitignore
index 29ed6874..7bea49c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -83,3 +83,5 @@ node_modules/
pkg/
/playground/comparison.html
+/scripts/all_symbols.txt
+/playground/fonts/NewCMMath-Book-prime-roundhand-vec-subset.woff2
diff --git a/Makefile b/Makefile
index d513afdc..e4c103c8 100644
--- a/Makefile
+++ b/Makefile
@@ -33,3 +33,14 @@ testpage:
comparison:
cat docs/comparison.html | cargo run --bin mathcore -- -c docs/mathcore.toml --inline-del ₮ --block-del ₮₮ --continue-on-error - > playground/comparison.html
+
+subset: allsymbols
+ hb-subset \
+ --output-file=playground/fonts/NewCMMath-Book-prime-roundhand-vec-subset.otf \
+ --text-file=scripts/all_symbols.txt \
+ --layout-features=ssty,kern,aalt \
+ --desubroutinize \
+ playground/fonts/NewCMMath-Book-prime-roundhand-vec.otf
+
+allsymbols:
+ python3 scripts/generate_symbol_document.py
diff --git a/crates/math-core/examples/browser_test.rs b/crates/math-core/examples/browser_test.rs
index 2bfed5da..69558474 100644
--- a/crates/math-core/examples/browser_test.rs
+++ b/crates/math-core/examples/browser_test.rs
@@ -47,17 +47,17 @@ fn main() {
@@ -29,6 +33,9 @@
+
+
+