From 4adeb6a01e6060411b783609fc7b1512404da2d4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 28 May 2025 17:48:02 -0600 Subject: [PATCH 01/39] [paint] Move float stability test to the paint layer from the test --- src/hb-paint.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hb-paint.hh b/src/hb-paint.hh index 6ad365a79..2b4ae0917 100644 --- a/src/hb-paint.hh +++ b/src/hb-paint.hh @@ -72,7 +72,11 @@ struct hb_paint_funcs_t float xx, float yx, float xy, float yy, float dx, float dy) - { func.push_transform (this, paint_data, + { + // Handle -0.f to avoid -0.f == 0.f in the transform matrix. + if (dx == -0.f) dx = 0.f; + if (dy == -0.f) dy = 0.f; + func.push_transform (this, paint_data, xx, yx, xy, yy, dx, dy, !user_data ? nullptr : user_data->push_transform); } void pop_transform (void *paint_data) From 6fb10ded54e4640f75f829acb754b05da5c26362 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 29 May 2025 12:29:34 -0600 Subject: [PATCH 02/39] [ft] Reject loading of font directory --- src/hb-ft.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 5319fe6b0..cb209ab8c 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -1104,6 +1104,10 @@ _hb_ft_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data FT_ULong length = 0; FT_Error error; + /* In new FreeType, a tag value of 1 loads the SFNT table directory. Reject it. */ + if (tag == 1) + return nullptr; + /* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */ error = FT_Load_Sfnt_Table (ft_face, tag, 0, nullptr, &length); From 095a09aa6640741324b06a7b650907cad2f98a43 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 1 Jun 2025 20:34:28 +0300 Subject: [PATCH 03/39] [ci/msvc-ci] Switch to windows-2025 image The windows-2019 image is closing down. --- .github/workflows/msvc-ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/msvc-ci.yml b/.github/workflows/msvc-ci.yml index 9ba19394f..500d706f3 100644 --- a/.github/workflows/msvc-ci.yml +++ b/.github/workflows/msvc-ci.yml @@ -16,13 +16,12 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2019, windows-latest] include: - - name: msvc-2019-x86 - os: windows-2019 + - name: msvc-2025-x86 + os: windows-2025 ARCH: x86 - - name: msvc-2019-amd64 - os: windows-latest + - name: msvc-2025-amd64 + os: windows-2025 ARCH: amd64 name: ${{ matrix.name }} From 3e3e9dfadfc369627dfcfc054669b072197b3264 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 1 Jun 2025 20:51:55 +0300 Subject: [PATCH 04/39] [ci/circleci] Consistently call apt update --- .circleci/config.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a7f89771..31acc1695 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,8 @@ jobs: executor: dist-executor steps: - checkout - - run: sudo apt update && DEBIAN_FRONTEND=noninteractive sudo apt install -y git ninja-build binutils gcc g++ pkg-config ragel gtk-doc-tools gobject-introspection libfreetype6-dev libglib2.0-dev libgirepository1.0-dev libcairo2-dev libicu-dev libgraphite2-dev python3 python3-pip + - run: sudo apt update || true + - run: DEBIAN_FRONTEND=noninteractive sudo apt install -y git ninja-build binutils gcc g++ pkg-config ragel gtk-doc-tools gobject-introspection libfreetype6-dev libglib2.0-dev libgirepository1.0-dev libcairo2-dev libicu-dev libgraphite2-dev python3 python3-pip - run: pip3 install fonttools meson --upgrade - run: meson setup build - run: meson dist --no-tests -Cbuild @@ -122,7 +123,7 @@ jobs: steps: - checkout - run: dpkg --add-architecture i386 - - run: apt update + - run: apt update || true - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-i686 zip wine wine32 - run: | export LANG=en_US.UTF-8 @@ -154,7 +155,7 @@ jobs: steps: - checkout - run: dpkg --add-architecture i386 - - run: apt update + - run: apt update || true - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 wine32:i386 - run: | export LANG=en_US.UTF-8 @@ -175,7 +176,7 @@ jobs: - checkout - attach_workspace: at: . - - run: apt update + - run: apt update || true - run: DEBIAN_FRONTEND=noninteractive apt install -y curl - run: | mv harfbuzz-win64{,-$CIRCLE_TAG}.zip From aaad61cac2201fa101bcc59631b94e260b82537a Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 1 Jun 2025 21:53:42 +0300 Subject: [PATCH 05/39] [ci] Move sanitizer builds from CircleCI to GitHub Actions --- .circleci/config.yml | 53 ---------------------- .github/workflows/sanitizers-ci.yml | 70 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/sanitizers-ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 31acc1695..c7ce12456 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,56 +59,6 @@ jobs: - run: meson compile -Cbuild -j9 - run: RUN_VALGRIND=1 meson test -Cbuild -t 10 --no-suite=slow --wrap='valgrind --leak-check=full --error-exitcode=1' --print-errorlogs --num-processes=$(($(nproc)/2 + 1)) - asan-ubsan: - docker: - - image: ubuntu - steps: - - checkout - - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y python3 python3-pip python3-venv ninja-build clang lld git binutils pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev - - run: | - export ASAN_OPTIONS=log_path=stderr:halt_on_error=1:abort_on_error=1 - export UBSAN_OPTIONS=log_path=stderr:halt_on_error=1:abort_on_error=1:print_stacktrace=1 - python3 -m venv venv - source venv/bin/activate - pip3 install meson==0.60.0 - CC=clang CXX=clang++ meson setup build --default-library=static -Db_sanitize=address,undefined --buildtype=debugoptimized --wrap-mode=nodownload -Dexperimental_api=true - meson compile -Cbuild -j9 - meson test -Cbuild -t 10 --print-errorlogs | asan_symbolize | c++filt - - tsan: - docker: - - image: ubuntu:24.04 - steps: - - checkout - - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y python3 python3-pip python3-venv ninja-build clang lld git binutils pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev - - run: | - export TSAN_OPTIONS=log_path=stderr:halt_on_error=1:abort_on_error=1 - python3 -m venv venv - source venv/bin/activate - pip3 install meson==0.60.0 - CC=clang CXX=clang++ meson setup build --default-library=static -Db_sanitize=thread --buildtype=debugoptimized --wrap-mode=nodownload -Dexperimental_api=true - meson compile -Cbuild -j9 - meson test -Cbuild -t 10 --print-errorlogs | asan_symbolize | c++filt - - msan: - docker: - - image: ubuntu:24.04 - steps: - - checkout - - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y python3 python3-pip python3-venv ninja-build clang lld git binutils pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev - - run: | - export MSAN_OPTIONS=log_path=stderr:halt_on_error=1:abort_on_error=1:print_stacktrace=1 - python3 -m venv venv - source venv/bin/activate - pip3 install meson==0.60.0 - # msan, needs --force-fallback-for=glib,freetype2 also which doesn't work yet but runs fuzzer cases at least - CC=clang CXX=clang++ meson setup build --default-library=static -Db_sanitize=memory --buildtype=debugoptimized --wrap-mode=nodownload -Dauto_features=disabled -Dtests=enabled -Dexperimental_api=true - meson compile -Cbuild -j9 - meson test -Cbuild -t 10 --print-errorlogs | asan_symbolize | c++filt - clang-cxx2a: docker: - image: ubuntu @@ -202,9 +152,6 @@ workflows: branches: ignore: /.*/ - fedora-valgrind - - asan-ubsan - - tsan - - msan - clang-cxx2a - crossbuild-win32: filters: # must have filter or won't work as a dependency diff --git a/.github/workflows/sanitizers-ci.yml b/.github/workflows/sanitizers-ci.yml new file mode 100644 index 000000000..c79e92ec8 --- /dev/null +++ b/.github/workflows/sanitizers-ci.yml @@ -0,0 +1,70 @@ +name: sanitizers + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + name: ${{ matrix.name }} + env: + CC: clang + CXX: clang++ + ASAN_OPTIONS: log_path=stderr:halt_on_error=1:abort_on_error=1 + UBSAN_OPTIONS: log_path=stderr:halt_on_error=1:abort_on_error=1:print_stacktrace=1 + TSAN_OPTIONS: log_path=stderr:halt_on_error=1:abort_on_error=1 + MSAN_OPTIONS: log_path=stderr:halt_on_error=1:abort_on_error=1:print_stacktrace=1 + strategy: + fail-fast: false + matrix: + include: + - name: asan-ubsan + SANITIZE: address,undefined + - name: tsan + SANITIZE: thread + - name: msan + SANITIZE: memory + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Setup Ccache + uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt install -y \ + clang \ + lld \ + binutils \ + pkg-config \ + libfreetype6-dev \ + libglib2.0-dev \ + libcairo2-dev \ + libicu-dev \ + libgraphite2-dev + - name: Setup Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.12' + - name: Install Python Dependencies + run: pip3 install -r .ci/requirements.txt --require-hashes + - name: Setup Meson + run: | + ccache --version + meson setup build \ + --default-library=static \ + --buildtype=debugoptimized \ + --wrap-mode=nodownload \ + -Db_sanitize=${{ matrix.SANITIZE }} \ + -Dexperimental_api=true + - name: Build + run: meson compile -Cbuild + - name: Test + run: meson test -Cbuild -t 10 --print-errorlogs | asan_symbolize | c++filt From 273b8e4d3ba7e53d196575c89f8377ca5d616040 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 1 Jun 2025 23:08:23 +0300 Subject: [PATCH 06/39] [ci] Move cross builds from CircleCI to GitHub Actions --- .circleci/config.yml | 95 -------------------------- .github/workflows/crossbuild-mingw.yml | 81 ++++++++++++++++++++++ 2 files changed, 81 insertions(+), 95 deletions(-) create mode 100644 .github/workflows/crossbuild-mingw.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index c7ce12456..5db84b169 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,12 +1,6 @@ version: 2.1 executors: - win32-executor: - docker: - - image: ubuntu:24.04 - win64-executor: - docker: - - image: ubuntu:24.04 dist-executor: docker: - image: cimg/base:2023.10 @@ -68,71 +62,6 @@ jobs: - run: DEBIAN_FRONTEND=noninteractive apt install -y clang lld git binutils - run: clang -c src/harfbuzz-subset.cc -DHB_NO_MT -Werror -std=c++2a - crossbuild-win32: - executor: win32-executor - steps: - - checkout - - run: dpkg --add-architecture i386 - - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-i686 zip wine wine32 - - run: | - export LANG=en_US.UTF-8 - python3 -m venv venv - source venv/bin/activate - pip3 install meson==1.6.0 - bash .ci/build-win.sh 32 - meson devenv -Cbuild-win32 meson test -t 10 --print-errorlogs --suite=harfbuzz - - store_artifacts: - path: harfbuzz-win32.zip - - persist_to_workspace: - root: . - paths: [harfbuzz-win32.zip] - - publish-win32: - executor: win32-executor - steps: - - checkout - - attach_workspace: - at: . - - run: apt update - - run: DEBIAN_FRONTEND=noninteractive apt install -y curl - - run: | - mv harfbuzz-win32{,-$CIRCLE_TAG}.zip - .ci/publish_release_artifact.sh harfbuzz-win32-$CIRCLE_TAG.zip - - crossbuild-win64: - executor: win64-executor - steps: - - checkout - - run: dpkg --add-architecture i386 - - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y ninja-build python3 python3-pip python3-venv git g++-mingw-w64-x86-64 zip wine wine64 wine32:i386 - - run: | - export LANG=en_US.UTF-8 - python3 -m venv venv - source venv/bin/activate - pip3 install meson==1.6.0 - bash .ci/build-win.sh 64 - meson devenv -Cbuild-win64 meson test -t 10 --print-errorlogs --suite=harfbuzz - - store_artifacts: - path: harfbuzz-win64.zip - - persist_to_workspace: - root: . - paths: [harfbuzz-win64.zip] - - publish-win64: - executor: win64-executor - steps: - - checkout - - attach_workspace: - at: . - - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y curl - - run: | - mv harfbuzz-win64{,-$CIRCLE_TAG}.zip - .ci/publish_release_artifact.sh harfbuzz-win64-$CIRCLE_TAG.zip - - workflows: version: 2 @@ -153,27 +82,3 @@ workflows: ignore: /.*/ - fedora-valgrind - clang-cxx2a - - crossbuild-win32: - filters: # must have filter or won't work as a dependency - tags: - only: /.*/ - - crossbuild-win64: - filters: # must have filter or won't work as a dependency - tags: - only: /.*/ - - publish-win32: - requires: - - crossbuild-win32 - filters: - tags: - only: /^\d+\.\d+\.\d+$/ - branches: - ignore: /.*/ - - publish-win64: - requires: - - crossbuild-win64 - filters: - tags: - only: /^\d+\.\d+\.\d+$/ - branches: - ignore: /.*/ diff --git a/.github/workflows/crossbuild-mingw.yml b/.github/workflows/crossbuild-mingw.yml new file mode 100644 index 000000000..5df6e1fb9 --- /dev/null +++ b/.github/workflows/crossbuild-mingw.yml @@ -0,0 +1,81 @@ +name: crossbuild + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - name: win32 + ARCH: 32 + PACKAGES: g++-mingw-w64-i686 wine wine32 + - name: win64 + ARCH: 64 + PACKAGES: g++-mingw-w64-x86-64 wine wine64 wine32:i386 + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Setup Ccache + uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + - name: Install Dependencies + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt install -y \ + zip \ + ${{ matrix.PACKAGES }} + - name: Setup Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.12' + - name: Install Python Dependencies + run: pip3 install -r .ci/requirements.txt --require-hashes + - name: Build + run: bash .ci/build-win.sh ${{ matrix.ARCH }} + - name: Test + run: meson devenv -Cbuild-win${{ matrix.ARCH }} meson test -t 10 --print-errorlogs --suite=harfbuzz + - name: Archive artifacts + uses: actions/upload-artifact@v4 + with: + name: harfbuzz-win${{ matrix.ARCH }} + path: harfbuzz-win${{ matrix.ARCH }}.zip + if-no-files-found: error + + release: + name: Create and populate release + needs: build + runs-on: ubuntu-24.04 + if: contains(github.ref, 'refs/tags/') + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + - name: Rename artifacts + run: | + ls -R + for file in harfbuzz-win*.zip; do + mv -v "$file" "${file%.zip}-${{ github.ref_name }}.zip" + done + - name: Check for release + id: create_release + run: | + if ! gh release view ${{ github.ref_name }}; then + git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F - + fi + - name: Populate release + run: | + gh release upload ${{ github.ref_name }} harfbuzz-win*-${{ github.ref_name }}.zip --clobber From fa7735f593c0e7e8a9349ee7ada83e2496c2f925 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 1 Jun 2025 23:47:35 +0300 Subject: [PATCH 07/39] [ci] Move publishing dist tarball from CircleCI to GitHub Actions --- .ci/publish_release_artifact.sh | 22 ------------------- .circleci/config.yml | 39 --------------------------------- .github/workflows/linux-ci.yml | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 61 deletions(-) delete mode 100755 .ci/publish_release_artifact.sh diff --git a/.ci/publish_release_artifact.sh b/.ci/publish_release_artifact.sh deleted file mode 100755 index f948e68c2..000000000 --- a/.ci/publish_release_artifact.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -if [[ -z $GITHUB_TOKEN ]]; then - echo "No GITHUB_TOKEN secret found, artifact publishing skipped" - exit -fi - -if ! hash ghr 2> /dev/null; then - _GHR_VER=v0.14.0 - _GHR=ghr_${_GHR_VER}_linux_amd64 - curl -sfL https://github.com/tcnksm/ghr/releases/download/$_GHR_VER/$_GHR.tar.gz | - tar xz -C . --strip-components=1 $_GHR/ghr -fi - -./ghr -replace \ - -u $CIRCLE_PROJECT_USERNAME \ - -r $CIRCLE_PROJECT_REPONAME \ - $CIRCLE_TAG \ - $1 diff --git a/.circleci/config.yml b/.circleci/config.yml index 5db84b169..7c949654b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,10 +1,5 @@ version: 2.1 -executors: - dist-executor: - docker: - - image: cimg/base:2023.10 - jobs: macos-aat-fonts: @@ -21,28 +16,6 @@ jobs: - store_artifacts: path: build/meson-logs/ - dist: - executor: dist-executor - steps: - - checkout - - run: sudo apt update || true - - run: DEBIAN_FRONTEND=noninteractive sudo apt install -y git ninja-build binutils gcc g++ pkg-config ragel gtk-doc-tools gobject-introspection libfreetype6-dev libglib2.0-dev libgirepository1.0-dev libcairo2-dev libicu-dev libgraphite2-dev python3 python3-pip - - run: pip3 install fonttools meson --upgrade - - run: meson setup build - - run: meson dist --no-tests -Cbuild - - persist_to_workspace: - root: . - paths: [build/meson-dist/harfbuzz-*.tar.xz] - - publish-dist: - executor: dist-executor - steps: - - checkout - - attach_workspace: - at: . - - run: | - .ci/publish_release_artifact.sh build/meson-dist/harfbuzz-$CIRCLE_TAG.tar.xz - fedora-valgrind: docker: - image: fedora:36 @@ -68,17 +41,5 @@ workflows: build: jobs: - macos-aat-fonts - - dist: - filters: # must have filter or won't work as a dependency - tags: - only: /.*/ - - publish-dist: - requires: - - dist - filters: - tags: - only: /^\d+\.\d+\.\d+$/ - branches: - ignore: /.*/ - fedora-valgrind - clang-cxx2a diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 802c68cc5..376d55f6e 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -56,6 +56,10 @@ jobs: run: meson compile -Cbuild - name: Test run: meson test --print-errorlogs -Cbuild + - name: Dist + run: | + git reset --hard HEAD # ragel may have modified the source tree + meson dist --no-tests -Cbuild - name: Generate Documentations run: ninja -Cbuild harfbuzz-doc - name: Deploy Documentations @@ -64,3 +68,37 @@ jobs: env: GH_TOKEN: ${{ secrets.GH_TOKEN }} REVISION: ${{ github.sha }} + - name: Archive artifacts + uses: actions/upload-artifact@v4 + with: + name: harfbuzz + path: build/meson-dist/harfbuzz-*.tar.xz + if-no-files-found: error + + release: + name: Create and populate release + needs: build + runs-on: ubuntu-24.04 + if: contains(github.ref, 'refs/tags/') + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: harfbuzz + - name: Extract artifacts + run: | + ls -R + unzip harfbuzz.zip + ls -R + - name: Check for release + id: create_release + run: | + if ! gh release view ${{ github.ref_name }}; then + git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F - + fi + - name: Populate release + run: | + gh release upload ${{ github.ref_name }} harfbuzz-${{ github.ref_name }}.tar.xz --clobber From 352845eef6d3bff2a11558b51b71d7ae2c82d07a Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 2 Jun 2025 00:06:09 +0300 Subject: [PATCH 08/39] [ci] Move clang-c++2a job from CircleCI to GitHub Actions Add a few more configurations for building with -std=c++11 and -Werror. Fixes https://github.com/harfbuzz/harfbuzz/issues/5348 --- .circleci/config.yml | 10 ------- .github/workflows/c++-versions.yml | 45 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/c++-versions.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 7c949654b..344de05b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,15 +26,6 @@ jobs: - run: meson compile -Cbuild -j9 - run: RUN_VALGRIND=1 meson test -Cbuild -t 10 --no-suite=slow --wrap='valgrind --leak-check=full --error-exitcode=1' --print-errorlogs --num-processes=$(($(nproc)/2 + 1)) - clang-cxx2a: - docker: - - image: ubuntu - steps: - - checkout - - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y clang lld git binutils - - run: clang -c src/harfbuzz-subset.cc -DHB_NO_MT -Werror -std=c++2a - workflows: version: 2 @@ -42,4 +33,3 @@ workflows: jobs: - macos-aat-fonts - fedora-valgrind - - clang-cxx2a diff --git a/.github/workflows/c++-versions.yml b/.github/workflows/c++-versions.yml new file mode 100644 index 000000000..b400d7835 --- /dev/null +++ b/.github/workflows/c++-versions.yml @@ -0,0 +1,45 @@ +name: c++ versions + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - name: g++ c++11 + CXX: g++ + CXX_STANDARD: c++11 + PACKAGES: g++ + - name: g++ c++2a + CXX: g++ + CXX_STANDARD: c++2a + PACKAGES: g++ + - name: clang c++11 + CXX: clang++ + CXX_STANDARD: c++11 + PACKAGES: clang + - name: clang c++2a + CXX: clang++ + CXX_STANDARD: c++2a + PACKAGES: clang + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt install -y ${{ matrix.PACKAGES }} + - name: Build + run: ${{ matrix.CXX }} -c src/harfbuzz-subset.cc -DHB_NO_MT -Werror -std=${{ matrix.CXX_STANDARD }} From b80f7ae082e2b9aeb4744f302e4d38390a57f194 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 11:13:23 +0000 Subject: [PATCH 09/39] Bump setuptools from 80.8.0 to 80.9.0 in /.ci Bumps [setuptools](https://github.com/pypa/setuptools) from 80.8.0 to 80.9.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v80.8.0...v80.9.0) --- updated-dependencies: - dependency-name: setuptools dependency-version: 80.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .ci/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/requirements.txt b/.ci/requirements.txt index c6a49392a..f30b7e507 100644 --- a/.ci/requirements.txt +++ b/.ci/requirements.txt @@ -81,7 +81,7 @@ ninja==1.11.1.4 \ # via -r requirements.in # The following packages are considered to be unsafe in a requirements file: -setuptools==80.8.0 \ - --hash=sha256:49f7af965996f26d43c8ae34539c8d99c5042fbff34302ea151eaa9c207cd257 \ - --hash=sha256:95a60484590d24103af13b686121328cc2736bee85de8936383111e421b9edc0 +setuptools==80.9.0 \ + --hash=sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922 \ + --hash=sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c # via -r requirements.in From fbf5b2aa035d6cd9b796d74252045e2b7156ad02 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 11:17:11 +0000 Subject: [PATCH 10/39] Bump ossf/scorecard-action from 2.4.1 to 2.4.2 Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.1 to 2.4.2. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](https://github.com/ossf/scorecard-action/compare/f49aabe0b5af0936a0987cfb85d86b75731b0186...05b42c624433fc40578a4040d5cf5e36ddca8cde) --- updated-dependencies: - dependency-name: ossf/scorecard-action dependency-version: 2.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index e82d73c2a..3a66cda83 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -34,7 +34,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 + uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 with: results_file: results.sarif results_format: sarif From a9c2c635189d9055c216eaaf3fc4535e811e5807 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 4 Jun 2025 11:58:20 -0600 Subject: [PATCH 11/39] [sanitize] Fix pointer math Should fix https://github.com/harfbuzz/harfbuzz/issues/5347 --- src/hb-sanitize.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-sanitize.hh b/src/hb-sanitize.hh index 199165a1e..9260b638d 100644 --- a/src/hb-sanitize.hh +++ b/src/hb-sanitize.hh @@ -463,9 +463,11 @@ struct hb_sanitize_context_t : } else { - if (edit_count && !writable) { - start = hb_blob_get_data_writable (blob, nullptr); - end = start + blob->length; + if (edit_count && !writable) + { + unsigned length; + start = hb_blob_get_data_writable (blob, &length); + end = start + length; if (start) { From 4d7d54e380bcc34e4fcb30f43d2cca6634246abe Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 09:32:49 -0600 Subject: [PATCH 12/39] [coretext] Bump a required version Fixes https://github.com/harfbuzz/harfbuzz/issues/5354 --- src/hb-coretext.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index ea2d5b6e9..4eb6c0fcc 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -206,8 +206,9 @@ create_cg_font (hb_blob_t *blob, unsigned int index) if (unlikely (named_instance_index != 0)) { // https://github.com/harfbuzz/harfbuzz/issues/5300 + // https://github.com/harfbuzz/harfbuzz/issues/5354 #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || \ - (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || \ (defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED >= 110000) || \ (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && __WATCH_OS_VERSION_MIN_REQUIRED >= 40000) || \ (defined(__MACCATALYST_VERSION_MIN_REQUIRED) && __MACCATALYST_VERSION_MIN_REQUIRED >= 130100) || \ From f92809fcdca00d4ac3d765e947e48942dcf9acca Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 17:05:22 -0600 Subject: [PATCH 13/39] [harfruzz] Update to new API From https://github.com/harfbuzz/harfruzz/pull/57 --- src/hb-harfruzz.cc | 8 +++- src/rust/Cargo.lock | 31 +++---------- src/rust/Cargo.toml | 2 +- src/rust/shape.rs | 103 ++++++++++++++++++++++++-------------------- 4 files changed, 71 insertions(+), 73 deletions(-) diff --git a/src/hb-harfruzz.cc b/src/hb-harfruzz.cc index e6d5881db..06132c05a 100644 --- a/src/hb-harfruzz.cc +++ b/src/hb-harfruzz.cc @@ -81,6 +81,7 @@ _hb_harfruzz_shaper_font_data_destroy (hb_harfruzz_font_data_t *data) extern "C" void * _hb_harfruzz_shape_plan_create_rs (const void *font_data, + const void *face_data, hb_script_t script, hb_language_t language, hb_direction_t direction); @@ -94,7 +95,8 @@ _hb_harfruzz_shape_plan_destroy_rs (void *data); */ extern "C" hb_bool_t -_hb_harfruzz_shape_rs (const void *face_data, +_hb_harfruzz_shape_rs (const void *font_data, + const void *face_data, const void *rs_shape_plan, hb_font_t *font, hb_buffer_t *buffer, @@ -111,6 +113,7 @@ _hb_harfruzz_shape (hb_shape_plan_t *shape_plan, unsigned int num_features) { const hb_harfruzz_font_data_t *font_data = font->data.harfruzz; + const hb_harfruzz_face_data_t *face_data = font->face->data.harfruzz; void *hr_shape_plan = nullptr; @@ -121,7 +124,7 @@ _hb_harfruzz_shape (hb_shape_plan_t *shape_plan, &hr_shape_plan_key); if (unlikely (!hr_shape_plan)) { - hr_shape_plan = _hb_harfruzz_shape_plan_create_rs (font_data, + hr_shape_plan = _hb_harfruzz_shape_plan_create_rs (font_data, face_data, shape_plan->key.props.script, shape_plan->key.props.language, shape_plan->key.props.direction); @@ -139,6 +142,7 @@ _hb_harfruzz_shape (hb_shape_plan_t *shape_plan, } return _hb_harfruzz_shape_rs (font_data, + face_data, hr_shape_plan, font, buffer, diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 509a7863f..30e02f407 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -57,15 +57,13 @@ dependencies = [ [[package]] name = "harfruzz" version = "0.1.0" -source = "git+https://github.com/harfbuzz/harfruzz#966d38a4b7b2f23b77a0ce4c356542e9395102e8" +source = "git+https://github.com/harfbuzz/harfruzz?branch=instance-api#4964a851fee309a899831c544cff738f65ac1ff3" dependencies = [ "bitflags", "bytemuck", "core_maths", - "log", "read-fonts", "smallvec", - "ttf-parser", ] [[package]] @@ -74,12 +72,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - [[package]] name = "proc-macro2" version = "1.0.95" @@ -100,9 +92,9 @@ dependencies = [ [[package]] name = "read-fonts" -version = "0.29.1" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e85935612710191461ec9df47b4b5880dd6359d4fad3b2f2ed696215f6f3146" +checksum = "04ca636dac446b5664bd16c069c00a9621806895b8bb02c2dc68542b23b8f25d" dependencies = [ "bytemuck", "core_maths", @@ -111,9 +103,9 @@ dependencies = [ [[package]] name = "skrifa" -version = "0.31.1" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9c3bb8cab5196b98d70c866ce1ea81ab516104d5b396f84ae80f8766b5d5b4e" +checksum = "dbeb4ca4399663735553a09dd17ce7e49a0a0203f03b706b39628c4d913a8607" dependencies = [ "bytemuck", "read-fonts", @@ -121,9 +113,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "syn" @@ -136,15 +128,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "ttf-parser" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" -dependencies = [ - "core_maths", -] - [[package]] name = "unicode-ident" version = "1.0.18" diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 5d0368a8d..0f93e18e7 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" [dependencies] skrifa = { version = "0.*", optional = true } -harfruzz = { git = "https://github.com/harfbuzz/harfruzz", optional = true } +harfruzz = { git = "https://github.com/harfbuzz/harfruzz", branch="instance-api", optional = true } [lib] name = "harfbuzz_rust" diff --git a/src/rust/shape.rs b/src/rust/shape.rs index aac28783a..518dc0c33 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -6,12 +6,12 @@ use std::ffi::c_void; use std::ptr::null_mut; use std::str::FromStr; -use harfruzz::{F2Dot14, Face, FontRef, ShaperFont, Tag}; +use harfruzz::{FontRef, NormalizedCoord, ShaperData, ShaperInstance, Tag}; pub struct HBHarfRuzzFaceData<'a> { face_blob: *mut hb_blob_t, font_ref: FontRef<'a>, - shaper_font: ShaperFont, + shaper_data: ShaperData, } #[no_mangle] @@ -31,12 +31,12 @@ pub unsafe extern "C" fn _hb_harfruzz_shaper_face_data_create_rs( Ok(f) => f, Err(_) => return null_mut(), }; - let shaper_font = ShaperFont::new(&font_ref); + let shaper_data = ShaperData::new(&font_ref); let hr_face_data = Box::new(HBHarfRuzzFaceData { face_blob, font_ref, - shaper_font, + shaper_data, }); Box::into_raw(hr_face_data) as *mut c_void @@ -50,12 +50,11 @@ pub unsafe extern "C" fn _hb_harfruzz_shaper_face_data_destroy_rs(data: *mut c_v hb_blob_destroy(blob); } -pub struct HBHarfRuzzFontData<'a> { - coords: Vec, - face: Option>, +pub struct HBHarfRuzzFontData { + shaper_instance: ShaperInstance, } -fn font_coords_to_f2dot14(font: *mut hb_font_t) -> Vec { +fn font_coords_to_f2dot14(font: *mut hb_font_t) -> Vec { let mut num_coords: u32 = 0; let coords = unsafe { hb_font_get_var_coords_normalized(font, &mut num_coords) }; let coords = if coords.is_null() { @@ -65,7 +64,7 @@ fn font_coords_to_f2dot14(font: *mut hb_font_t) -> Vec { }; coords .iter() - .map(|&v| F2Dot14::from_bits(v as i16)) + .map(|&v| NormalizedCoord::from_bits(v as i16)) .collect::>() } @@ -76,15 +75,13 @@ pub unsafe extern "C" fn _hb_harfruzz_shaper_font_data_create_rs( ) -> *mut c_void { let face_data = face_data as *const HBHarfRuzzFaceData; + let font_ref = &(*face_data).font_ref; let coords = font_coords_to_f2dot14(font); - let hr_font_data = Box::new(HBHarfRuzzFontData { coords, face: None }); + let shaper_instance = ShaperInstance::from_coords(font_ref, coords); + + let hr_font_data = Box::new(HBHarfRuzzFontData { shaper_instance }); let hr_font_data_ptr = Box::into_raw(hr_font_data); - (*hr_font_data_ptr).face = Some( - (*face_data) - .shaper_font - .shaper(&(*face_data).font_ref, &(*hr_font_data_ptr).coords), - ); hr_font_data_ptr as *mut c_void } @@ -108,11 +105,15 @@ fn hb_language_to_hr_language(language: hb_language_t) -> Option *mut c_void { let font_data = font_data as *const HBHarfRuzzFontData; + let face_data = face_data as *const HBHarfRuzzFaceData; + + let font_ref = &(*face_data).font_ref; let script = harfruzz::Script::from_iso15924_tag(Tag::from_u32(script)); let language = hb_language_to_hr_language(language); @@ -124,13 +125,14 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_plan_create_rs( _ => harfruzz::Direction::Invalid, }; - let hr_shape_plan = harfruzz::ShapePlan::new( - (*font_data).face.as_ref().unwrap(), - direction, - script, - language.as_ref(), - &[], - ); + let shaper = (*face_data) + .shaper_data + .shaper(font_ref) + .instance(Some(&(*font_data).shaper_instance)) + .build(); + + let hr_shape_plan = + harfruzz::ShapePlan::new(&shaper, direction, script, language.as_ref(), &[]); let hr_shape_plan = Box::new(hr_shape_plan); Box::into_raw(hr_shape_plan) as *mut c_void } @@ -144,6 +146,7 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_plan_destroy_rs(data: *mut c_void) { #[no_mangle] pub unsafe extern "C" fn _hb_harfruzz_shape_rs( font_data: *const c_void, + face_data: *const c_void, shape_plan: *const c_void, font: *mut hb_font_t, buffer: *mut hb_buffer_t, @@ -151,6 +154,9 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( num_features: u32, ) -> hb_bool_t { let font_data = font_data as *const HBHarfRuzzFontData; + let face_data = face_data as *const HBHarfRuzzFaceData; + + let font_ref = &(*face_data).font_ref; let mut hr_buffer = harfruzz::UnicodeBuffer::new(); @@ -215,33 +221,38 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( hr_buffer.add(char::from_u32_unchecked(unicode), cluster); } - let face = &(*font_data).face.as_ref().unwrap(); + let shaper = (*face_data) + .shaper_data + .shaper(font_ref) + .instance(Some(&(*font_data).shaper_instance)) + .build(); + + let features = if features.is_null() { + Vec::new() + } else { + let features = std::slice::from_raw_parts(features, num_features as usize); + features + .iter() + .map(|f| { + let tag = f.tag; + let value = f.value; + let start = f.start; + let end = f.end; + harfruzz::Feature { + tag: Tag::from_u32(tag), + value, + start, + end, + } + }) + .collect::>() + }; let glyphs = if shape_plan.is_null() { - let features = if features.is_null() { - Vec::new() - } else { - let features = std::slice::from_raw_parts(features, num_features as usize); - features - .iter() - .map(|f| { - let tag = f.tag; - let value = f.value; - let start = f.start; - let end = f.end; - harfruzz::Feature { - tag: Tag::from_u32(tag), - value, - start, - end, - } - }) - .collect::>() - }; - harfruzz::shape(face, &features, hr_buffer) + shaper.shape(hr_buffer, &features) } else { let shape_plan = shape_plan as *const harfruzz::ShapePlan; - harfruzz::shape_with_plan(face, shape_plan.as_ref().unwrap(), hr_buffer) + shaper.shape_with_plan(shape_plan.as_ref().unwrap(), hr_buffer, &features) }; let count = glyphs.len(); @@ -260,7 +271,7 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( let mut x_scale: i32 = 0; let mut y_scale: i32 = 0; hb_font_get_scale(font, &mut x_scale, &mut y_scale); - let upem = face.units_per_em(); + let upem = shaper.units_per_em(); let x_scale = x_scale as f32 / upem as f32; let y_scale = y_scale as f32 / upem as f32; From e670b729f7325abdaf9d021ef92614211ea75ad0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 18:12:04 -0600 Subject: [PATCH 14/39] [harfruzz] Enable new cluster level GRAPHEMES --- src/rust/shape.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/rust/shape.rs b/src/rust/shape.rs index 518dc0c33..5d5b2f18c 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -172,11 +172,9 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( hb_buffer_cluster_level_t_HB_BUFFER_CLUSTER_LEVEL_CHARACTERS => { harfruzz::BufferClusterLevel::Characters } - /* TODO: Enable when added to HarfRuzz hb_buffer_cluster_level_t_HB_BUFFER_CLUSTER_LEVEL_GRAPHEMES => { harfruzz::BufferClusterLevel::Graphemes } - */ _ => harfruzz::BufferClusterLevel::default(), }; hr_buffer.set_cluster_level(cluster_level); From 80b73a1109a86837ccb641ab2ab6e86e6b7e1b46 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 18:13:05 -0600 Subject: [PATCH 15/39] [harfruzz] Track main again --- src/rust/Cargo.lock | 2 +- src/rust/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 30e02f407..31a8dec4a 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -57,7 +57,7 @@ dependencies = [ [[package]] name = "harfruzz" version = "0.1.0" -source = "git+https://github.com/harfbuzz/harfruzz?branch=instance-api#4964a851fee309a899831c544cff738f65ac1ff3" +source = "git+https://github.com/harfbuzz/harfruzz#4c39fc704c15baabc60323e083d8c38bb23ccbb3" dependencies = [ "bitflags", "bytemuck", diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 0f93e18e7..5d0368a8d 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" [dependencies] skrifa = { version = "0.*", optional = true } -harfruzz = { git = "https://github.com/harfbuzz/harfruzz", branch="instance-api", optional = true } +harfruzz = { git = "https://github.com/harfbuzz/harfruzz", optional = true } [lib] name = "harfbuzz_rust" From 74e99dbe6357c168eb50089e1fde58a67764f415 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 18:15:20 -0600 Subject: [PATCH 16/39] [harfruzz] Apply review feedback --- src/rust/shape.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/rust/shape.rs b/src/rust/shape.rs index 5d5b2f18c..f4d31d3e0 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -54,7 +54,7 @@ pub struct HBHarfRuzzFontData { shaper_instance: ShaperInstance, } -fn font_coords_to_f2dot14(font: *mut hb_font_t) -> Vec { +fn font_to_shaper_instance(font: *mut hb_font_t, font_ref: &FontRef<'_>) -> ShaperInstance { let mut num_coords: u32 = 0; let coords = unsafe { hb_font_get_var_coords_normalized(font, &mut num_coords) }; let coords = if coords.is_null() { @@ -62,10 +62,8 @@ fn font_coords_to_f2dot14(font: *mut hb_font_t) -> Vec { } else { unsafe { std::slice::from_raw_parts(coords, num_coords as usize) } }; - coords - .iter() - .map(|&v| NormalizedCoord::from_bits(v as i16)) - .collect::>() + let coords = coords.iter().map(|&v| NormalizedCoord::from_bits(v as i16)); + ShaperInstance::from_coords(font_ref, coords) } #[no_mangle] @@ -76,9 +74,7 @@ pub unsafe extern "C" fn _hb_harfruzz_shaper_font_data_create_rs( let face_data = face_data as *const HBHarfRuzzFaceData; let font_ref = &(*face_data).font_ref; - let coords = font_coords_to_f2dot14(font); - - let shaper_instance = ShaperInstance::from_coords(font_ref, coords); + let shaper_instance = font_to_shaper_instance(font, font_ref); let hr_font_data = Box::new(HBHarfRuzzFontData { shaper_instance }); let hr_font_data_ptr = Box::into_raw(hr_font_data); From 4ab5130e4a2dde3f13ba7a3dda8f8295da7b9077 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 18:16:31 -0600 Subject: [PATCH 17/39] [harfruzz] More glyph flags --- src/rust/shape.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rust/shape.rs b/src/rust/shape.rs index f4d31d3e0..418685fe9 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -282,6 +282,12 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( if hr_info.unsafe_to_break() { info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_UNSAFE_TO_BREAK; } + if hr_info.unsafe_to_concat() { + info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_UNSAFE_TO_CONCAT; + } + if hr_info.safe_to_insert_tatweel() { + info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL; + } pos.x_advance = (hr_pos.x_advance as f32 * x_scale).round() as hb_position_t; pos.y_advance = (hr_pos.y_advance as f32 * y_scale).round() as hb_position_t; pos.x_offset = (hr_pos.x_offset as f32 * x_scale).round() as hb_position_t; From d5dd5ac81956b45082f945ae5234a097bb47d1cf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 18:29:40 -0600 Subject: [PATCH 18/39] [harfruzz] Clear mask before setting --- src/rust/shape.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rust/shape.rs b/src/rust/shape.rs index 418685fe9..ad029365c 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -279,6 +279,7 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( let pos = &mut *positions.add(i); info.codepoint = hr_info.glyph_id; info.cluster = hr_info.cluster; + info.mask = 0; if hr_info.unsafe_to_break() { info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_UNSAFE_TO_BREAK; } From 7908e86e353cd40ffb725d4aafe1932d688c0fe8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 20:19:06 -0600 Subject: [PATCH 19/39] [util/test-shape] Only output one line per test If a shape call was failing, perhaps because of --verify failing, hb-shape was producing multiple lines possibly, making the test runner get out of sync and fail all following tests. https://github.com/harfbuzz/harfruzz/issues/60 --- test/shape/run-tests.py | 6 +++--- util/shape-consumer.hh | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 6889e183d..ccd433c11 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -30,7 +30,7 @@ def open_shape_batch_process(): cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=sys.stdout, + stderr=subprocess.PIPE, env=env, ) return [process] @@ -47,6 +47,7 @@ def shape_cmd(command, shape_process, verbose=False): if shape_process[0].poll() is not None: shape_process[0].stdin.close() shape_process[0].stdout.close() + shape_process[0].stderr.close() shape_process[0] = open_shape_batch_process()[0] if verbose: @@ -281,8 +282,7 @@ for filename in args: if glyphs_expected != "*": extra_options.append("--verify") - if shaper == "ot": - extra_options.append("--unsafe-to-concat") + extra_options.append("--unsafe-to-concat") if verbose: print( diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh index 15c193fe3..f97fd5f6d 100644 --- a/util/shape-consumer.hh +++ b/util/shape-consumer.hh @@ -70,10 +70,7 @@ struct shape_consumer_t : shape_options_t { failed = true; output.error (error); - if (hb_buffer_get_content_type (buffer) == HB_BUFFER_CONTENT_TYPE_GLYPHS) - break; - else - return true; + return true; } } From e5becebf2c85744f454e8da885623b08c0a4f456 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 21:02:07 -0600 Subject: [PATCH 20/39] [harfRuzz] Roll forward --- src/rust/Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 31a8dec4a..82285e4c8 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -57,7 +57,7 @@ dependencies = [ [[package]] name = "harfruzz" version = "0.1.0" -source = "git+https://github.com/harfbuzz/harfruzz#4c39fc704c15baabc60323e083d8c38bb23ccbb3" +source = "git+https://github.com/harfbuzz/harfruzz#695caf4d97be12a5e8dc9762ae734ab2a3710b68" dependencies = [ "bitflags", "bytemuck", From cc884606bcaa09a18055325b90d28025f3469ea5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Jun 2025 21:39:03 -0600 Subject: [PATCH 21/39] [test/shape] --safe-to-insert-tatweel At some point we should switch to --show-flags. For now, tests all pass regardless of this switch. --- test/shape/run-tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index ccd433c11..69dd60182 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -283,6 +283,7 @@ for filename in args: if glyphs_expected != "*": extra_options.append("--verify") extra_options.append("--unsafe-to-concat") + extra_options.append("--safe-to-insert-tatweel") if verbose: print( From e860b8d18097cde3464e27bff681c66f20c4fd53 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 7 Jun 2025 04:33:27 -0600 Subject: [PATCH 22/39] [harfruzz] Set point_size --- src/rust/shape.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rust/shape.rs b/src/rust/shape.rs index ad029365c..35d130c1b 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -215,10 +215,14 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( hr_buffer.add(char::from_u32_unchecked(unicode), cluster); } + let ptem = hb_font_get_ptem(font); + let ptem = if ptem > 0.0 { Some(ptem) } else { None }; + let shaper = (*face_data) .shaper_data .shaper(font_ref) .instance(Some(&(*font_data).shaper_instance)) + .point_size(ptem) .build(); let features = if features.is_null() { From 904f58efab131ade554704f545288cefaabac0f7 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 8 Jun 2025 13:20:49 +0300 Subject: [PATCH 23/39] [ci] Move fedora-valgrind job from CircleCI to GitHub Actions Use Ubuntu like the rest of Linux CI jobs. --- .circleci/config.yml | 11 --------- .github/workflows/valgrind.yml | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/valgrind.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 344de05b7..b31d4eec5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,20 +16,9 @@ jobs: - store_artifacts: path: build/meson-logs/ - fedora-valgrind: - docker: - - image: fedora:36 - steps: - - checkout - - run: dnf install -y pkg-config ragel valgrind gcc gcc-c++ meson git glib2-devel freetype-devel cairo-devel libicu-devel gobject-introspection-devel graphite2-devel redhat-rpm-config python python-pip || true - - run: meson setup build --buildtype=debugoptimized - - run: meson compile -Cbuild -j9 - - run: RUN_VALGRIND=1 meson test -Cbuild -t 10 --no-suite=slow --wrap='valgrind --leak-check=full --error-exitcode=1' --print-errorlogs --num-processes=$(($(nproc)/2 + 1)) - workflows: version: 2 build: jobs: - macos-aat-fonts - - fedora-valgrind diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml new file mode 100644 index 000000000..538ef97d0 --- /dev/null +++ b/.github/workflows/valgrind.yml @@ -0,0 +1,44 @@ +name: valgrind + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Setup Ccache + uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18 + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt install -y \ + valgrind \ + binutils \ + pkg-config \ + libfreetype6-dev \ + libglib2.0-dev \ + libcairo2-dev \ + libicu-dev \ + libgraphite2-dev + - name: Setup Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.12' + - name: Install Python Dependencies + run: pip3 install -r .ci/requirements.txt --require-hashes + - name: Setup Meson + run: meson setup build --buildtype=debugoptimized + - name: Build + run: meson compile -Cbuild + - name: Test + run: meson test -Cbuild -t 10 --no-suite=slow --wrap='valgrind --leak-check=full --error-exitcode=1' --print-errorlogs From 74113481d4f3505573000a44d4d1e0c7dc4924bf Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 8 Jun 2025 13:22:32 +0300 Subject: [PATCH 24/39] [ci] Remove last CircleCI job We already test macOS fonts on the other macOS CI jobs, so this one is redundant. --- .circleci/config.yml | 24 ------------------------ README.md | 1 - 2 files changed, 25 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b31d4eec5..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2.1 - -jobs: - - macos-aat-fonts: - macos: - xcode: "15.3.0" - steps: - - checkout - - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config ragel freetype glib cairo python3 icu4c graphite2 gobject-introspection ninja - - run: pip3 install meson --upgrade - - run: brew link --force icu4c - - run: PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" meson setup build -Dcoretext=enabled -Dgraphite=enabled -Dauto_features=enabled -Dchafa=disabled -Ddocs=disabled - - run: meson compile -Cbuild - - run: meson test -Cbuild --print-errorlogs - - store_artifacts: - path: build/meson-logs/ - -workflows: - version: 2 - - build: - jobs: - - macos-aat-fonts diff --git a/README.md b/README.md index 6f94a58f3..5e3a8d072 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ [![Linux CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux-ci.yml) [![macoOS CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos-ci.yml) [![Windows CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc-ci.yml) -[![CircleCI Build Status](https://circleci.com/gh/harfbuzz/harfbuzz/tree/main.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz/tree/main) [![OSS-Fuzz Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/harfbuzz.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#harfbuzz) [![Coverity Scan Build Status](https://scan.coverity.com/projects/15166/badge.svg)](https://scan.coverity.com/projects/harfbuzz) [![Packaging status](https://repology.org/badge/tiny-repos/harfbuzz.svg)](https://repology.org/project/harfbuzz/versions) From a37b7673053b1abd3e7b25c52c44ba116bbb5f19 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 8 Jun 2025 13:30:09 +0300 Subject: [PATCH 25/39] [ci] Remove redundant -ci suffix from yaml file names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some files have it, some don’t, so lets drop it and be consistent. --- .github/workflows/{arm-ci.yml => arm.yml} | 0 .github/workflows/{linux-ci.yml => linux.yml} | 2 +- .github/workflows/{macos-ci.yml => macos.yml} | 2 +- .github/workflows/{msvc-ci.yml => msvc.yml} | 0 .github/workflows/{msys2-ci.yml => msys2.yml} | 0 .github/workflows/{sanitizers-ci.yml => sanitizers.yml} | 0 README.md | 6 +++--- 7 files changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{arm-ci.yml => arm.yml} (100%) rename .github/workflows/{linux-ci.yml => linux.yml} (99%) rename .github/workflows/{macos-ci.yml => macos.yml} (99%) rename .github/workflows/{msvc-ci.yml => msvc.yml} (100%) rename .github/workflows/{msys2-ci.yml => msys2.yml} (100%) rename .github/workflows/{sanitizers-ci.yml => sanitizers.yml} (100%) diff --git a/.github/workflows/arm-ci.yml b/.github/workflows/arm.yml similarity index 100% rename from .github/workflows/arm-ci.yml rename to .github/workflows/arm.yml diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux.yml similarity index 99% rename from .github/workflows/linux-ci.yml rename to .github/workflows/linux.yml index 376d55f6e..ea680470b 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux.yml @@ -1,4 +1,4 @@ -name: linux-ci +name: linux on: push: diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos.yml similarity index 99% rename from .github/workflows/macos-ci.yml rename to .github/workflows/macos.yml index 564377e6b..770aca889 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos.yml @@ -1,4 +1,4 @@ -name: macos-ci +name: macos on: push: diff --git a/.github/workflows/msvc-ci.yml b/.github/workflows/msvc.yml similarity index 100% rename from .github/workflows/msvc-ci.yml rename to .github/workflows/msvc.yml diff --git a/.github/workflows/msys2-ci.yml b/.github/workflows/msys2.yml similarity index 100% rename from .github/workflows/msys2-ci.yml rename to .github/workflows/msys2.yml diff --git a/.github/workflows/sanitizers-ci.yml b/.github/workflows/sanitizers.yml similarity index 100% rename from .github/workflows/sanitizers-ci.yml rename to .github/workflows/sanitizers.yml diff --git a/README.md b/README.md index 5e3a8d072..8f235612d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![Linux CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux-ci.yml) -[![macoOS CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos-ci.yml) -[![Windows CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc-ci.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc-ci.yml) +[![Linux CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/linux.yml) +[![macoOS CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/macos.yml) +[![Windows CI Status](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc.yml/badge.svg)](https://github.com/harfbuzz/harfbuzz/actions/workflows/msvc.yml) [![OSS-Fuzz Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/harfbuzz.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#harfbuzz) [![Coverity Scan Build Status](https://scan.coverity.com/projects/15166/badge.svg)](https://scan.coverity.com/projects/harfbuzz) [![Packaging status](https://repology.org/badge/tiny-repos/harfbuzz.svg)](https://repology.org/project/harfbuzz/versions) From d9a258bedce346f44de8c695f042b21c14d0f8b3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 31 May 2025 16:27:54 -0600 Subject: [PATCH 26/39] [perf] Add hb-draw-compare and hb-svg-compare --- perf/hb-draw-compare | 309 +++++++++++++++++++++++++++++++++++++++++++ perf/hb-svg-compare | 151 +++++++++++++++++++++ 2 files changed, 460 insertions(+) create mode 100755 perf/hb-draw-compare create mode 100755 perf/hb-svg-compare diff --git a/perf/hb-draw-compare b/perf/hb-draw-compare new file mode 100755 index 000000000..e9850dadd --- /dev/null +++ b/perf/hb-draw-compare @@ -0,0 +1,309 @@ +#!/bin/bash + +trap "exit" INT + +dirname=`dirname "$0"` + +# Parse options +output_dir= +font_file= +face_index=0 +hb_view=hb-view +hb_info=hb-info +hb_svg_compare=$dirname/hb-svg-compare +tolerance=0 +font_size=upem +features= +variations= +face_loader=ot +shaper=ot +font_funcs1=ot +font_funcs2=coretext +clear1=false +clear2=false +unicodes= +glyphs= +quiet=false +help=false +while test $# -gt 0; do + case "$1" in + -o|--output-dir) + shift + output_dir=$1 + shift + ;; + --font-file) + shift + font_file=$1 + shift + ;; + --face-index) + shift + face_index=$1 + shift + ;; + --hb-view) + shift + hb_view=$1 + shift + ;; + --hb-info) + shift + hb_info=$1 + shift + ;; + --hb-svg-compare) + shift + hb_svg_compare=$1 + shift + ;; + --tolerance) + shift + tolerance=$1 + shift + ;; + --font-size) + shift + font_size=$1 + shift + ;; + --features) + shift + features=$1 + shift + ;; + --variations) + shift + variations=$1 + shift + ;; + --unicodes) + shift + unicodes=$1 + shift + ;; + --face-loader) + shift + face_loader=$1 + shift + ;; + --shaper) + shift + shaper=$1 + shift + ;; + --font-funcs1) + shift + font_funcs1=$1 + shift + ;; + --font-funcs2) + shift + font_funcs2=$1 + shift + ;; + --clear1) + shift + clear1=true + ;; + --clear2) + shift + clear2=true + ;; + --quiet) + quiet=true + shift + ;; + --help) + help=true + shift + ;; + *) + if test "x$font_file" == x; then + font_file=$1 + shift + else + glyphs="$glyphs $1" + shift + fi + ;; + esac +done + +if $help; then + cmd=`basename "$0"` + echo "Usage: $cmd [OPTIONS] FONTFILE [GLYPH...]" + echo "Render a font with two font backends and compare the results." + echo + echo "Options:" + echo " -o, --output-dir DIR: Output in DIR" + echo " --font-file FONTFILE: Font file to render" + echo " --hb-view HB_VIEW: Path to hb-view; default $hb_view" + echo " --hb-info HB_INFO: Path to hb-info; default $hb_info" + echo " --hb-svg-compare HB_SVG_COMPARE: Path to hb-svg-compare; default $hb_svg_compare" + echo " --tolerance TOLERANCE: Tolerance for SVG comparison; default $tolerance" + echo " --font-size SIZE: Font size; default $font_size" + echo " --features FEATURES: Font features; default none" + echo " --variations VARIATIONS: Font variations; default none" + echo " --face-loader: Face loader; default $face_loader" + echo " --shaper: Shaper; default $shaper" + echo " --font-funcs0 font_funcs: First font-funcs; default $font_funcs1" + echo " --font-funcs1 font_funcs: Second font-funcs; default $font_funcs2" + echo " --clear1: Clear first font backend output if exists" + echo " --clear2: Clear second font backend output if exists" + echo " --unicodes CODES: Unicodes to render" + echo " --quiet: Quiet mode" + echo " --help: Print help" + exit 0 +fi + +if test "x$font_file" == x; then + echo "No font file specified." >&2 + exit 2 +fi +if ! which "$hb_view" 2>/dev/null >/dev/null; then + echo "'$hb_view' not found" >&2 + exit 2 +fi +if ! which "$hb_info" 2>/dev/null >/dev/null; then + echo "'$hb_info' not found" >&2 + exit 2 +fi +if ! test -f "$font_file"; then + echo "Font file '$font_file' not found" >&2 + exit 2 +fi + +# Sanity check Unicode values +if test "x$unicodes" != x; then + echo "$unicodes" | + tr ' ' '\n' | + grep -v '^U[+][0-9a-fA-F]\+$' && + { + echo "Invalid Unicode values" >&2 + exit 2 + } +fi + +$quiet || echo "Comparing '$font_file' with '$font_funcs1' and '$font_funcs2' font backends. " >&2 + +if test "x$output_dir" == x; then + output_dir=`mktemp -d` + echo "Output in '$output_dir'" >&2 +fi +mkdir -p "$output_dir" || exit 1 + +# Populate glyphs file +glyphs_file="$output_dir/glyphs" +> "$glyphs_file" +echo "$unicodes" | +sed 's/^U+//' | +grep . | +while read unicode; do + echo "uni$unicode" +done >> "$glyphs_file" +echo "$glyphs" | +tr ' ' '\n' | +grep . >> "$glyphs_file" +if test "x$unicodes" == x -a "x$glyphs" == x; then + $quiet || echo "No unicodes or glyphs specified. Comparing all glyphs in the font." >&2 + num_glyphs=`$hb_info --quiet --show-glyph-count "$font_file"` + $quiet || echo "Font has $num_glyphs glyphs." >&2 + seq 0 $((num_glyphs - 1)) | + sed 's/^/gid/' >> "$glyphs_file" +fi +num_glyphs=`cat "$glyphs_file" | wc -l` + +flavor= +if test "$features" != ""; then + flavor="$flavor.features=$features" +fi +if test "$variations" != ""; then + flavor="$flavor.variations=$variations" +fi + +# Render with both font backends +if $clear1; then + funcs_prefix="$output_dir/$font_funcs1$flavor" + $quiet || echo "Clearing '$funcs_prefix'... " >&2 + rm -rf "$funcs_prefix" +fi +if $clear2; then + funcs_prefix="$output_dir/$font_funcs2$flavor" + $quiet || echo "Clearing '$funcs_prefix'... " >&2 + rm -rf "$funcs_prefix" +fi +for font_funcs in "$font_funcs1" "$font_funcs2"; do + test "x$font_funcs" == x && continue + $quiet || echo "Rendering with font backend '$font_funcs'..." >&2 + + funcs_prefix="$output_dir/$font_funcs$flavor" + mkdir -p "$funcs_prefix" + count=0 + cat "$glyphs_file" | + while read glyph; do + dir="$funcs_prefix" + svg="$dir/$glyph.svg" + if test -f "$svg"; then + continue + fi + count=$((count + 1)) + if test $((count % 100)) == 0; then + $quiet || echo -n . >&2 + fi + echo \ + --font-file="$font_file" \ + --face-index=$face_index \ + --glyphs \ + --face-loader=$face_loader \ + --shaper=$this_shaper \ + --font-funcs=$font_funcs \ + --features="$features" \ + --variations="$variations" \ + --output-format=svg \ + --font-size=$font_size \ + --output-file="$svg" \ + "$glyph" + done | + sed 's/ /;/g' | + "$hb_view" --batch + $quiet || echo "" >&2 +done + +test "x$font_funcs1" == x || test "x$font_funcs2" == x && exit 0 + +diff="$output_dir/diff$flavor" +rm -f "$diff" +> "$diff" +test "x$flavor" == x || ln -f -s "diff$flavor" "$output_dir/diff" +$quiet || echo "Comparing SVGs into '$diff'..." >&2 +funcs1_prefix="$output_dir/$font_funcs1$flavor" +funcs2_prefix="$output_dir/$font_funcs2$flavor" +count=0 +cat "$glyphs_file" | +while read glyph; do + count=$((count + 1)) + if test $((count % 100)) == 0; then + $quiet || echo -n . >&2 + fi + + svg1="$funcs1_prefix/$glyph.svg" + svg2="$funcs2_prefix/$glyph.svg" + + if ! test -f "$svg1" || ! test -f "$svg2"; then + echo -e "\n$glyph not rendered." >&2 + exit 1 + fi + + echo -e "$svg1\t$svg2" +done | +"$hb_svg_compare" "$tolerance" | +while read line; do + $quiet || echo -e "\n$line" + echo "$line" >> "$diff" +done +# Sort diff by error +sort -n -o "$diff.tmp" "$diff" && mv "$diff.tmp" "$diff" || exit 1 +# Count number of differences +num_diffs=`cat "$diff" | wc -l` +$quiet || echo -e "\nFound $num_diffs differences in $num_glyphs glyphs." >&2 diff --git a/perf/hb-svg-compare b/perf/hb-svg-compare new file mode 100755 index 000000000..8df6d1cb6 --- /dev/null +++ b/perf/hb-svg-compare @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 + +import xml.etree.ElementTree as ET +import re +import math + +def tokenize_path_data(d_attribute): + """ + Splits an SVG path 'd' attribute string into a list of tokens: + - Single-letter commands (M, m, L, l, C, c, etc.) + - Float values (including possible scientific notation) + Returns a list of strings/float, e.g. ['M', 10.0, 20.0, 'L', 30.5, 40.7, 'Z']. + """ + # Regex explanation: + # ([MmZzLlHhVvCcSsQqTtAa]) => one of the valid path command letters + # | => OR + # ([+-]?\d+(\.\d+)?([eE][+-]?\d+)?) => a number that may include optional +/-, + # decimals, and scientific notation + token_pattern = re.compile(r'([MmZzLlHhVvCcSsQqTtAa])|([+-]?\d+(\.\d+)?([eE][+-]?\d+)?)') + raw_tokens = token_pattern.findall(d_attribute) + + # raw_tokens is a list of tuples from the capturing groups. We only need one + # of those fields from each match. We'll filter out empty strings and parse floats. + tokens = [] + for match in raw_tokens: + # match is a tuple: (command_letter, number_string, ..., ...) + command_letter = match[0] + number_string = match[1] + if command_letter: + # It's a path command like 'M', 'L', etc. + tokens.append(command_letter) + else: + # It's a numeric value + tokens.append(float(number_string)) + + return tokens + +def extract_paths_from_svg(svg_data): + """ + Parses an SVG file and extracts the 'd' attribute from + all elements in order. Returns a list of token lists. + """ + root = ET.fromstring(svg_data) + + # Inkscape / Illustrator SVGs often have a default namespace. + # You may need to adjust the namespace if the tags are qualified. + # For example: + # namespace = {'svg': 'http://www.w3.org/2000/svg'} + # for path_elem in root.findall('.//svg:path', namespace): + # ... + # If your SVGs do not use a default namespace, the below should work. + + all_token_lists = [] + for path_elem in root.findall('.//{http://www.w3.org/2000/svg}path'): + d_attribute = path_elem.get('d') + if d_attribute: + tokens = tokenize_path_data(d_attribute) + all_token_lists.append(tokens) + + # If your SVG has no default namespace or if you removed it, you might do: + # for path_elem in root.findall('.//path'): + # d_attribute = path_elem.get('d') + # ... + # + # Adjust as appropriate depending on your actual SVG structure/namespaces. + + return all_token_lists + +def compare_token_lists(tokens_a, tokens_b): + """ + Compares two lists of path tokens (commands and floats). + Returns True if they match (same commands in same positions, + numeric values within given tolerance), otherwise False. + """ + if len(tokens_a) != len(tokens_b): + return None # Different lengths => not a match + + max_diff = 0 + for a, b in zip(tokens_a, tokens_b): + if isinstance(a, str) and isinstance(b, str): + # Must match exactly the same command letter + if a != b: + return None + elif isinstance(a, float) and isinstance(b, float): + # Compare numeric values + diff = abs(a - b) + max_diff = max(max_diff, diff) + else: + # One is command, the other is float => mismatch + return None + + return max_diff + +def compare_svg_files(svg_file_1, svg_file_2): + """ + Compares two SVG files to check if they have the same number of elements, + and each corresponding path has the same structure of commands. + Return max difference between respective numeric values in the paths. + """ + + svg_data_1 = open(svg_file_1).read() + svg_data_2 = open(svg_file_2).read() + + # If contents match exactly, return 0 + if svg_data_1 == svg_data_2: + return 0 + + paths1 = extract_paths_from_svg(svg_data_1) + paths2 = extract_paths_from_svg(svg_data_2) + + # Check that we have the same number of elements + if len(paths1) != len(paths2): + return None + + # Compare each path token list + max_diff = 0 + for tokens1, tokens2 in zip(paths1, paths2): + ret = compare_token_lists(tokens1, tokens2) + if ret is None: + return ret + max_diff = max(max_diff, ret) + + return max_diff + + +if __name__ == "__main__": + import sys + + if '--help' in sys.argv[1:]: + print("Usage: hb-svg-compare TOLERANCE < file_with_svg_pairs.txt") + sys.exit(1) + + tolerance = 0 + if len(sys.argv) > 1: + tolerance = float(sys.argv[1]) + + # Read all lines of two SVG file paths from stdin and compare + for line in sys.stdin: + svg1, svg2 = line.strip().split() + diff = compare_svg_files(svg1, svg2) + + if diff is None: + diff = "DIFF" + elif diff <= tolerance: + continue + else: + diff = f"{diff:.5f}" + + print(f"{diff}\t{svg1}\t{svg2}") + # Flush stdout to make sure output is immediate + sys.stdout.flush() From 48d224e78627f227ab4aef56c0624992517c4dd6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 31 May 2025 16:28:56 -0600 Subject: [PATCH 27/39] [algs] Make hb_sincos() generic to both float and double --- meson.build | 1 + src/hb-algs.hh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/meson.build b/meson.build index 9a22ef738..23c564ec8 100644 --- a/meson.build +++ b/meson.build @@ -103,6 +103,7 @@ check_funcs = [ ['isatty', {'prefix': '#include '}], ['uselocale', {'prefix': '#include '}], ['newlocale', {'prefix': '#include '}], + ['sincos', {'prefix': '#define _GNU_SOURCE\n#include '}], ['sincosf', {'prefix': '#define _GNU_SOURCE\n#include '}], ] diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 0252fa7df..66b2f9fc5 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -210,6 +210,27 @@ _hb_roundf (float x) { return floorf (x + .5f); } #define roundf(x) _hb_roundf(x) +static inline void +hb_sincos (float rotation, float &s, float &c) +{ +#ifdef HAVE_SINCOSF + sincosf (rotation, &s, &c); +#else + c = cosf (rotation); + s = sinf (rotation); +#endif +} +static inline void +hb_sincos (double rotation, double &s, double &c) +{ +#ifdef HAVE_SINCOS + sincos (rotation, &s, &c); +#else + c = cos (rotation); + s = sin (rotation); +#endif +} + /* Encodes three unsigned integers in one 64-bit number. If the inputs have more than 21 bits, * values will be truncated / overlap, and might not decode exactly. */ From c124252df5c35f851b4f455771f710035a51fc13 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 31 May 2025 16:32:58 -0600 Subject: [PATCH 28/39] [algs] Add support for little-endian int types As well as 64bit-int, and float types. Add Align type. --- src/OT/Layout/GPOS/ValueFormat.hh | 2 +- src/hb-algs.hh | 225 +++++++++++++++++++++--------- src/hb-open-type.hh | 92 ++++++++---- src/hb-serialize.hh | 3 +- 4 files changed, 224 insertions(+), 98 deletions(-) diff --git a/src/OT/Layout/GPOS/ValueFormat.hh b/src/OT/Layout/GPOS/ValueFormat.hh index 9442cc1cc..05bf364b5 100644 --- a/src/OT/Layout/GPOS/ValueFormat.hh +++ b/src/OT/Layout/GPOS/ValueFormat.hh @@ -56,7 +56,7 @@ struct ValueFormat : HBUINT16 * PosTable (may be NULL) */ #endif - IntType& operator = (uint16_t i) { v = i; return *this; } + NumType& operator = (uint16_t i) { v = i; return *this; } unsigned int get_len () const { return hb_popcount ((unsigned int) *this); } unsigned int get_size () const { return get_len () * Value::static_size; } diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 66b2f9fc5..31da272fb 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -78,129 +78,220 @@ /* - * Big-endian integers. + * Fixed-endian integers / floats. */ + /* Endian swap, used in Windows related backends */ static inline constexpr uint16_t hb_uint16_swap (uint16_t v) { return (v >> 8) | (v << 8); } static inline constexpr uint32_t hb_uint32_swap (uint32_t v) { return (hb_uint16_swap (v) << 16) | hb_uint16_swap (v >> 16); } -#ifndef HB_FAST_INT_ACCESS +template +struct __attribute__((packed)) hb_packed_t { Type v; }; + +#ifndef HB_FAST_NUM_ACCESS #if defined(__OPTIMIZE__) && \ defined(__BYTE_ORDER) && \ (__BYTE_ORDER == __BIG_ENDIAN || \ (__BYTE_ORDER == __LITTLE_ENDIAN && \ hb_has_builtin(__builtin_bswap16) && \ hb_has_builtin(__builtin_bswap32))) -#define HB_FAST_INT_ACCESS 1 +#define HB_FAST_NUM_ACCESS 1 #else -#define HB_FAST_INT_ACCESS 0 +#define HB_FAST_NUM_ACCESS 0 #endif #endif -template -struct BEInt; -template -struct BEInt +template +struct HBInt; +template +struct HBInt { public: - BEInt () = default; - constexpr BEInt (Type V) : v {uint8_t (V)} {} + HBInt () = default; + constexpr HBInt (Type V) : v {uint8_t (V)} {} constexpr operator Type () const { return v; } private: uint8_t v; }; -template -struct BEInt +template +struct HBInt { - struct __attribute__((packed)) packed_uint16_t { uint16_t v; }; - public: - BEInt () = default; + HBInt () = default; - BEInt (Type V) -#if HB_FAST_INT_ACCESS -#if __BYTE_ORDER == __LITTLE_ENDIAN - { ((packed_uint16_t *) v)->v = __builtin_bswap16 (V); } -#else /* __BYTE_ORDER == __BIG_ENDIAN */ - { ((packed_uint16_t *) v)->v = V; } -#endif + HBInt (Type V) +#if HB_FAST_NUM_ACCESS + { + if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) + ((hb_packed_t *) v)->v = V; + else + ((hb_packed_t *) v)->v = __builtin_bswap16 (V); + } #else - : v {uint8_t ((V >> 8) & 0xFF), - uint8_t ((V ) & 0xFF)} {} + : v {BE ? uint8_t ((V >> 8) & 0xFF) : uint8_t ((V ) & 0xFF), + BE ? uint8_t ((V ) & 0xFF) : uint8_t ((V >> 8) & 0xFF)} {} #endif - constexpr operator Type () const { -#if HB_FAST_INT_ACCESS -#if __BYTE_ORDER == __LITTLE_ENDIAN - return __builtin_bswap16 (((packed_uint16_t *) v)->v); -#else /* __BYTE_ORDER == __BIG_ENDIAN */ - return ((packed_uint16_t *) v)->v; -#endif + constexpr operator Type () const + { +#if HB_FAST_NUM_ACCESS + return (BE == (__BYTE_ORDER == __BIG_ENDIAN)) ? + ((const hb_packed_t *) v)->v + : + __builtin_bswap16 (((const hb_packed_t *) v)->v) + ; #else - return (v[0] << 8) - + (v[1] ); + return (BE ? (v[0] << 8) : (v[0] )) + + (BE ? (v[1] ) : (v[1] << 8)); #endif } private: uint8_t v[2]; }; -template -struct BEInt +template +struct HBInt { static_assert (!std::is_signed::value, ""); public: - BEInt () = default; - constexpr BEInt (Type V) : v {uint8_t ((V >> 16) & 0xFF), - uint8_t ((V >> 8) & 0xFF), - uint8_t ((V ) & 0xFF)} {} + HBInt () = default; + constexpr HBInt (Type V) : v {BE ? uint8_t ((V >> 16) & 0xFF) : uint8_t ((V >> 16) & 0xFF), + BE ? uint8_t ((V >> 8) & 0xFF) : uint8_t ((V >> 8) & 0xFF), + BE ? uint8_t ((V ) & 0xFF) : uint8_t ((V ) & 0xFF)} {} - constexpr operator Type () const { return (v[0] << 16) - + (v[1] << 8) - + (v[2] ); } + constexpr operator Type () const { return (BE ? (v[0] << 16) : (v[0] )) + + (BE ? (v[1] << 8) : (v[1] << 8)) + + (BE ? (v[2] ) : (v[2] << 16)); } private: uint8_t v[3]; }; -template -struct BEInt +template +struct HBInt { - struct __attribute__((packed)) packed_uint32_t { uint32_t v; }; + template + friend struct HBFloat; public: - BEInt () = default; + HBInt () = default; - BEInt (Type V) -#if HB_FAST_INT_ACCESS -#if __BYTE_ORDER == __LITTLE_ENDIAN - { ((packed_uint32_t *) v)->v = __builtin_bswap32 (V); } -#else /* __BYTE_ORDER == __BIG_ENDIAN */ - { ((packed_uint32_t *) v)->v = V; } -#endif + HBInt (Type V) +#if HB_FAST_NUM_ACCESS + { + if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) + ((hb_packed_t *) v)->v = V; + else + ((hb_packed_t *) v)->v = __builtin_bswap32 (V); + } #else - : v {uint8_t ((V >> 24) & 0xFF), - uint8_t ((V >> 16) & 0xFF), - uint8_t ((V >> 8) & 0xFF), - uint8_t ((V ) & 0xFF)} {} + : v {BE ? uint8_t ((V >> 24) & 0xFF) : uint8_t ((V ) & 0xFF), + BE ? uint8_t ((V >> 16) & 0xFF) : uint8_t ((V >> 8) & 0xFF), + BE ? uint8_t ((V >> 8) & 0xFF) : uint8_t ((V >> 16) & 0xFF), + BE ? uint8_t ((V ) & 0xFF) : uint8_t ((V >> 24) & 0xFF)} {} #endif constexpr operator Type () const { -#if HB_FAST_INT_ACCESS -#if __BYTE_ORDER == __LITTLE_ENDIAN - return __builtin_bswap32 (((packed_uint32_t *) v)->v); -#else /* __BYTE_ORDER == __BIG_ENDIAN */ - return ((packed_uint32_t *) v)->v; -#endif +#if HB_FAST_NUM_ACCESS + return (BE == (__BYTE_ORDER == __BIG_ENDIAN)) ? + ((const hb_packed_t *) v)->v + : + __builtin_bswap32 (((const hb_packed_t *) v)->v) + ; #else - return (v[0] << 24) - + (v[1] << 16) - + (v[2] << 8) - + (v[3] ); + return (BE ? (v[0] << 24) : (v[0] )) + + (BE ? (v[1] << 16) : (v[1] << 8)) + + (BE ? (v[2] << 8) : (v[2] << 16)) + + (BE ? (v[3] ) : (v[3] << 24)); #endif } private: uint8_t v[4]; }; +template +struct HBInt +{ + template + friend struct HBFloat; + + public: + HBInt () = default; + + HBInt (Type V) + : v {BE ? uint8_t ((V >> 56) & 0xFF) : uint8_t ((V ) & 0xFF), + BE ? uint8_t ((V >> 48) & 0xFF) : uint8_t ((V >> 8) & 0xFF), + BE ? uint8_t ((V >> 40) & 0xFF) : uint8_t ((V >> 16) & 0xFF), + BE ? uint8_t ((V >> 32) & 0xFF) : uint8_t ((V >> 24) & 0xFF), + BE ? uint8_t ((V >> 24) & 0xFF) : uint8_t ((V >> 32) & 0xFF), + BE ? uint8_t ((V >> 16) & 0xFF) : uint8_t ((V >> 40) & 0xFF), + BE ? uint8_t ((V >> 8) & 0xFF) : uint8_t ((V >> 48) & 0xFF), + BE ? uint8_t ((V ) & 0xFF) : uint8_t ((V >> 56) & 0xFF)} {} + + constexpr operator Type () const { + return (BE ? (uint64_t (v[0]) << 56) : (uint64_t (v[0]) )) + + (BE ? (uint64_t (v[1]) << 48) : (uint64_t (v[1]) << 8)) + + (BE ? (uint64_t (v[2]) << 40) : (uint64_t (v[2]) << 16)) + + (BE ? (uint64_t (v[3]) << 32) : (uint64_t (v[3]) << 24)) + + (BE ? (uint64_t (v[4]) << 24) : (uint64_t (v[4]) << 32)) + + (BE ? (uint64_t (v[5]) << 16) : (uint64_t (v[5]) << 40)) + + (BE ? (uint64_t (v[6]) << 8) : (uint64_t (v[6]) << 48)) + + (BE ? (uint64_t (v[7]) ) : (uint64_t (v[7]) << 56)); + } + private: uint8_t v[8]; +}; /* Floats. */ +template +struct HBFloat +{ + using IntType = typename std::conditional::type; + + public: + HBFloat () = default; + + HBFloat (Type V) + { +#if HB_FAST_NUM_ACCESS + { + if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) + { + ((hb_packed_t *) v)->v = V; + return; + } + } +#endif + + union { + hb_packed_t f; + hb_packed_t i; + } u = {{V}}; + + const HBInt I = u.i.v; + for (unsigned i = 0; i < Bytes; i++) + v[i] = I.v[i]; + } + + /* c++14 constexpr */ operator Type () const + { +#if HB_FAST_NUM_ACCESS + { + if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) + return ((const hb_packed_t *) v)->v; + } +#endif + + HBInt I; + for (unsigned i = 0; i < Bytes; i++) + I.v[i] = v[i]; + + union { + hb_packed_t i; + hb_packed_t f; + } u = {{I}}; + + return u.f.v; + } + private: uint8_t v[Bytes]; +}; + + /* We want our rounding towards +infinity. */ static inline double _hb_roundf (double x) { return floor (x + .5); } diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index f2040ea5c..aa4f4d904 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -54,35 +54,40 @@ namespace OT { */ /* Integer types in big-endian order and no alignment requirement */ -template -struct IntType +struct NumType { typedef Type type; - - IntType () = default; - explicit constexpr IntType (Type V) : v {V} {} - IntType& operator = (Type i) { v = i; return *this; } /* For reason we define cast out operator for signed/unsigned, instead of Type, see: * https://github.com/harfbuzz/harfbuzz/pull/2875/commits/09836013995cab2b9f07577a179ad7b024130467 */ - operator typename std::conditional::value, signed, unsigned>::type () const { return v; } + typedef typename std::conditional::value, + typename std::conditional::value, signed, unsigned>::type, + Type>::type WideType; - bool operator == (const IntType &o) const { return (Type) v == (Type) o.v; } - bool operator != (const IntType &o) const { return !(*this == o); } + NumType () = default; + explicit constexpr NumType (Type V) : v {V} {} + NumType& operator = (Type V) { v = V; return *this; } - IntType& operator += (unsigned count) { *this = *this + count; return *this; } - IntType& operator -= (unsigned count) { *this = *this - count; return *this; } - IntType& operator ++ () { *this += 1; return *this; } - IntType& operator -- () { *this -= 1; return *this; } - IntType operator ++ (int) { IntType c (*this); ++*this; return c; } - IntType operator -- (int) { IntType c (*this); --*this; return c; } + operator WideType () const { return v; } - HB_INTERNAL static int cmp (const IntType *a, const IntType *b) + bool operator == (const NumType &o) const { return (Type) v == (Type) o.v; } + bool operator != (const NumType &o) const { return !(*this == o); } + + NumType& operator += (WideType count) { *this = *this + count; return *this; } + NumType& operator -= (WideType count) { *this = *this - count; return *this; } + NumType& operator ++ () { *this += 1; return *this; } + NumType& operator -- () { *this -= 1; return *this; } + NumType operator ++ (int) { NumType c (*this); ++*this; return c; } + NumType operator -- (int) { NumType c (*this); --*this; return c; } + + HB_INTERNAL static int cmp (const NumType *a, const NumType *b) { return b->cmp (*a); } HB_INTERNAL static int cmp (const void *a, const void *b) { - IntType *pa = (IntType *) a; - IntType *pb = (IntType *) b; + NumType *pa = (NumType *) a; + NumType *pb = (NumType *) b; return pb->cmp (*pa); } @@ -99,20 +104,32 @@ struct IntType return_trace (c->check_struct (this)); } protected: - BEInt v; + typename std::conditional::value, + HBInt, + HBFloat>::type v; public: DEFINE_SIZE_STATIC (Size); }; -typedef IntType HBUINT8; /* 8-bit unsigned integer. */ -typedef IntType HBINT8; /* 8-bit signed integer. */ -typedef IntType HBUINT16; /* 16-bit unsigned integer. */ -typedef IntType HBINT16; /* 16-bit signed integer. */ -typedef IntType HBUINT32; /* 32-bit unsigned integer. */ -typedef IntType HBINT32; /* 32-bit signed integer. */ +typedef NumType HBUINT8; /* 8-bit big-endian unsigned integer. */ +typedef NumType HBINT8; /* 8-bit big-endian signed integer. */ +typedef NumType HBUINT16; /* 16-bit big-endian unsigned integer. */ +typedef NumType HBINT16; /* 16-bit big-endian signed integer. */ +typedef NumType HBUINT32; /* 32-bit big-endian unsigned integer. */ +typedef NumType HBINT32; /* 32-bit big-endian signed integer. */ /* Note: we cannot defined a signed HBINT24 because there's no corresponding C type. * Works for unsigned, but not signed, since we rely on compiler for sign-extension. */ -typedef IntType HBUINT24; /* 24-bit unsigned integer. */ +typedef NumType HBUINT24; /* 24-bit big-endian unsigned integer. */ + +typedef NumType HBUINT16LE; /* 16-bit little-endian unsigned integer. */ +typedef NumType HBINT16LE; /* 16-bit little-endian signed integer. */ +typedef NumType HBUINT32LE; /* 32-bit little-endian unsigned integer. */ +typedef NumType HBINT32LE; /* 32-bit little-endian signed integer. */ + +typedef NumType HBFLOAT32BE; /* 32-bit little-endian floating point number. */ +typedef NumType HBFLOAT64BE; /* 64-bit little-endian floating point number. */ +typedef NumType HBFLOAT32LE; /* 32-bit little-endian floating point number. */ +typedef NumType HBFLOAT64LE; /* 64-bit little-endian floating point number. */ /* 15-bit unsigned number; top bit used for extension. */ struct HBUINT15 : HBUINT16 @@ -218,7 +235,7 @@ typedef HBUINT16 UFWORD; template struct HBFixed : Type { - static constexpr float shift = (float) (1 << fraction_bits); + static constexpr float mult = 1.f / (1 << fraction_bits); static_assert (Type::static_size * 8 > fraction_bits, ""); operator signed () const = delete; @@ -226,8 +243,8 @@ struct HBFixed : Type explicit operator float () const { return to_float (); } typename Type::type to_int () const { return Type::v; } void set_int (typename Type::type i ) { Type::v = i; } - float to_float (float offset = 0) const { return ((int32_t) Type::v + offset) / shift; } - void set_float (float f) { Type::v = roundf (f * shift); } + float to_float (float offset = 0) const { return ((int32_t) Type::v + offset) * mult; } + void set_float (float f) { Type::v = roundf (f / mult); } public: DEFINE_SIZE_STATIC (Type::static_size); }; @@ -2038,6 +2055,23 @@ struct TupleList : CFF2Index }; +// Alignment + +template +struct Align +{ + unsigned get_size (const void *base) const + { + unsigned offset = (const char *) this - (const char *) base; + return (alignment - offset) & (alignment - 1); + } + + public: + DEFINE_SIZE_MIN (0); +}; + + + } /* namespace OT */ diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index 63ab18586..c6dbf8db9 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -794,7 +794,8 @@ struct hb_serialize_context_t template void assign_offset (const object_t* parent, const object_t::link_t &link, unsigned offset) { - auto &off = * ((BEInt *) (parent->head + link.position)); + // XXX We should stop assuming big-endian! + auto &off = * ((HBInt *) (parent->head + link.position)); assert (0 == off); check_assign (off, offset, HB_SERIALIZE_ERROR_OFFSET_OVERFLOW); } From a9b104516313d4939d7e90b23846e0c7b17276ad Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 31 May 2025 17:57:03 -0600 Subject: [PATCH 29/39] See if fixes fedora-valgrind bot --- src/hb-algs.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 31da272fb..ad9e98f7d 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -98,7 +98,7 @@ struct __attribute__((packed)) hb_packed_t { Type v; }; (__BYTE_ORDER == __LITTLE_ENDIAN && \ hb_has_builtin(__builtin_bswap16) && \ hb_has_builtin(__builtin_bswap32))) -#define HB_FAST_NUM_ACCESS 1 +#define HB_FAST_NUM_ACCESS 0 #else #define HB_FAST_NUM_ACCESS 0 #endif From 332995643f84d1b91aa427a580d30fd2ee82afcf Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 2 Jun 2025 15:25:30 +0300 Subject: [PATCH 30/39] Revert "See if fixes fedora-valgrind bot" This reverts commit e2569e6a29a8559dc0887733d76c1754b4be287f. --- src/hb-algs.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index ad9e98f7d..31da272fb 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -98,7 +98,7 @@ struct __attribute__((packed)) hb_packed_t { Type v; }; (__BYTE_ORDER == __LITTLE_ENDIAN && \ hb_has_builtin(__builtin_bswap16) && \ hb_has_builtin(__builtin_bswap32))) -#define HB_FAST_NUM_ACCESS 0 +#define HB_FAST_NUM_ACCESS 1 #else #define HB_FAST_NUM_ACCESS 0 #endif From 47089fe7a34866ce32bf9fa39f70da6bf683a597 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 28 May 2025 17:10:22 -0600 Subject: [PATCH 31/39] Big misc changes - Make geometry types into templates taking float or double. - Changes to paint() transform elimination. - Add font->has_nonzero_coords and use it across. - Extensions to avar processing for otherwise invalid mappings. --- src/OT/Color/COLR/COLR.hh | 55 ++-- src/OT/Layout/GPOS/AnchorFormat3.hh | 6 +- src/OT/Layout/GPOS/ValueFormat.hh | 4 +- src/OT/Var/VARC/VARC.cc | 44 ++-- src/OT/Var/VARC/VARC.hh | 12 +- src/OT/glyf/Glyph.hh | 4 +- src/OT/glyf/glyf.hh | 5 +- src/hb-cff2-interp-cs.hh | 2 +- src/hb-coretext-shape.cc | 11 +- src/hb-draw.cc | 22 +- src/hb-font.cc | 69 ++--- src/hb-font.hh | 3 +- src/hb-ft-colr.hh | 28 +- src/hb-ft.cc | 10 +- src/hb-geometry.hh | 249 +++++++++++------- src/hb-machinery.hh | 17 +- src/hb-ot-cff2-table.cc | 6 +- src/hb-ot-font.cc | 8 +- src/hb-ot-hmtx-table.hh | 4 +- src/hb-ot-layout-common.hh | 4 +- src/hb-ot-var-avar-table.hh | 141 ++++++---- src/hb-ot-var-fvar-table.hh | 29 +- src/hb-ot-var.cc | 26 +- src/hb-paint-extents.cc | 14 +- src/hb-paint-extents.hh | 38 +-- src/hb-paint.hh | 70 ++--- src/hb-sanitize.hh | 18 +- src/hb-subset-plan-var.cc | 44 +++- src/hb-subset-plan.cc | 4 +- test/api/results-paint/test-106 | 14 +- test/api/results-paint/test-123 | 28 +- test/api/results-paint/testvf-106 | 14 +- test/api/results-paint/testvf-123 | 28 +- test/api/test-draw.c | 2 +- test/api/test-var-coords.c | 21 +- ...-Variable.default.all.wght=300,wdth=90.ttf | Bin 114296 -> 114292 bytes ...ne-unicode-ranges.all.wght=300,wdth=90.ttf | Bin 114296 -> 114292 bytes 37 files changed, 573 insertions(+), 481 deletions(-) diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index 448c1e4a0..a95a60d34 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh @@ -1075,9 +1075,9 @@ struct PaintTranslate float ddx = dx + c->instancer (varIdxBase, 0); float ddy = dy + c->instancer (varIdxBase, 1); - bool p1 = c->funcs->push_translate (c->data, ddx, ddy); + c->funcs->push_translate (c->data, ddx, ddy); c->recurse (this+src); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 14(noVar) or 15 (Var) */ @@ -1124,9 +1124,9 @@ struct PaintScale float sx = scaleX.to_float (c->instancer (varIdxBase, 0)); float sy = scaleY.to_float (c->instancer (varIdxBase, 1)); - bool p1 = c->funcs->push_scale (c->data, sx, sy); + c->funcs->push_scale (c->data, sx, sy); c->recurse (this+src); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 16 (noVar) or 17(Var) */ @@ -1177,13 +1177,9 @@ struct PaintScaleAroundCenter float tCenterX = centerX + c->instancer (varIdxBase, 2); float tCenterY = centerY + c->instancer (varIdxBase, 3); - bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY); - bool p2 = c->funcs->push_scale (c->data, sx, sy); - bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY); + c->funcs->push_scale_around_center (c->data, sx, sy, tCenterX, tCenterY); c->recurse (this+src); - if (p3) c->funcs->pop_transform (c->data); - if (p2) c->funcs->pop_transform (c->data); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 18 (noVar) or 19(Var) */ @@ -1228,9 +1224,9 @@ struct PaintScaleUniform TRACE_PAINT (this); float s = scale.to_float (c->instancer (varIdxBase, 0)); - bool p1 = c->funcs->push_scale (c->data, s, s); + c->funcs->push_scale (c->data, s, s); c->recurse (this+src); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 20 (noVar) or 21(Var) */ @@ -1278,13 +1274,9 @@ struct PaintScaleUniformAroundCenter float tCenterX = centerX + c->instancer (varIdxBase, 1); float tCenterY = centerY + c->instancer (varIdxBase, 2); - bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY); - bool p2 = c->funcs->push_scale (c->data, s, s); - bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY); + c->funcs->push_scale_around_center (c->data, s, s, tCenterX, tCenterY); c->recurse (this+src); - if (p3) c->funcs->pop_transform (c->data); - if (p2) c->funcs->pop_transform (c->data); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 22 (noVar) or 23(Var) */ @@ -1328,9 +1320,9 @@ struct PaintRotate TRACE_PAINT (this); float a = angle.to_float (c->instancer (varIdxBase, 0)); - bool p1 = c->funcs->push_rotate (c->data, a); + c->funcs->push_rotate (c->data, a); c->recurse (this+src); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 24 (noVar) or 25(Var) */ @@ -1378,13 +1370,9 @@ struct PaintRotateAroundCenter float tCenterX = centerX + c->instancer (varIdxBase, 1); float tCenterY = centerY + c->instancer (varIdxBase, 2); - bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY); - bool p2 = c->funcs->push_rotate (c->data, a); - bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY); + c->funcs->push_rotate_around_center (c->data, a, tCenterX, tCenterY); c->recurse (this+src); - if (p3) c->funcs->pop_transform (c->data); - if (p2) c->funcs->pop_transform (c->data); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 26 (noVar) or 27(Var) */ @@ -1432,9 +1420,9 @@ struct PaintSkew float sx = xSkewAngle.to_float(c->instancer (varIdxBase, 0)); float sy = ySkewAngle.to_float(c->instancer (varIdxBase, 1)); - bool p1 = c->funcs->push_skew (c->data, sx, sy); + c->funcs->push_skew (c->data, sx, sy); c->recurse (this+src); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 28(noVar) or 29 (Var) */ @@ -1485,13 +1473,9 @@ struct PaintSkewAroundCenter float tCenterX = centerX + c->instancer (varIdxBase, 2); float tCenterY = centerY + c->instancer (varIdxBase, 3); - bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY); - bool p2 = c->funcs->push_skew (c->data, sx, sy); - bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY); + c->funcs->push_skew_around_center (c->data, sx, sy, tCenterX, tCenterY); c->recurse (this+src); - if (p3) c->funcs->pop_transform (c->data); - if (p2) c->funcs->pop_transform (c->data); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } HBUINT8 format; /* format = 30(noVar) or 31 (Var) */ @@ -2693,7 +2677,8 @@ struct COLR { ItemVarStoreInstancer instancer (get_var_store_ptr (), get_delta_set_index_map_ptr (), - hb_array (font->coords, font->num_coords)); + hb_array (font->coords, + font->has_nonzero_coords ? font->num_coords : 0)); hb_paint_context_t c (this, funcs, data, font, palette_index, foreground, instancer); hb_decycler_node_t node (c.glyphs_decycler); diff --git a/src/OT/Layout/GPOS/AnchorFormat3.hh b/src/OT/Layout/GPOS/AnchorFormat3.hh index b5422652c..b683a0a0c 100644 --- a/src/OT/Layout/GPOS/AnchorFormat3.hh +++ b/src/OT/Layout/GPOS/AnchorFormat3.hh @@ -37,12 +37,12 @@ struct AnchorFormat3 *x = font->em_fscale_x (xCoordinate); *y = font->em_fscale_y (yCoordinate); - if ((font->x_ppem || font->num_coords) && xDeviceTable.sanitize (&c->sanitizer, this)) + if ((font->x_ppem || font->has_nonzero_coords) && xDeviceTable.sanitize (&c->sanitizer, this)) { hb_barrier (); *x += (this+xDeviceTable).get_x_delta (font, c->var_store, c->var_store_cache); } - if ((font->y_ppem || font->num_coords) && yDeviceTable.sanitize (&c->sanitizer, this)) + if ((font->y_ppem || font->has_nonzero_coords) && yDeviceTable.sanitize (&c->sanitizer, this)) { hb_barrier (); *y += (this+yDeviceTable).get_y_delta (font, c->var_store, c->var_store_cache); @@ -63,7 +63,7 @@ struct AnchorFormat3 hb_pair_t *new_varidx_delta; if (!c->plan->layout_variation_idx_delta_map.has (x_varidx, &new_varidx_delta)) return_trace (false); - + x_varidx = hb_first (*new_varidx_delta); int delta = hb_second (*new_varidx_delta); if (delta != 0) diff --git a/src/OT/Layout/GPOS/ValueFormat.hh b/src/OT/Layout/GPOS/ValueFormat.hh index 05bf364b5..89a5493f4 100644 --- a/src/OT/Layout/GPOS/ValueFormat.hh +++ b/src/OT/Layout/GPOS/ValueFormat.hh @@ -111,8 +111,8 @@ struct ValueFormat : HBUINT16 if (!has_device ()) return ret; - bool use_x_device = font->x_ppem || font->num_coords; - bool use_y_device = font->y_ppem || font->num_coords; + bool use_x_device = font->x_ppem || font->has_nonzero_coords; + bool use_y_device = font->y_ppem || font->has_nonzero_coords; if (!use_x_device && !use_y_device) return ret; diff --git a/src/OT/Var/VARC/VARC.cc b/src/OT/Var/VARC/VARC.cc index cd3813586..9e4fa3c24 100644 --- a/src/OT/Var/VARC/VARC.cc +++ b/src/OT/Var/VARC/VARC.cc @@ -13,7 +13,7 @@ namespace OT { struct hb_transforming_pen_context_t { - hb_transform_t transform; + hb_transform_t<> transform; hb_draw_funcs_t *dfuncs; void *data; hb_draw_state_t *st; @@ -130,7 +130,7 @@ hb_ubytes_t VarComponent::get_path_at (const hb_varc_context_t &c, hb_codepoint_t parent_gid, hb_array_t coords, - hb_transform_t total_transform, + hb_transform_t<> total_transform, hb_ubytes_t total_record, hb_scalar_cache_t *cache) const { @@ -216,7 +216,7 @@ VarComponent::get_path_at (const hb_varc_context_t &c, * limit on the max number of coords for now. */ if ((flags & (unsigned) flags_t::RESET_UNSPECIFIED_AXES) || coords.length > HB_VAR_COMPOSITE_MAX_AXES) - component_coords = hb_array (c.font->coords, c.font->num_coords); + component_coords = hb_array (c.font->coords, c.font->num_coords); // Transform @@ -226,28 +226,28 @@ VarComponent::get_path_at (const hb_varc_context_t &c, #define PROCESS_TRANSFORM_COMPONENTS \ HB_STMT_START { \ - PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TRANSLATE_X, translateX); \ - PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TRANSLATE_Y, translateY); \ - PROCESS_TRANSFORM_COMPONENT (F4DOT12, HAVE_ROTATION, rotation); \ - PROCESS_TRANSFORM_COMPONENT (F6DOT10, HAVE_SCALE_X, scaleX); \ - PROCESS_TRANSFORM_COMPONENT (F6DOT10, HAVE_SCALE_Y, scaleY); \ - PROCESS_TRANSFORM_COMPONENT (F4DOT12, HAVE_SKEW_X, skewX); \ - PROCESS_TRANSFORM_COMPONENT (F4DOT12, HAVE_SKEW_Y, skewY); \ - PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TCENTER_X, tCenterX); \ - PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TCENTER_Y, tCenterY); \ + PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TRANSLATE_X, translateX); \ + PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TRANSLATE_Y, translateY); \ + PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_ROTATION, rotation); \ + PROCESS_TRANSFORM_COMPONENT (F6DOT10, 1.0f, HAVE_SCALE_X, scaleX); \ + PROCESS_TRANSFORM_COMPONENT (F6DOT10, 1.0f, HAVE_SCALE_Y, scaleY); \ + PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_SKEW_X, skewX); \ + PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_SKEW_Y, skewY); \ + PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TCENTER_X, tCenterX); \ + PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TCENTER_Y, tCenterY); \ } HB_STMT_END - hb_transform_decomposed_t transform; + hb_transform_decomposed_t<> transform; // Read transform components -#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \ +#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ if (flags & (unsigned) flags_t::flag) \ { \ static_assert (type::static_size == HBINT16::static_size, ""); \ if (unlikely (unsigned (end - record) < HBINT16::static_size)) \ return hb_ubytes_t (); \ hb_barrier (); \ - transform.name = * (const HBINT16 *) record; \ + transform.name = mult * * (const HBINT16 *) record; \ record += HBINT16::static_size; \ } PROCESS_TRANSFORM_COMPONENTS; @@ -279,22 +279,22 @@ VarComponent::get_path_at (const hb_varc_context_t &c, { float transformValues[9]; unsigned numTransformValues = 0; -#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \ +#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ if (flags & (unsigned) flags_t::flag) \ - transformValues[numTransformValues++] = transform.name; + transformValues[numTransformValues++] = transform.name / mult; PROCESS_TRANSFORM_COMPONENTS; #undef PROCESS_TRANSFORM_COMPONENT varStore.get_delta (transformVarIdx, coords, hb_array (transformValues, numTransformValues), cache); numTransformValues = 0; -#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \ +#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ if (flags & (unsigned) flags_t::flag) \ - transform.name = transformValues[numTransformValues++]; + transform.name = transformValues[numTransformValues++] * mult; PROCESS_TRANSFORM_COMPONENTS; #undef PROCESS_TRANSFORM_COMPONENT } // Divide them by their divisors -#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \ +#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ if (flags & (unsigned) flags_t::flag) \ { \ HBINT16 int_v; \ @@ -334,7 +334,7 @@ bool VARC::get_path_at (const hb_varc_context_t &c, hb_codepoint_t glyph, hb_array_t coords, - hb_transform_t transform, + hb_transform_t<> transform, hb_codepoint_t parent_glyph, hb_scalar_cache_t *parent_cache) const { @@ -372,7 +372,7 @@ VARC::get_path_at (const hb_varc_context_t &c, #endif return false; - hb_extents_t comp_extents (glyph_extents); + hb_extents_t<> comp_extents (glyph_extents); transform.transform_extents (comp_extents); c.extents->union_ (comp_extents); } diff --git a/src/OT/Var/VARC/VARC.hh b/src/OT/Var/VARC/VARC.hh index 61222c3b7..a372701cd 100644 --- a/src/OT/Var/VARC/VARC.hh +++ b/src/OT/Var/VARC/VARC.hh @@ -32,7 +32,7 @@ struct hb_varc_context_t { hb_font_t *font; hb_draw_session_t *draw_session; - hb_extents_t *extents; + hb_extents_t<> *extents; mutable hb_decycler_t decycler; mutable signed edges_left; mutable signed depth_left; @@ -65,7 +65,7 @@ struct VarComponent get_path_at (const hb_varc_context_t &c, hb_codepoint_t parent_gid, hb_array_t coords, - hb_transform_t transform, + hb_transform_t<> transform, hb_ubytes_t record, hb_scalar_cache_t *cache = nullptr) const; }; @@ -76,7 +76,7 @@ struct VarCompositeGlyph get_path_at (const hb_varc_context_t &c, hb_codepoint_t gid, hb_array_t coords, - hb_transform_t transform, + hb_transform_t<> transform, hb_ubytes_t record, hb_scalar_cache_t *cache) { @@ -104,7 +104,7 @@ struct VARC get_path_at (const hb_varc_context_t &c, hb_codepoint_t gid, hb_array_t coords, - hb_transform_t transform = HB_TRANSFORM_IDENTITY, + hb_transform_t<> transform = HB_TRANSFORM_IDENTITY, hb_codepoint_t parent_gid = HB_CODEPOINT_INVALID, hb_scalar_cache_t *parent_cache = nullptr) const; @@ -129,7 +129,7 @@ struct VARC bool get_extents (hb_font_t *font, hb_codepoint_t gid, - hb_extents_t *extents, + hb_extents_t<> *extents, hb_varc_scratch_t &scratch) const { hb_varc_context_t c {font, @@ -196,7 +196,7 @@ struct VARC { if (!table->has_data ()) return false; - hb_extents_t f_extents; + hb_extents_t<> f_extents; auto *scratch = acquire_scratch (); if (unlikely (!scratch)) return true; diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index d9df24879..11ea66ce3 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -329,7 +329,7 @@ struct Glyph head_maxp_info->maxComponentDepth = hb_max (head_maxp_info->maxComponentDepth, depth); } - if (!coords) + if (!coords && font->has_nonzero_coords) coords = hb_array (font->coords, font->num_coords); contour_point_vector_t &points = type == SIMPLE ? all_points : scratch.comp_points; @@ -384,7 +384,7 @@ struct Glyph } #ifndef HB_NO_VAR - if (coords) + if (hb_any (coords)) { #ifndef HB_NO_BEYOND_64K if (glyf_accelerator.GVAR->has_data ()) diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index 159837c1a..77a60ca28 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -380,7 +380,7 @@ struct glyf_accelerator_t bool success = false; contour_point_t phantoms[glyf_impl::PHANTOM_COUNT]; - if (font->num_coords) + if (font->has_nonzero_coords) { hb_glyf_scratch_t scratch; success = get_points (font, gid, points_aggregator_t (font, nullptr, phantoms, false), @@ -434,7 +434,8 @@ struct glyf_accelerator_t bool get_extents (hb_font_t *font, hb_codepoint_t gid, hb_glyph_extents_t *extents) const - { return get_extents_at (font, gid, extents, hb_array (font->coords, font->num_coords)); } + { return get_extents_at (font, gid, extents, hb_array (font->coords, + font->has_nonzero_coords ? font->num_coords : 0)); } bool get_extents_at (hb_font_t *font, hb_codepoint_t gid, diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh index 790aae345..22871e30c 100644 --- a/src/hb-cff2-interp-cs.hh +++ b/src/hb-cff2-interp-cs.hh @@ -77,7 +77,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t coords = coords_; num_coords = num_coords_; varStore = acc.varStore; - do_blend = num_coords && coords && varStore->size; + do_blend = num_coords && varStore->size; set_ivs (acc.privateDicts[fd].ivs); } diff --git a/src/hb-coretext-shape.cc b/src/hb-coretext-shape.cc index c874d4956..ebd0bc132 100644 --- a/src/hb-coretext-shape.cc +++ b/src/hb-coretext-shape.cc @@ -73,9 +73,7 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font) return nullptr; } - unsigned num_axes = hb_ot_var_get_axis_count (face); - // https://github.com/harfbuzz/harfbuzz/issues/5163 - if (num_axes) + if (font->num_coords) { CFMutableDictionaryRef variations = CFDictionaryCreateMutable (kCFAllocatorDefault, @@ -83,15 +81,14 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font) &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - unsigned count = hb_max (num_axes, font->num_coords); + unsigned count = font->num_coords; for (unsigned i = 0; i < count; i++) { hb_ot_var_axis_info_t info; unsigned int c = 1; hb_ot_var_get_axis_infos (font->face, i, &c, &info); - float v = i < font->num_coords ? - hb_clamp (font->design_coords[i], info.min_value, info.max_value) : - info.default_value; + + float v = hb_clamp (font->design_coords[i], info.min_value, info.max_value); CFNumberRef tag_number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &info.tag); CFNumberRef value_number = CFNumberCreate (kCFAllocatorDefault, kCFNumberFloatType, &v); diff --git a/src/hb-draw.cc b/src/hb-draw.cc index eec3b0bb9..30ab86d33 100644 --- a/src/hb-draw.cc +++ b/src/hb-draw.cc @@ -63,14 +63,14 @@ hb_draw_quadratic_to_nil (hb_draw_funcs_t *dfuncs, void *draw_data, float to_x, float to_y, void *user_data HB_UNUSED) { -#define HB_ONE_THIRD 0.33333333f +#define HB_TWO_THIRD 0.66666666666666666666666667f dfuncs->emit_cubic_to (draw_data, *st, - (st->current_x + 2.f * control_x) * HB_ONE_THIRD, - (st->current_y + 2.f * control_y) * HB_ONE_THIRD, - (to_x + 2.f * control_x) * HB_ONE_THIRD, - (to_y + 2.f * control_y) * HB_ONE_THIRD, + st->current_x + (control_x - st->current_x) * HB_TWO_THIRD, + st->current_y + (control_y - st->current_y) * HB_TWO_THIRD, + to_x + (control_x - to_x) * HB_TWO_THIRD, + to_y + (control_y - to_y) * HB_TWO_THIRD, to_x, to_y); -#undef HB_ONE_THIRD +#undef HB_TWO_THIRD } static void @@ -277,7 +277,7 @@ hb_draw_funcs_destroy (hb_draw_funcs_t *dfuncs) * @destroy: (nullable): A callback to call when @data is not needed anymore * @replace: Whether to replace an existing data with the same key * - * Attaches a user-data key/data pair to the specified draw-functions structure. + * Attaches a user-data key/data pair to the specified draw-functions structure. * * Return value: `true` if success, `false` otherwise * @@ -467,7 +467,7 @@ hb_draw_extents_move_to (hb_draw_funcs_t *dfuncs HB_UNUSED, float to_x, float to_y, void *user_data HB_UNUSED) { - hb_extents_t *extents = (hb_extents_t *) data; + hb_extents_t<> *extents = (hb_extents_t<> *) data; extents->add_point (to_x, to_y); } @@ -479,7 +479,7 @@ hb_draw_extents_line_to (hb_draw_funcs_t *dfuncs HB_UNUSED, float to_x, float to_y, void *user_data HB_UNUSED) { - hb_extents_t *extents = (hb_extents_t *) data; + hb_extents_t<> *extents = (hb_extents_t<> *) data; extents->add_point (to_x, to_y); } @@ -492,7 +492,7 @@ hb_draw_extents_quadratic_to (hb_draw_funcs_t *dfuncs HB_UNUSED, float to_x, float to_y, void *user_data HB_UNUSED) { - hb_extents_t *extents = (hb_extents_t *) data; + hb_extents_t<> *extents = (hb_extents_t<> *) data; extents->add_point (control_x, control_y); extents->add_point (to_x, to_y); @@ -507,7 +507,7 @@ hb_draw_extents_cubic_to (hb_draw_funcs_t *dfuncs HB_UNUSED, float to_x, float to_y, void *user_data HB_UNUSED) { - hb_extents_t *extents = (hb_extents_t *) data; + hb_extents_t<> *extents = (hb_extents_t<> *) data; extents->add_point (control1_x, control1_y); extents->add_point (control2_x, control2_y); diff --git a/src/hb-font.cc b/src/hb-font.cc index 6cc731f63..417420404 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -1900,6 +1900,7 @@ DEFINE_NULL_INSTANCE (hb_font_t) = 0, /* ptem */ HB_FONT_NO_VAR_NAMED_INSTANCE, /* instance_index */ + false, /* has_nonzero_coords */ 0, /* num_coords */ nullptr, /* coords */ nullptr, /* design_coords */ @@ -1960,8 +1961,14 @@ hb_font_create (hb_face_t *face) hb_font_set_funcs_using (font, nullptr); #ifndef HB_NO_VAR - if (face && face->index >> 16) - hb_font_set_var_named_instance (font, (face->index >> 16) - 1); + // Initialize variations. + if (likely (face)) + { + if (face->index >> 16) + hb_font_set_var_named_instance (font, (face->index >> 16) - 1); + else + hb_font_set_variations (font, nullptr, 0); + } #endif return font; @@ -1979,6 +1986,7 @@ _hb_font_adopt_var_coords (hb_font_t *font, font->coords = coords; font->design_coords = design_coords; font->num_coords = coords_length; + font->has_nonzero_coords = hb_any (hb_array (coords, coords_length)); font->changed (); font->serial_coords = font->serial; @@ -2861,12 +2869,6 @@ hb_font_set_variations (hb_font_t *font, if (hb_object_is_immutable (font)) return; - if (!variations_length && font->instance_index == HB_FONT_NO_VAR_NAMED_INSTANCE) - { - hb_font_set_var_coords_normalized (font, nullptr, 0); - return; - } - const OT::fvar &fvar = *font->face->table.fvar; auto axes = fvar.get_axes (); const unsigned coords_length = axes.length; @@ -2973,7 +2975,6 @@ hb_font_set_variation (hb_font_t *font, hb_ot_var_normalize_coords (font->face, coords_length, design_coords, normalized); _hb_font_adopt_var_coords (font, normalized, design_coords, coords_length); - } /** @@ -2994,11 +2995,16 @@ hb_font_set_variation (hb_font_t *font, void hb_font_set_var_coords_design (hb_font_t *font, const float *coords, - unsigned int coords_length) + unsigned int input_coords_length) { if (hb_object_is_immutable (font)) return; + const OT::fvar &fvar = *font->face->table.fvar; + auto axes = fvar.get_axes (); + const unsigned coords_length = axes.length; + + input_coords_length = hb_min (input_coords_length, coords_length); int *normalized = coords_length ? (int *) hb_calloc (coords_length, sizeof (int)) : nullptr; float *design_coords = coords_length ? (float *) hb_calloc (coords_length, sizeof (float)) : nullptr; @@ -3009,8 +3015,11 @@ hb_font_set_var_coords_design (hb_font_t *font, return; } - if (coords_length) - hb_memcpy (design_coords, coords, coords_length * sizeof (font->design_coords[0])); + if (input_coords_length) + hb_memcpy (design_coords, coords, input_coords_length * sizeof (font->design_coords[0])); + // Fill in the rest with default values + for (unsigned int i = input_coords_length; i < coords_length; i++) + design_coords[i] = axes[i].get_default (); hb_ot_var_normalize_coords (font->face, coords_length, coords, normalized); _hb_font_adopt_var_coords (font, normalized, design_coords, coords_length); @@ -3075,34 +3084,31 @@ hb_font_get_var_named_instance (hb_font_t *font) void hb_font_set_var_coords_normalized (hb_font_t *font, const int *coords, /* 2.14 normalized */ - unsigned int coords_length) + unsigned int input_coords_length) { if (hb_object_is_immutable (font)) return; + const OT::fvar &fvar = *font->face->table.fvar; + auto axes = fvar.get_axes (); + unsigned coords_length = axes.length; + + input_coords_length = hb_min (input_coords_length, coords_length); int *copy = coords_length ? (int *) hb_calloc (coords_length, sizeof (coords[0])) : nullptr; - int *unmapped = coords_length ? (int *) hb_calloc (coords_length, sizeof (coords[0])) : nullptr; float *design_coords = coords_length ? (float *) hb_calloc (coords_length, sizeof (design_coords[0])) : nullptr; - if (unlikely (coords_length && !(copy && unmapped && design_coords))) + if (unlikely (coords_length && !(copy && design_coords))) { hb_free (copy); - hb_free (unmapped); hb_free (design_coords); return; } - if (coords_length) - { - hb_memcpy (copy, coords, coords_length * sizeof (coords[0])); - hb_memcpy (unmapped, coords, coords_length * sizeof (coords[0])); - } + if (input_coords_length) + hb_memcpy (copy, coords, input_coords_length * sizeof (coords[0])); - /* Best effort design coords simulation */ - font->face->table.avar->unmap_coords (unmapped, coords_length); for (unsigned int i = 0; i < coords_length; ++i) - design_coords[i] = font->face->table.fvar->unnormalize_axis_value (i, unmapped[i]); - hb_free (unmapped); + design_coords[i] = NAN; _hb_font_adopt_var_coords (font, copy, design_coords, coords_length); } @@ -3115,8 +3121,8 @@ hb_font_set_var_coords_normalized (hb_font_t *font, * Fetches the list of normalized variation coordinates currently * set on a font. * - * Note that this returned array may only contain values for some - * (or none) of the axes; omitted axes effectively have zero values. + * Note that if no variation coordinates are set, this function may + * return %NULL. * * Return value is valid as long as variation coordinates of the font * are not modified. @@ -3143,9 +3149,12 @@ hb_font_get_var_coords_normalized (hb_font_t *font, * Fetches the list of variation coordinates (in design-space units) currently * set on a font. * - * Note that this returned array may only contain values for some - * (or none) of the axes; omitted axes effectively have their default - * values. + * Note that if no variation coordinates are set, this function may + * return %NULL. + * + * If variations have been set on the font using normalized coordinates + * (i.e. via hb_font_set_var_coords_normalized()), the design coordinates will + * have NaN (Not a Number) values. * * Return value is valid as long as variation coordinates of the font * are not modified. diff --git a/src/hb-font.hh b/src/hb-font.hh index b64b19bc9..08f5d7c71 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -139,6 +139,7 @@ struct hb_font_t /* Font variation coordinates. */ unsigned int instance_index; + bool has_nonzero_coords; unsigned int num_coords; int *coords; float *design_coords; @@ -508,7 +509,7 @@ struct hb_font_t #endif #ifndef HB_NO_DRAW - hb_extents_t draw_extents; + hb_extents_t<> draw_extents; if (draw_glyph_or_fail (glyph, hb_draw_extents_get_funcs (), &draw_extents)) { diff --git a/src/hb-ft-colr.hh b/src/hb-ft-colr.hh index cb9e49854..1591c6b59 100644 --- a/src/hb-ft-colr.hh +++ b/src/hb-ft-colr.hh @@ -412,9 +412,9 @@ _hb_ft_paint (hb_ft_paint_context_t *c, float dx = paint.u.translate.dx / 65536.f; float dy = paint.u.translate.dy / 65536.f; - bool p1 = c->funcs->push_translate (c->data, dx, dy); + c->funcs->push_translate (c->data, dx, dy); c->recurse (paint.u.translate.paint); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } break; case FT_COLR_PAINTFORMAT_SCALE: @@ -424,13 +424,9 @@ _hb_ft_paint (hb_ft_paint_context_t *c, float sx = paint.u.scale.scale_x / 65536.f; float sy = paint.u.scale.scale_y / 65536.f; - bool p1 = c->funcs->push_translate (c->data, +dx, +dy); - bool p2 = c->funcs->push_scale (c->data, sx, sy); - bool p3 = c->funcs->push_translate (c->data, -dx, -dy); + c->funcs->push_scale_around_center (c->data, sx, sy, dx, dy); c->recurse (paint.u.scale.paint); - if (p3) c->funcs->pop_transform (c->data); - if (p2) c->funcs->pop_transform (c->data); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } break; case FT_COLR_PAINTFORMAT_ROTATE: @@ -439,13 +435,9 @@ _hb_ft_paint (hb_ft_paint_context_t *c, float dy = paint.u.rotate.center_y / 65536.f; float a = paint.u.rotate.angle / 65536.f; - bool p1 = c->funcs->push_translate (c->data, +dx, +dy); - bool p2 = c->funcs->push_rotate (c->data, a); - bool p3 = c->funcs->push_translate (c->data, -dx, -dy); + c->funcs->push_rotate_around_center (c->data, a, dx, dy); c->recurse (paint.u.rotate.paint); - if (p3) c->funcs->pop_transform (c->data); - if (p2) c->funcs->pop_transform (c->data); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } break; case FT_COLR_PAINTFORMAT_SKEW: @@ -455,13 +447,9 @@ _hb_ft_paint (hb_ft_paint_context_t *c, float sx = paint.u.skew.x_skew_angle / 65536.f; float sy = paint.u.skew.y_skew_angle / 65536.f; - bool p1 = c->funcs->push_translate (c->data, +dx, +dy); - bool p2 = c->funcs->push_skew (c->data, sx, sy); - bool p3 = c->funcs->push_translate (c->data, -dx, -dy); + c->funcs->push_skew_around_center (c->data, sx, sy, dx, dy); c->recurse (paint.u.skew.paint); - if (p3) c->funcs->pop_transform (c->data); - if (p2) c->funcs->pop_transform (c->data); - if (p1) c->funcs->pop_transform (c->data); + c->funcs->pop_transform (c->data); } break; case FT_COLR_PAINTFORMAT_COMPOSITE: diff --git a/src/hb-ft.cc b/src/hb-ft.cc index cb209ab8c..971f5078e 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -191,10 +191,10 @@ static void _hb_ft_hb_font_changed (hb_font_t *font, FT_Face ft_face) FT_Set_Transform (ft_face, nullptr, nullptr); #if defined(HAVE_FT_GET_VAR_BLEND_COORDINATES) && !defined(HB_NO_VAR) - unsigned int num_coords; - const float *coords = hb_font_get_var_coords_design (font, &num_coords); - if (num_coords) + if (font->has_nonzero_coords) { + unsigned int num_coords; + const float *coords = hb_font_get_var_coords_design (font, &num_coords); FT_Fixed *ft_coords = (FT_Fixed *) hb_calloc (num_coords, sizeof (FT_Fixed)); if (ft_coords) { @@ -204,7 +204,7 @@ static void _hb_ft_hb_font_changed (hb_font_t *font, FT_Face ft_face) hb_free (ft_coords); } } - else if (num_coords) + else if (font->num_coords) { // Some old versions of FreeType crash if we // call this function on non-variable fonts. @@ -1381,7 +1381,7 @@ hb_ft_font_changed (hb_font_t *font) for (unsigned int i = 0; i < mm_var->num_axis; ++i) { - coords[i] = ft_coords[i] >>= 2; + coords[i] = (ft_coords[i] + 2) >> 2; nonzero = nonzero || coords[i]; } diff --git a/src/hb-geometry.hh b/src/hb-geometry.hh index c22a26a40..60f4e692c 100644 --- a/src/hb-geometry.hh +++ b/src/hb-geometry.hh @@ -26,7 +26,10 @@ #include "hb.hh" +#include "hb-algs.hh" + +template struct hb_extents_t { hb_extents_t () {} @@ -35,7 +38,7 @@ struct hb_extents_t ymin (hb_min (extents.y_bearing, extents.y_bearing + extents.height)), xmax (hb_max (extents.x_bearing, extents.x_bearing + extents.width)), ymax (hb_max (extents.y_bearing, extents.y_bearing + extents.height)) {} - hb_extents_t (float xmin, float ymin, float xmax, float ymax) : + hb_extents_t (Float xmin, Float ymin, Float xmax, Float ymax) : xmin (xmin), ymin (ymin), xmax (xmax), ymax (ymax) {} bool is_empty () const { return xmin >= xmax || ymin >= ymax; } @@ -69,7 +72,7 @@ struct hb_extents_t } void - add_point (float x, float y) + add_point (Float x, Float y) { if (unlikely (is_void ())) { @@ -97,62 +100,69 @@ struct hb_extents_t yneg ? y1 - y0 : y0 - y1}; } - float xmin = 0.f; - float ymin = 0.f; - float xmax = -1.f; - float ymax = -1.f; + Float xmin = 0; + Float ymin = 0; + Float xmax = -1; + Float ymax = -1; }; +template struct hb_transform_t { hb_transform_t () {} - hb_transform_t (float xx, float yx, - float xy, float yy, - float x0, float y0) : + hb_transform_t (Float xx, Float yx, + Float xy, Float yy, + Float x0, Float y0) : xx (xx), yx (yx), xy (xy), yy (yy), x0 (x0), y0 (y0) {} bool is_identity () const { - return xx == 1.f && yx == 0.f && - xy == 0.f && yy == 1.f && - x0 == 0.f && y0 == 0.f; + return xx == 1 && yx == 0 && + xy == 0 && yy == 1 && + x0 == 0 && y0 == 0; + } + bool is_translation () const + { + return xx == 1 && yx == 0 && + xy == 0 && yy == 1; } - void multiply (const hb_transform_t &o) + void multiply (const hb_transform_t &o, bool before=false) { - /* Copied from cairo, with "o" being "a" there and "this" being "b" there. */ - hb_transform_t r; - - r.xx = o.xx * xx + o.yx * xy; - r.yx = o.xx * yx + o.yx * yy; - - r.xy = o.xy * xx + o.yy * xy; - r.yy = o.xy * yx + o.yy * yy; - - r.x0 = o.x0 * xx + o.y0 * xy + x0; - r.y0 = o.x0 * yx + o.y0 * yy + y0; - - *this = r; + // Copied from cairo-matrix.c + const hb_transform_t &a = before ? o : *this; + const hb_transform_t &b = before ? *this : o; + *this = { + a.xx * b.xx + a.xy * b.yx, + a.yx * b.xx + a.yy * b.yx, + a.xx * b.xy + a.xy * b.yy, + a.yx * b.xy + a.yy * b.yy, + a.xx * b.x0 + a.xy * b.y0 + a.x0, + a.yx * b.x0 + a.yy * b.y0 + a.y0 + }; } - void transform_distance (float &dx, float &dy) const + HB_ALWAYS_INLINE + void transform_distance (Float &dx, Float &dy) const { - float new_x = xx * dx + xy * dy; - float new_y = yx * dx + yy * dy; + Float new_x = xx * dx + xy * dy; + Float new_y = yx * dx + yy * dy; dx = new_x; dy = new_y; } - void transform_point (float &x, float &y) const + HB_ALWAYS_INLINE + void transform_point (Float &x, Float &y) const { - transform_distance (x, y); - x += x0; - y += y0; + Float new_x = x0 + xx * x + xy * y; + Float new_y = y0 + yx * x + yy * y; + x = new_x; + y = new_y; } - void transform_extents (hb_extents_t &extents) const + void transform_extents (hb_extents_t &extents) const { - float quad_x[4], quad_y[4]; + Float quad_x[4], quad_y[4]; quad_x[0] = extents.xmin; quad_y[0] = extents.ymin; @@ -163,7 +173,7 @@ struct hb_transform_t quad_x[3] = extents.xmax; quad_y[3] = extents.ymax; - extents = hb_extents_t {}; + extents = hb_extents_t {}; for (unsigned i = 0; i < 4; i++) { transform_point (quad_x[i], quad_y[i]); @@ -171,20 +181,36 @@ struct hb_transform_t } } - void transform (const hb_transform_t &o) { multiply (o); } + void transform (const hb_transform_t &o, bool before=false) { multiply (o, before); } - void translate (float x, float y) + static hb_transform_t translation (Float x, Float y) { - if (x == 0.f && y == 0.f) - return; + return {1, 0, 0, 1, x, y}; + } + void translate (Float x, Float y, bool before=false) + { + if (before) + { + x0 += x; + y0 += y; + } + else + { + if (x == 0 && y == 0) + return; - x0 += xx * x + xy * y; - y0 += yx * x + yy * y; + x0 += xx * x + xy * y; + y0 += yx * x + yy * y; + } } - void scale (float scaleX, float scaleY) + static hb_transform_t scaling (Float scaleX, Float scaleY) { - if (scaleX == 1.f && scaleY == 1.f) + return {scaleX, 0, 0, scaleY, 0, 0}; + } + void scale (Float scaleX, Float scaleY) + { + if (scaleX == 1 && scaleY == 1) return; xx *= scaleX; @@ -192,52 +218,94 @@ struct hb_transform_t xy *= scaleY; yy *= scaleY; } - - void rotate (float rotation) + static hb_transform_t scaling_around_center (Float scaleX, Float scaleY, Float center_x, Float center_y) { - if (rotation == 0.f) + return {scaleX, 0, 0, scaleY, + center_x ? (1 - scaleX) * center_x : 0, + center_y ? (1 - scaleY) * center_y : 0}; + } + void scale_around_center (Float scaleX, Float scaleY, Float center_x, Float center_y) + { + if (scaleX == 1 && scaleY == 1) return; + transform (scaling_around_center (scaleX, scaleY, center_x, center_y)); + } + + static hb_transform_t rotation (Float radians) + { // https://github.com/fonttools/fonttools/blob/f66ee05f71c8b57b5f519ee975e95edcd1466e14/Lib/fontTools/misc/transform.py#L240 - rotation = rotation * HB_PI; - float c; - float s; -#ifdef HAVE_SINCOSF - sincosf (rotation, &s, &c); -#else - c = cosf (rotation); - s = sinf (rotation); -#endif - auto other = hb_transform_t{c, s, -s, c, 0.f, 0.f}; - transform (other); + Float c; + Float s; + hb_sincos (radians, s, c); + return {c, s, -s, c, 0, 0}; } - - void skew (float skewX, float skewY) + void rotate (Float radians, bool before=false) { - if (skewX == 0.f && skewY == 0.f) + if (radians == 0) return; - // https://github.com/fonttools/fonttools/blob/f66ee05f71c8b57b5f519ee975e95edcd1466e14/Lib/fontTools/misc/transform.py#L255 - skewX = skewX * HB_PI; - skewY = skewY * HB_PI; - auto other = hb_transform_t{1.f, - skewY ? tanf (skewY) : 0.f, - skewX ? tanf (skewX) : 0.f, - 1.f, - 0.f, 0.f}; - transform (other); + transform (rotation (radians), before); } - float xx = 1.f; - float yx = 0.f; - float xy = 0.f; - float yy = 1.f; - float x0 = 0.f; - float y0 = 0.f; + static hb_transform_t rotation_around_center (Float radians, Float center_x, Float center_y) + { + Float s, c; + hb_sincos (radians, s, c); + return { + c, s, -s, c, + (1 - c) * center_x + s * center_y, + -s * center_x + (1 - c) * center_y + }; + } + void rotate_around_center (Float radians, Float center_x, Float center_y, bool before=false) + { + if (radians == 0) + return; + + transform (rotation_around_center (radians, center_x, center_y), before); + } + + static hb_transform_t skewing (Float skewX, Float skewY) + { + return {1, skewY ? tanf (skewY) : 0, skewX ? tanf (skewX) : 0, 1, 0, 0}; + } + void skew (Float skewX, Float skewY) + { + if (skewX == 0 && skewY == 0) + return; + + transform (skewing (skewX, skewY)); + } + static hb_transform_t skewing_around_center (Float skewX, Float skewY, Float center_x, Float center_y) + { + skewX = skewX ? tanf (skewX) : 0; + skewY = skewY ? tanf (skewY) : 0; + return { + 1, skewY, skewX, 1, + center_y ? -skewX * center_y : 0, + center_x ? -skewY * center_x : 0 + }; + } + void skew_around_center (Float skewX, Float skewY, Float center_x, Float center_y) + { + if (skewX == 0 && skewY == 0) + return; + + transform (skewing_around_center (skewX, skewY, center_x, center_y)); + } + + Float xx = 1; + Float yx = 0; + Float xy = 0; + Float yy = 1; + Float x0 = 0; + Float y0 = 0; }; -#define HB_TRANSFORM_IDENTITY hb_transform_t{1.f, 0.f, 0.f, 1.f, 0.f, 0.f} +#define HB_TRANSFORM_IDENTITY {1, 0, 0, 1, 0, 0} +template struct hb_bounds_t { enum status_t { @@ -247,7 +315,7 @@ struct hb_bounds_t }; hb_bounds_t (status_t status = UNBOUNDED) : status (status) {} - hb_bounds_t (const hb_extents_t &extents) : + hb_bounds_t (const hb_extents_t &extents) : status (extents.is_empty () ? EMPTY : BOUNDED), extents (extents) {} void union_ (const hb_bounds_t &o) @@ -281,20 +349,21 @@ struct hb_bounds_t } status_t status; - hb_extents_t extents; + hb_extents_t extents; }; +template struct hb_transform_decomposed_t { - float translateX = 0; - float translateY = 0; - float rotation = 0; // in degrees, counter-clockwise - float scaleX = 1; - float scaleY = 1; - float skewX = 0; // in degrees, counter-clockwise - float skewY = 0; // in degrees, counter-clockwise - float tCenterX = 0; - float tCenterY = 0; + Float translateX = 0; + Float translateY = 0; + Float rotation = 0; // in radians, counter-clockwise + Float scaleX = 1; + Float scaleY = 1; + Float skewX = 0; // in radians, counter-clockwise + Float skewY = 0; // in radians, counter-clockwise + Float tCenterX = 0; + Float tCenterY = 0; operator bool () const { @@ -305,9 +374,9 @@ struct hb_transform_decomposed_t tCenterX || tCenterY; } - hb_transform_t to_transform () const + hb_transform_t to_transform () const { - hb_transform_t t; + hb_transform_t t; t.translate (translateX + tCenterX, translateY + tCenterY); t.rotate (rotation); t.scale (scaleX, scaleY); diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 4b76f91c7..4916765e8 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -66,13 +66,15 @@ static inline Type& StructAtOffsetUnaligned(void *P, unsigned int offset) } /* StructAfter(X) returns the struct T& that is placed after X. - * Works with X of variable size also. X must implement get_size() */ -template -static inline const Type& StructAfter(const TObject &X) -{ return StructAtOffset(&X, X.get_size()); } -template -static inline Type& StructAfter(TObject &X) -{ return StructAtOffset(&X, X.get_size()); } + * Works with X of variable size also. X must implement get_size(). + * Any extra arguments are forwarded to get_size, so for example + * it can work with UnsizedArrayOf<> as well. */ +template +static inline const Type& StructAfter(const TObject &X, Ts... args) +{ return StructAtOffset(&X, X.get_size(args...)); } +template +static inline Type& StructAfter(TObject &X, Ts... args) +{ return StructAtOffset(&X, X.get_size(args...)); } /* @@ -132,7 +134,6 @@ static inline Type& StructAfter(TObject &X) DEFINE_SIZE_ARRAY(size, array) - /* * Lazy loaders. * diff --git a/src/hb-ot-cff2-table.cc b/src/hb-ot-cff2-table.cc index 4157bd3b5..bec1397ed 100644 --- a/src/hb-ot-cff2-table.cc +++ b/src/hb-ot-cff2-table.cc @@ -202,7 +202,11 @@ struct cff2_cs_opset_path_t : cff2_cs_opset_tcoords, font->num_coords)); + return get_path_at (font, + glyph, + draw_session, + hb_array (font->coords, + font->has_nonzero_coords ? font->num_coords : 0)); } bool OT::cff2::accelerator_t::get_path_at (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session, hb_array_t coords) const diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 9cc7d2554..c9d88a36b 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -297,11 +297,11 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, ot_font->check_serial (font); const OT::HVAR &HVAR = *hmtx.var_table; const OT::ItemVariationStore &varStore = &HVAR + HVAR.varStore; - OT::hb_scalar_cache_t *varStore_cache = ot_font->h.acquire_varStore_cache (varStore); + OT::hb_scalar_cache_t *varStore_cache = font->has_nonzero_coords ? ot_font->h.acquire_varStore_cache (varStore) : nullptr; hb_ot_font_advance_cache_t *advance_cache = nullptr; - bool use_cache = font->num_coords; + bool use_cache = font->has_nonzero_coords; if (use_cache) { advance_cache = ot_font->h.acquire_advance_cache (); @@ -361,7 +361,7 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data, ot_font->check_serial (font); const OT::VVAR &VVAR = *vmtx.var_table; const OT::ItemVariationStore &varStore = &VVAR + VVAR.varStore; - OT::hb_scalar_cache_t *varStore_cache = ot_font->v.acquire_varStore_cache (varStore); + OT::hb_scalar_cache_t *varStore_cache = font->has_nonzero_coords ? ot_font->v.acquire_varStore_cache (varStore) : nullptr; // TODO Use advance_cache. for (unsigned int i = 0; i < count; i++) @@ -411,7 +411,7 @@ hb_ot_get_glyph_v_origin (hb_font_t *font, #ifndef HB_NO_VAR const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx; const OT::VVAR &VVAR = *vmtx.var_table; - if (font->num_coords) + if (font->has_nonzero_coords) VVAR.get_vorg_delta_unscaled (glyph, font->coords, font->num_coords, &delta); diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 710ea93f3..5a06898ba 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -347,7 +347,7 @@ struct hmtxvmtx hb_codepoint_t glyph, int *lsb) const { - if (!font->num_coords) + if (!font->has_nonzero_coords) return get_leading_bearing_without_var_unscaled (glyph, lsb); #ifndef HB_NO_VAR @@ -409,7 +409,7 @@ struct hmtxvmtx unsigned int advance = get_advance_without_var_unscaled (glyph); #ifndef HB_NO_VAR - if (unlikely (glyph >= num_bearings) || !font->num_coords) + if (unlikely (glyph >= num_bearings) || !font->has_nonzero_coords) return advance; if (var_table.get_length ()) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 2df0cc6b4..26bf84b68 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -4840,12 +4840,12 @@ struct VariationDevice hb_position_t get_x_delta (hb_font_t *font, const ItemVariationStore &store, hb_scalar_cache_t *store_cache = nullptr) const - { return !font->num_coords ? 0 : font->em_scalef_x (get_delta (font, store, store_cache)); } + { return !font->has_nonzero_coords ? 0 : font->em_scalef_x (get_delta (font, store, store_cache)); } hb_position_t get_y_delta (hb_font_t *font, const ItemVariationStore &store, hb_scalar_cache_t *store_cache = nullptr) const - { return !font->num_coords ? 0 : font->em_scalef_y (get_delta (font, store, store_cache)); } + { return !font->has_nonzero_coords ? 0 : font->em_scalef_y (get_delta (font, store, store_cache)); } VariationDevice* copy (hb_serialize_context_t *c, const hb_hashmap_t> *layout_variation_idx_delta_map) const diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index 75ea338e2..a0c2a21bd 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -143,10 +143,13 @@ struct AxisValueMap struct SegmentMaps : Array16Of { - int map (int value, unsigned int from_offset = 0, unsigned int to_offset = 1) const + float map_float (float value, unsigned int from_offset = 0, unsigned int to_offset = 1) const { -#define fromCoord coords[from_offset].to_int () -#define toCoord coords[to_offset].to_int () +#define fromCoord coords[from_offset].to_float () +#define toCoord coords[to_offset].to_float () + + const auto *map = arrayZ; + /* The following special-cases are not part of OpenType, which requires * that at least -1, 0, and +1 must be mapped. But we include these as * part of a better error recovery scheme. */ @@ -155,47 +158,98 @@ struct SegmentMaps : Array16Of if (!len) return value; else /* len == 1*/ - return value - arrayZ[0].fromCoord + arrayZ[0].toCoord; + return value - map[0].fromCoord + map[0].toCoord; } - if (value <= arrayZ[0].fromCoord) - return value - arrayZ[0].fromCoord + arrayZ[0].toCoord; + // At least two mappings now. - unsigned int i; - unsigned int count = len - 1; - for (i = 1; i < count && value > arrayZ[i].fromCoord; i++) - ; + /* CoreText is wild... + * PingFangUI avar needs all this special-casing... + * So we implement an extended version of the spec here, + * which is more robust and more likely to be compatible with + * the wild. */ - if (value >= arrayZ[i].fromCoord) - return value - arrayZ[i].fromCoord + arrayZ[i].toCoord; + unsigned start = 0; + unsigned end = len; + if (map[start].fromCoord == -1 && map[start].toCoord == -1 and map[start+1].fromCoord == -1) + start++; + if (map[end-1].fromCoord == +1 && map[end-1].toCoord == +1 and map[end-2].fromCoord == +1) + end--; - if (unlikely (arrayZ[i-1].fromCoord == arrayZ[i].fromCoord)) - return arrayZ[i-1].toCoord; + /* Look for exact match first, and do lots of special-casing. */ + unsigned i; + for (i = start; i < end; i++) + if (value == map[i].fromCoord) + break; + if (i < end) + { + // There's at least one exact match. See if there are more. + unsigned j = i; + for (; j + 1 < end; j++) + if (value != map[j + 1].fromCoord) + break; + + // [i,j] inclusive are all exact matches: + + // If there's only one, return it. This is the only spec-compliant case. + if (i == j) + return map[i].toCoord; + // If there's exactly three, return the middle one. + if (i + 2 == j) + return map[i + 1].toCoord; + + // Ignore the middle ones. Return the one mapping closer to 0. + if (value < 0) return map[j].toCoord; + if (value > 0) return map[i].toCoord; + + // Mapping 0? CoreText seems confused. It seems to prefer 0 here... + // So we'll just return the smallest one. lol + return fabsf (map[i].toCoord) < fabsf (map[j].toCoord) ? map[i].toCoord : map[j].toCoord; + + // Mapping 0? Return one not mapping to 0. + if (map[i].toCoord == 0) + return map[j].toCoord; + else + return map[i].toCoord; + } + + /* There's at least two and we're not an exact match. Prepare to lerp. */ + + // Find the segment we're in. + for (i = start; i < end; i++) + if (value < map[i].fromCoord) + break; + + if (i == 0) + { + // Value before all segments; Shift. + return value - map[0].fromCoord + map[0].toCoord; + } + if (i == end) + { + // Value after all segments; Shift. + return value - map[end - 1].fromCoord + map[end - 1].toCoord; + } + + // Actually interpolate. + auto &before = map[i-1]; + auto &after = map[i]; + float denom = after.fromCoord - before.fromCoord; // Can't be zero by now. + return before.toCoord + ((after.toCoord - before.toCoord) * (value - before.fromCoord)) / denom; - int denom = arrayZ[i].fromCoord - arrayZ[i-1].fromCoord; - return roundf (arrayZ[i-1].toCoord + ((float) (arrayZ[i].toCoord - arrayZ[i-1].toCoord) * - (value - arrayZ[i-1].fromCoord)) / denom); #undef toCoord #undef fromCoord } - int unmap (int value) const { return map (value, 1, 0); } + float unmap_float (float value) const { return map_float (value, 1, 0); } + + // TODO Kill this. Triple unmap_axis_range (const Triple& axis_range) const { - F2DOT14 val, unmapped_val; - - val.set_float (axis_range.minimum); - unmapped_val.set_int (unmap (val.to_int ())); - float unmapped_min = unmapped_val.to_float (); - - val.set_float (axis_range.middle); - unmapped_val.set_int (unmap (val.to_int ())); - float unmapped_middle = unmapped_val.to_float (); - - val.set_float (axis_range.maximum); - unmapped_val.set_int (unmap (val.to_int ())); - float unmapped_max = unmapped_val.to_float (); + float unmapped_min = unmap_float (axis_range.minimum); + float unmapped_middle = unmap_float (axis_range.middle); + float unmapped_max = unmap_float (axis_range.maximum); return Triple{(double) unmapped_min, (double) unmapped_middle, (double) unmapped_max}; } @@ -203,6 +257,11 @@ struct SegmentMaps : Array16Of bool subset (hb_subset_context_t *c, hb_tag_t axis_tag) const { TRACE_SUBSET (this); + + /* This function cannot work on avar2 table (and currently doesn't). + * We should instead keep the design coords in the shape plan and use + * those. unmap_axis_range needs to be killed. */ + /* avar mapped normalized axis range*/ Triple *axis_range; if (!c->plan->axes_location.has (axis_tag, &axis_range)) @@ -304,14 +363,14 @@ struct avar return_trace (true); } - void map_coords (int *coords, unsigned int coords_length) const + void map_coords_16_16 (int *coords, unsigned int coords_length) const { unsigned int count = hb_min (coords_length, axisCount); const SegmentMaps *map = &firstAxisSegmentMaps; for (unsigned int i = 0; i < count; i++) { - coords[i] = map->map (coords[i]); + coords[i] = roundf (map->map_float (coords[i] / 65536.f) * 65536.f); map = &StructAfter (*map); } @@ -336,8 +395,8 @@ struct avar int v = coords[i]; uint32_t varidx = varidx_map.map (i); float delta = var_store.get_delta (varidx, coords, coords_length, var_store_cache); - v += roundf (delta); - v = hb_clamp (v, -(1<<14), +(1<<14)); + v += roundf (delta * 4); // 2.14 -> 16.16 + v = hb_clamp (v, -(1<<16), +(1<<16)); out.push (v); } for (unsigned i = 0; i < coords_length; i++) @@ -347,18 +406,6 @@ struct avar #endif } - void unmap_coords (int *coords, unsigned int coords_length) const - { - unsigned int count = hb_min (coords_length, axisCount); - - const SegmentMaps *map = &firstAxisSegmentMaps; - for (unsigned int i = 0; i < count; i++) - { - coords[i] = map->unmap (coords[i]); - map = &StructAfter (*map); - } - } - bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 2cd9afbb7..4b4410f9b 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -78,7 +78,7 @@ struct InstanceRecord return false; if (!axes_location->has (*axis_tag)) continue; - + Triple axis_limit = axes_location->get (*axis_tag); if (!axis_coord_pinned_or_within_axis_range (coords, i, axis_limit)) return false; @@ -106,7 +106,7 @@ struct InstanceRecord { if (!axis_coord_pinned_or_within_axis_range (coords, i, *axis_limit)) return_trace (false); - + //skip pinned axis if (axis_limit->is_point ()) continue; @@ -179,7 +179,7 @@ struct AxisRecord hb_tag_t get_axis_tag () const { return axisTag; } - int normalize_axis_value (float v) const + float normalize_axis_value (float v) const { float min_value, default_value, max_value; get_coordinates (min_value, default_value, max_value); @@ -189,23 +189,9 @@ struct AxisRecord if (v == default_value) return 0; else if (v < default_value) - v = (v - default_value) / (default_value - min_value); + return (v - default_value) / (default_value - min_value); else - v = (v - default_value) / (max_value - default_value); - return roundf (v * 16384.f); - } - - float unnormalize_axis_value (int v) const - { - float min_value, default_value, max_value; - get_coordinates (min_value, default_value, max_value); - - if (v == 0) - return default_value; - else if (v < 0) - return v * (default_value - min_value) / 16384.f + default_value; - else - return v * (max_value - default_value) / 16384.f + default_value; + return (v - default_value) / (max_value - default_value); } hb_ot_name_id_t get_name_id () const { return axisNameID; } @@ -341,12 +327,9 @@ struct fvar return axes.lfind (tag, &i) && ((void) axes[i].get_axis_info (i, info), true); } - int normalize_axis_value (unsigned int axis_index, float v) const + float normalize_axis_value (unsigned int axis_index, float v) const { return get_axes ()[axis_index].normalize_axis_value (v); } - float unnormalize_axis_value (unsigned int axis_index, int v) const - { return get_axes ()[axis_index].unnormalize_axis_value (v); } - unsigned int get_instance_count () const { return instanceCount; } hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int instance_index) const diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index 45424f799..72ef9fbbd 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -70,7 +70,7 @@ hb_ot_var_has_data (hb_face_t *face) * hb_ot_var_get_axis_count: * @face: The #hb_face_t to work on * - * Fetches the number of OpenType variation axes included in the face. + * Fetches the number of OpenType variation axes included in the face. * * Return value: the number of variation axes defined * @@ -183,7 +183,7 @@ hb_ot_var_find_axis_info (hb_face_t *face, * hb_ot_var_get_named_instance_count: * @face: The #hb_face_t to work on * - * Fetches the number of named instances included in the face. + * Fetches the number of named instances included in the face. * * Return value: the number of named instances defined * @@ -263,7 +263,7 @@ hb_ot_var_named_instance_get_design_coords (hb_face_t *face, * @face: The #hb_face_t to work on * @variations: The array of variations to normalize * @variations_length: The number of variations to normalize - * @coords: (out) (array length=coords_length): The array of normalized coordinates + * @coords: (out) (array length=coords_length): The array of normalized coordinates * @coords_length: The length of the coordinate array * * Normalizes all of the coordinates in the given list of variation axes. @@ -286,10 +286,14 @@ hb_ot_var_normalize_variations (hb_face_t *face, hb_ot_var_axis_info_t info; if (hb_ot_var_find_axis_info (face, variations[i].tag, &info) && info.axis_index < coords_length) - coords[info.axis_index] = fvar.normalize_axis_value (info.axis_index, variations[i].value); + coords[info.axis_index] = roundf (fvar.normalize_axis_value (info.axis_index, variations[i].value) * 65536.0f); } - face->table.avar->map_coords (coords, coords_length); + face->table.avar->map_coords_16_16 (coords, coords_length); + + // Round to 2.14 + for (unsigned i = 0; i < coords_length; i++) + coords[i] = (coords[i] + 2) >> 2; } /** @@ -309,6 +313,10 @@ hb_ot_var_normalize_variations (hb_face_t *face, * Any additional scaling defined in the face's `avar` table is also * applied, as described at https://docs.microsoft.com/en-us/typography/opentype/spec/avar * + * Note: @coords_length must be the same as the number of axes in the face, as + * for example returned by hb_ot_var_get_axis_count(). + * Otherwise, the behavior is undefined. + * * Since: 1.4.2 **/ void @@ -319,9 +327,13 @@ hb_ot_var_normalize_coords (hb_face_t *face, { const OT::fvar &fvar = *face->table.fvar; for (unsigned int i = 0; i < coords_length; i++) - normalized_coords[i] = fvar.normalize_axis_value (i, design_coords[i]); + normalized_coords[i] = roundf (fvar.normalize_axis_value (i, design_coords[i]) * 65536.0f); - face->table.avar->map_coords (normalized_coords, coords_length); + face->table.avar->map_coords_16_16 (normalized_coords, coords_length); + + // Round to 2.14 + for (unsigned i = 0; i < coords_length; i++) + normalized_coords[i] = (normalized_coords[i] + 2) >> 2; } diff --git a/src/hb-paint-extents.cc b/src/hb-paint-extents.cc index 35dcb76f2..11339a76a 100644 --- a/src/hb-paint-extents.cc +++ b/src/hb-paint-extents.cc @@ -49,7 +49,7 @@ hb_paint_extents_push_transform (hb_paint_funcs_t *funcs HB_UNUSED, { hb_paint_extents_context_t *c = (hb_paint_extents_context_t *) paint_data; - c->push_transform (hb_transform_t {xx, yx, xy, yy, dx, dy}); + c->push_transform (hb_transform_t<> {xx, yx, xy, yy, dx, dy}); } static void @@ -71,7 +71,7 @@ hb_paint_extents_push_clip_glyph (hb_paint_funcs_t *funcs HB_UNUSED, { hb_paint_extents_context_t *c = (hb_paint_extents_context_t *) paint_data; - hb_extents_t extents; + hb_extents_t<> extents; hb_draw_funcs_t *draw_extent_funcs = hb_draw_extents_get_funcs (); hb_font_draw_glyph (font, glyph, draw_extent_funcs, &extents); c->push_clip (extents); @@ -85,7 +85,7 @@ hb_paint_extents_push_clip_rectangle (hb_paint_funcs_t *funcs HB_UNUSED, { hb_paint_extents_context_t *c = (hb_paint_extents_context_t *) paint_data; - hb_extents_t extents = {xmin, ymin, xmax, ymax}; + hb_extents_t<> extents = {xmin, ymin, xmax, ymax}; c->push_clip (extents); } @@ -136,10 +136,10 @@ hb_paint_extents_paint_image (hb_paint_funcs_t *funcs HB_UNUSED, if (!glyph_extents) return false; // Happens with SVG images. - hb_extents_t extents = {(float) glyph_extents->x_bearing, - (float) glyph_extents->y_bearing + glyph_extents->height, - (float) glyph_extents->x_bearing + glyph_extents->width, - (float) glyph_extents->y_bearing}; + hb_extents_t<> extents = {(float) glyph_extents->x_bearing, + (float) glyph_extents->y_bearing + glyph_extents->height, + (float) glyph_extents->x_bearing + glyph_extents->width, + (float) glyph_extents->y_bearing}; c->push_clip (extents); c->paint (); c->pop_clip (); diff --git a/src/hb-paint-extents.hh b/src/hb-paint-extents.hh index 708af4a86..0e18e3f8a 100644 --- a/src/hb-paint-extents.hh +++ b/src/hb-paint-extents.hh @@ -41,9 +41,9 @@ struct hb_paint_extents_context_t clips.clear (); groups.clear (); - transforms.push (hb_transform_t{}); - clips.push (hb_bounds_t{hb_bounds_t::UNBOUNDED}); - groups.push (hb_bounds_t{hb_bounds_t::EMPTY}); + transforms.push (hb_transform_t<>{}); + clips.push (hb_bounds_t<>{hb_bounds_t<>::UNBOUNDED}); + groups.push (hb_bounds_t<>{hb_bounds_t<>::EMPTY}); } hb_paint_extents_context_t () @@ -51,19 +51,19 @@ struct hb_paint_extents_context_t clear (); } - hb_extents_t get_extents () + hb_extents_t<> get_extents () { return groups.tail().extents; } bool is_bounded () { - return groups.tail().status != hb_bounds_t::UNBOUNDED; + return groups.tail().status != hb_bounds_t<>::UNBOUNDED; } - void push_transform (const hb_transform_t &trans) + void push_transform (const hb_transform_t<> &trans) { - hb_transform_t t = transforms.tail (); + hb_transform_t<> t = transforms.tail (); t.multiply (trans); transforms.push (t); } @@ -73,13 +73,13 @@ struct hb_paint_extents_context_t transforms.pop (); } - void push_clip (hb_extents_t extents) + void push_clip (hb_extents_t<> extents) { /* Transform extents and push a new clip. */ - const hb_transform_t &t = transforms.tail (); + const hb_transform_t<> &t = transforms.tail (); t.transform_extents (extents); - auto bounds = hb_bounds_t {extents}; + auto bounds = hb_bounds_t<> {extents}; bounds.intersect (clips.tail ()); clips.push (bounds); @@ -92,19 +92,19 @@ struct hb_paint_extents_context_t void push_group () { - groups.push (hb_bounds_t {hb_bounds_t::EMPTY}); + groups.push (hb_bounds_t<> {hb_bounds_t<>::EMPTY}); } void pop_group (hb_paint_composite_mode_t mode) { - const hb_bounds_t src_bounds = groups.pop (); - hb_bounds_t &backdrop_bounds = groups.tail (); + const hb_bounds_t<> src_bounds = groups.pop (); + hb_bounds_t<> &backdrop_bounds = groups.tail (); // https://learn.microsoft.com/en-us/typography/opentype/spec/colr#format-32-paintcomposite switch ((int) mode) { case HB_PAINT_COMPOSITE_MODE_CLEAR: - backdrop_bounds.status = hb_bounds_t::EMPTY; + backdrop_bounds.status = hb_bounds_t<>::EMPTY; break; case HB_PAINT_COMPOSITE_MODE_SRC: case HB_PAINT_COMPOSITE_MODE_SRC_OUT: @@ -125,16 +125,16 @@ struct hb_paint_extents_context_t void paint () { - const hb_bounds_t &clip = clips.tail (); - hb_bounds_t &group = groups.tail (); + const hb_bounds_t<> &clip = clips.tail (); + hb_bounds_t<> &group = groups.tail (); group.union_ (clip); } protected: - hb_vector_t transforms; - hb_vector_t clips; - hb_vector_t groups; + hb_vector_t> transforms; + hb_vector_t> clips; + hb_vector_t> groups; }; HB_INTERNAL hb_paint_funcs_t * diff --git a/src/hb-paint.hh b/src/hb-paint.hh index 2b4ae0917..bbeeb0319 100644 --- a/src/hb-paint.hh +++ b/src/hb-paint.hh @@ -28,6 +28,7 @@ #include "hb.hh" #include "hb-face.hh" #include "hb-font.hh" +#include "hb-geometry.hh" #define HB_PAINT_FUNCS_IMPLEMENT_CALLBACKS \ HB_PAINT_FUNC_IMPLEMENT (push_transform) \ @@ -186,54 +187,59 @@ struct hb_paint_funcs_t 0, 0); } - HB_NODISCARD - bool push_translate (void *paint_data, + void push_transform (void *paint_data, hb_transform_t t) + { + push_transform (paint_data, t.xx, t.yx, t.xy, t.yy, t.x0, t.y0); + } + + void push_translate (void *paint_data, float dx, float dy) { - if (!dx && !dy) - return false; - push_transform (paint_data, - 1.f, 0.f, 0.f, 1.f, dx, dy); - return true; + hb_transform_t::translation (dx, dy)); } - HB_NODISCARD - bool push_scale (void *paint_data, + void push_scale (void *paint_data, float sx, float sy) { - if (sx == 1.f && sy == 1.f) - return false; - push_transform (paint_data, - sx, 0.f, 0.f, sy, 0.f, 0.f); - return true; + hb_transform_t::scaling (sx, sy)); + } + void push_scale_around_center (void *paint_data, + float sx, float sy, + float cx, float cy) + { + push_transform (paint_data, + hb_transform_t::scaling_around_center (sx, sy, cx, cy)); } - HB_NODISCARD - bool push_rotate (void *paint_data, + void push_rotate (void *paint_data, float a) { - if (!a) - return false; - - float cc = cosf (a * HB_PI); - float ss = sinf (a * HB_PI); - push_transform (paint_data, cc, ss, -ss, cc, 0.f, 0.f); - return true; + push_transform (paint_data, + hb_transform_t::rotation (a * HB_PI)); } - HB_NODISCARD - bool push_skew (void *paint_data, + void push_rotate_around_center (void *paint_data, + float a, + float cx, float cy) + { + push_transform (paint_data, + hb_transform_t::rotation_around_center (a * HB_PI, cx, cy)); + } + + void push_skew (void *paint_data, float sx, float sy) { - if (!sx && !sy) - return false; - - float x = tanf (-sx * HB_PI); - float y = tanf (+sy * HB_PI); - push_transform (paint_data, 1.f, y, x, 1.f, 0.f, 0.f); - return true; + push_transform (paint_data, + hb_transform_t::skewing (-sx * HB_PI, sy * HB_PI)); + } + void push_skew_around_center (void *paint_data, + float sx, float sy, + float cx, float cy) + { + push_transform (paint_data, + hb_transform_t::skewing_around_center (-sx * HB_PI, sy * HB_PI, cx, cy)); } }; DECLARE_NULL_INSTANCE (hb_paint_funcs_t); diff --git a/src/hb-sanitize.hh b/src/hb-sanitize.hh index 9260b638d..88a956b27 100644 --- a/src/hb-sanitize.hh +++ b/src/hb-sanitize.hh @@ -120,8 +120,8 @@ struct hb_sanitize_context_t : hb_dispatch_context_t { - hb_sanitize_context_t () : - start (nullptr), end (nullptr), + hb_sanitize_context_t (const char *start_ = nullptr, const char *end_ = nullptr) : + start (start_), end (end_), length (0), max_ops (0), max_subtables (0), recursion_depth (0), @@ -212,14 +212,22 @@ struct hb_sanitize_context_t : void reset_object () { - this->start = this->blob->data; - this->end = this->start + this->blob->length; + if (this->blob) + { + this->start = this->blob->data; + this->end = this->start + this->blob->length; + } this->length = this->end - this->start; assert (this->start <= this->end); /* Must not overflow. */ } - void start_processing () + void start_processing (const char *start_ = nullptr, const char *end_ = nullptr) { + if (start_) + { + this->start = start_; + this->end = end_; + } reset_object (); unsigned m; if (unlikely (hb_unsigned_mul_overflows (this->end - this->start, HB_SANITIZE_MAX_OPS_FACTOR, &m))) diff --git a/src/hb-subset-plan-var.cc b/src/hb-subset-plan-var.cc index 525ff473d..6d8997bd9 100644 --- a/src/hb-subset-plan-var.cc +++ b/src/hb-subset-plan-var.cc @@ -199,24 +199,44 @@ normalize_axes_location (hb_face_t *face, hb_subset_plan_t *plan) { plan->axes_triple_distances.set (axis_tag, axis.get_triple_distances ()); - int normalized_min = axis.normalize_axis_value (axis_range->minimum); - int normalized_default = axis.normalize_axis_value (axis_range->middle); - int normalized_max = axis.normalize_axis_value (axis_range->maximum); + float normalized_min = axis.normalize_axis_value (axis_range->minimum); + float normalized_default = axis.normalize_axis_value (axis_range->middle); + float normalized_max = axis.normalize_axis_value (axis_range->maximum); + + // TODO(behdad): Spec says axis normalization should be done in 16.16; + // We used to do it in 2.14, but that's not correct. I fixed this in + // the fvar/avar code, but keeping 2.14 here for now to keep tests + // happy. We might need to adjust fonttools as well. + // I'm only fairly confident in the above statement. Anyway, + // we should look deeper into this, and also update fonttools if + // needed. + + // Round to 2.14 + normalized_min = roundf (normalized_min * 16384.f) / 16384.f; + normalized_default = roundf (normalized_default * 16384.f) / 16384.f; + normalized_max = roundf (normalized_max * 16384.f) / 16384.f; if (has_avar && old_axis_idx < avar_axis_count) { - normalized_min = seg_maps->map (normalized_min); - normalized_default = seg_maps->map (normalized_default); - normalized_max = seg_maps->map (normalized_max); - } - plan->axes_location.set (axis_tag, Triple (static_cast (normalized_min / 16384.0), - static_cast (normalized_default / 16384.0), - static_cast (normalized_max / 16384.0))); + normalized_min = seg_maps->map_float (normalized_min); + normalized_default = seg_maps->map_float (normalized_default); + normalized_max = seg_maps->map_float (normalized_max); - if (normalized_default != 0) + // Round to 2.14 + normalized_min = roundf (normalized_min * 16384.f) / 16384.f; + normalized_default = roundf (normalized_default * 16384.f) / 16384.f; + normalized_max = roundf (normalized_max * 16384.f) / 16384.f; + } + plan->axes_location.set (axis_tag, Triple ((double) normalized_min, + (double) normalized_default, + (double) normalized_max)); + + if (normalized_default == -0.f) + normalized_default = 0.f; // Normalize -0 to 0 + if (normalized_default != 0.f) plan->pinned_at_default = false; - plan->normalized_coords[old_axis_idx] = normalized_default; + plan->normalized_coords[old_axis_idx] = roundf (normalized_default * 16384.f); } old_axis_idx++; diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index a56965246..25073d23f 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -248,7 +248,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes_in, !(plan->flags & HB_SUBSET_FLAGS_NO_BIDI_CLOSURE)); OT::cmap::accelerator_t cmap (plan->source); - unsigned size_threshold = plan->source->get_num_glyphs (); + unsigned size_threshold = plan->source->get_num_glyphs (); if (glyphs->is_empty () && unicodes.get_population () < size_threshold) { @@ -376,7 +376,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes_in, // so record those first. plan->os2_info.min_cmap_codepoint = plan->unicodes.get_min(); plan->os2_info.max_cmap_codepoint = plan->unicodes.get_max(); - + hb_set_t variation_selectors_to_retain; cmap.collect_variation_selectors(&variation_selectors_to_retain); + variation_selectors_to_retain.iter() diff --git a/test/api/results-paint/test-106 b/test/api/results-paint/test-106 index 58d0c8350..47f38c894 100644 --- a/test/api/results-paint/test-106 +++ b/test/api/results-paint/test-106 @@ -8,17 +8,13 @@ start transform 1 0 0 1 0 0 end clip end transform push group - start transform 1 0 0 1 500 500 - start transform 1 0.268 -0 1 0 0 - start transform 1 0 0 1 -500 -500 + start transform 1 0.268 0 1 0 -134 + start transform 1 0 0 1 0 0 + start clip glyph 3 start transform 1 0 0 1 0 0 - start clip glyph 3 - start transform 1 0 0 1 0 0 - solid 255 165 0 178 - end transform - end clip + solid 255 165 0 178 end transform - end transform + end clip end transform end transform pop group mode 4 diff --git a/test/api/results-paint/test-123 b/test/api/results-paint/test-123 index f3d099f4f..fb700903b 100644 --- a/test/api/results-paint/test-123 +++ b/test/api/results-paint/test-123 @@ -8,31 +8,23 @@ start clip rectangle 0 0 1e+03 1e+03 end clip end transform push group - start transform 1 0 0 1 333 667 - start transform 0.5 0 0 0.5 0 0 - start transform 1 0 0 1 -333 -667 + start transform 0.5 0 0 0.5 166 334 + start transform 1 0 0 1 0 0 + start clip glyph 2 start transform 1 0 0 1 0 0 - start clip glyph 2 - start transform 1 0 0 1 0 0 - solid 255 220 1 255 - end transform - end clip + solid 255 220 1 255 end transform - end transform + end clip end transform end transform push group - start transform 1 0 0 1 667 333 - start transform 0.5 0 0 0.5 0 0 - start transform 1 0 0 1 -667 -333 + start transform 0.5 0 0 0.5 334 166 + start transform 1 0 0 1 0 0 + start clip glyph 2 start transform 1 0 0 1 0 0 - start clip glyph 2 - start transform 1 0 0 1 0 0 - solid 104 199 232 255 - end transform - end clip + solid 104 199 232 255 end transform - end transform + end clip end transform end transform pop group mode 3 diff --git a/test/api/results-paint/testvf-106 b/test/api/results-paint/testvf-106 index 58d0c8350..47f38c894 100644 --- a/test/api/results-paint/testvf-106 +++ b/test/api/results-paint/testvf-106 @@ -8,17 +8,13 @@ start transform 1 0 0 1 0 0 end clip end transform push group - start transform 1 0 0 1 500 500 - start transform 1 0.268 -0 1 0 0 - start transform 1 0 0 1 -500 -500 + start transform 1 0.268 0 1 0 -134 + start transform 1 0 0 1 0 0 + start clip glyph 3 start transform 1 0 0 1 0 0 - start clip glyph 3 - start transform 1 0 0 1 0 0 - solid 255 165 0 178 - end transform - end clip + solid 255 165 0 178 end transform - end transform + end clip end transform end transform pop group mode 4 diff --git a/test/api/results-paint/testvf-123 b/test/api/results-paint/testvf-123 index f3d099f4f..fb700903b 100644 --- a/test/api/results-paint/testvf-123 +++ b/test/api/results-paint/testvf-123 @@ -8,31 +8,23 @@ start clip rectangle 0 0 1e+03 1e+03 end clip end transform push group - start transform 1 0 0 1 333 667 - start transform 0.5 0 0 0.5 0 0 - start transform 1 0 0 1 -333 -667 + start transform 0.5 0 0 0.5 166 334 + start transform 1 0 0 1 0 0 + start clip glyph 2 start transform 1 0 0 1 0 0 - start clip glyph 2 - start transform 1 0 0 1 0 0 - solid 255 220 1 255 - end transform - end clip + solid 255 220 1 255 end transform - end transform + end clip end transform end transform push group - start transform 1 0 0 1 667 333 - start transform 0.5 0 0 0.5 0 0 - start transform 1 0 0 1 -667 -333 + start transform 0.5 0 0 0.5 334 166 + start transform 1 0 0 1 0 0 + start clip glyph 2 start transform 1 0 0 1 0 0 - start clip glyph 2 - start transform 1 0 0 1 0 0 - solid 104 199 232 255 - end transform - end clip + solid 104 199 232 255 end transform - end transform + end clip end transform end transform pop group mode 3 diff --git a/test/api/test-draw.c b/test/api/test-draw.c index 9927e045f..e12048cbb 100644 --- a/test/api/test-draw.c +++ b/test/api/test-draw.c @@ -710,7 +710,7 @@ test_hb_draw_font_kit_variations_tests (void) "C436,229 405,295 271,349L247,359C160,393 119,439 119,506" "C119,592 178,637 262,637C311,637 346,626 390,585L348,629L373,535" "C380,510 394,503 408,503C424,503 434,510 437,526C418,614 348,665 259,665" - "C161,665 78,606 78,500C78,414 128,361 224,321L261,305C367,259 395,217 395,152" + "C161,665 78,606 78,500C78,414 128,361 224,320L261,305C367,259 395,217 395,152" "C395,65 334,15 246,15ZM267,331L267,759L240,759L240,331L267,331ZM240,-115" "L267,-115L267,331L240,331L240,-115Z"; g_assert_cmpmem (str, draw_data.consumed, expected, sizeof (expected) - 1); diff --git a/test/api/test-var-coords.c b/test/api/test-var-coords.c index fe3ba8c4f..22843bc7a 100644 --- a/test/api/test-var-coords.c +++ b/test/api/test-var-coords.c @@ -24,6 +24,8 @@ #include "hb-test.h" +#include + #include /* Unit tests for hb_font_[gs]et_var_coords_ */ @@ -31,20 +33,13 @@ static void test_get_var_coords (void) { -#ifndef G_APPROX_VALUE -#define G_APPROX_VALUE(a, b, epsilon) \ - (((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon)) -#endif - -#define EPSILON 0.05f - hb_face_t *face = hb_test_open_font_file ("fonts/TestCFF2VF.otf"); hb_font_t *font = hb_font_create (face); /* Normalized coords as input */ int normalized_coords[] = {100, 0}; hb_font_set_var_coords_normalized (font, normalized_coords, 2); - g_assert_cmpint ((int) hb_font_get_var_coords_design (font, NULL)[0], ==, 403); + g_assert (isnan (hb_font_get_var_coords_design (font, NULL)[0])); g_assert_cmpint ((int) hb_font_get_var_coords_normalized (font, NULL)[0], ==, 100); /* Design coords as input */ @@ -53,16 +48,6 @@ test_get_var_coords (void) g_assert_cmpint ((int) hb_font_get_var_coords_normalized (font, NULL)[0], ==, -16117); g_assert_cmpint ((int) hb_font_get_var_coords_design (font, NULL)[0], ==, 206); - for (float weight = 200; weight < 901; ++weight) - { - int normalized; - hb_ot_var_normalize_coords (face, 1, &weight, &normalized); - hb_font_set_var_coords_normalized (font, &normalized, 1); - float converted_back = hb_font_get_var_coords_design (font, NULL)[0]; - // fprintf (stderr, "%f: %d => %f\n", weight, normalized, converted_back); - g_assert_true (G_APPROX_VALUE (converted_back, weight, EPSILON)); - } - hb_font_destroy (font); hb_face_destroy (face); } diff --git a/test/subset/data/expected/full_instance/Roboto-Variable.default.all.wght=300,wdth=90.ttf b/test/subset/data/expected/full_instance/Roboto-Variable.default.all.wght=300,wdth=90.ttf index 9407bc4cf51d5798a48978e2f0489ca46e86ed0a..e906f102766dc4f9188a08e3293acce831891e18 100644 GIT binary patch delta 13465 zcma)i2V7Lg*7!Yl3kcFhL_j)7?{#TQU0`A9z4u;s*##Ds-lbh(Xo?Lq_5>A8qQ(+a zo~fE<)a0eTMAM@tQMmqR(d50C|9ju}{q{F|_U_D_Idj^abLRfG!oIh{9^DnJh`voD zh^aOL%R#GXH#DAL>Ll7pO1fkYdQJtUb z^izgQk7G6QY}-tsrS=# z)4bATF=?r3+tNNw*GaEVZ%)6Kp_@^jaWa#Y8JO9Uc{%FD;k^FsMVO%xYdN!q}No{wAXB}S*$rzbG6o_ z_F(PV+P7;zuf1QVSf^KKUl&jpUsqJuST|U=v+mit%XJ^r+t$z2AE|$-{#yN)^}h*~ zga$%KVX!b+SSD-{jtch*PYGWW-W2{I0+E);LMCz+`H5mh1tN)PNHi~cPIN_dL-bt( z(XhT@Q-e)|Uqf6&QA1eMzT@6aciSbV@zW~qoncGCetSOrtl_N zMpIQ&N7F>pfu#s@ODm@}NY)zJn$=p=TGiUn+S=OFI@~(hy0dk$^=Rvb z*4J9!k!_Ia%gkh+vPfCHEL~PD6Uzo|1DLa%nORj+SvOm9K2xOcF3XYUKW zAN1boUG3B8Gw<{2i|WhitMBXWo9#Q+cd_sNzHjgSFc@$e2p&itC>v-Q7#-LBe^4@k^Ye#BhQYU9eHQu%aPwlRYr|R-A2PlGe>JiJ4eyz zq0#fB*GB&_`e;mT%yi6SEMhEktahw>Y7dJ&aOJ7NYd z5EQ)f_!-7IVjBP6&wh@enD)dBGYF5z^O*ibB{@mVFm4e=WFujK=S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 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/configs-build.yml b/.github/workflows/configs-build.yml index 6190decc4..030734c09 100644 --- a/.github/workflows/configs-build.yml +++ b/.github/workflows/configs-build.yml @@ -1,4 +1,4 @@ -name: configs-ci +name: configs on: push: From 2700b0c7740413fb723344f1625316fbdd28999b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 11:05:56 +0000 Subject: [PATCH 33/39] Bump github/codeql-action from 3.28.18 to 3.28.19 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.18 to 3.28.19. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/ff0a06e83cb2de871e5a09832bc6a81e7276941f...fca7ace96b7d713c7035871441bd52efbe39e27e) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.28.19 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 3a66cda83..299dddf65 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -59,6 +59,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18 + uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19 with: sarif_file: results.sarif From dcf50ca6fe86151e0d0ee568390509f9e7a3025c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 10 Jun 2025 03:10:06 -0600 Subject: [PATCH 34/39] [rust] Roll forward --- src/rust/Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 82285e4c8..4a52a037f 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -10,9 +10,9 @@ checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bytemuck" -version = "1.23.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" +checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" dependencies = [ "bytemuck_derive", ] @@ -57,7 +57,7 @@ dependencies = [ [[package]] name = "harfruzz" version = "0.1.0" -source = "git+https://github.com/harfbuzz/harfruzz#695caf4d97be12a5e8dc9762ae734ab2a3710b68" +source = "git+https://github.com/harfbuzz/harfruzz#b4ba3a04febba9ea602403a25b725840eb7078af" dependencies = [ "bitflags", "bytemuck", @@ -119,9 +119,9 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "syn" -version = "2.0.101" +version = "2.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" dependencies = [ "proc-macro2", "quote", From c936b229379811f748d616c58e5f1c066577e7ef Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 10 Jun 2025 08:22:47 -0600 Subject: [PATCH 35/39] [rust] Update to HarfRuzz->HarfRust rename --- meson.build | 12 ++--- meson_options.txt | 4 +- src/{hb-harfruzz.cc => hb-harfrust.cc} | 52 ++++++++++---------- src/meson.build | 8 +-- src/rust/Cargo.lock | 6 +-- src/rust/Cargo.toml | 4 +- src/rust/shape.rs | 68 +++++++++++++------------- 7 files changed, 77 insertions(+), 77 deletions(-) rename src/{hb-harfruzz.cc => hb-harfrust.cc} (65%) diff --git a/meson.build b/meson.build index 23c564ec8..6af999ff8 100644 --- a/meson.build +++ b/meson.build @@ -206,10 +206,10 @@ if get_option('fontations').enabled() fontations_dep_found = true endif -harfruzz_dep_found = false -if get_option('harfruzz').enabled() +harfrust_dep_found = false +if get_option('harfrust').enabled() add_languages(['rust'], native: false, required : true) - harfruzz_dep_found = true + harfrust_dep_found = true endif conf = configuration_data() @@ -257,8 +257,8 @@ if fontations_dep_found conf.set('HAVE_FONTATIONS', 1) endif -if harfruzz_dep_found - conf.set('HAVE_HARFRUZZ', 1) +if harfrust_dep_found + conf.set('HAVE_HARFRUST', 1) endif if wasm_dep.found() @@ -492,7 +492,7 @@ build_summary = { {'CoreText': conf.get('HAVE_CORETEXT', 0) == 1, 'DirectWrite': conf.get('HAVE_DIRECTWRITE', 0) == 1, 'GDI/Uniscribe': (conf.get('HAVE_GDI', 0) == 1) and (conf.get('HAVE_UNISCRIBE', 0) == 1), - 'HarfRuzz': conf.get('HAVE_HARFRUZZ', 0) == 1, + 'HarfRust': conf.get('HAVE_HARFRUST', 0) == 1, }, 'Other features': {'Documentation': conf.get('HAVE_GTK_DOC', 0) == 1, diff --git a/meson_options.txt b/meson_options.txt index 691285354..b6d008531 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -23,8 +23,8 @@ option('directwrite', type: 'feature', value: 'disabled', description: 'Enable DirectWrite shaper and font backend on Windows') option('coretext', type: 'feature', value: 'disabled', description: 'Enable CoreText shaper and font backend on Apple platforms') -option('harfruzz', type: 'feature', value: 'disabled', - description: 'Enable HarfRuzz shaper backend') +option('harfrust', type: 'feature', value: 'disabled', + description: 'Enable HarfRust shaper backend') option('wasm', type: 'feature', value: 'disabled', description: 'Enable WebAssembly shaper backend (experimental)') diff --git a/src/hb-harfruzz.cc b/src/hb-harfrust.cc similarity index 65% rename from src/hb-harfruzz.cc rename to src/hb-harfrust.cc index 06132c05a..2f3eb2596 100644 --- a/src/hb-harfruzz.cc +++ b/src/hb-harfrust.cc @@ -24,7 +24,7 @@ #include "hb.hh" -#ifdef HAVE_HARFRUZZ +#ifdef HAVE_HARFRUST #include "hb-shaper-impl.hh" @@ -34,21 +34,21 @@ */ extern "C" void * -_hb_harfruzz_shaper_face_data_create_rs (hb_face_t *face); +_hb_harfrust_shaper_face_data_create_rs (hb_face_t *face); -hb_harfruzz_face_data_t * -_hb_harfruzz_shaper_face_data_create (hb_face_t *face) +hb_harfrust_face_data_t * +_hb_harfrust_shaper_face_data_create (hb_face_t *face) { - return (hb_harfruzz_face_data_t *) _hb_harfruzz_shaper_face_data_create_rs (face); + return (hb_harfrust_face_data_t *) _hb_harfrust_shaper_face_data_create_rs (face); } extern "C" void -_hb_harfruzz_shaper_face_data_destroy_rs (void *data); +_hb_harfrust_shaper_face_data_destroy_rs (void *data); void -_hb_harfruzz_shaper_face_data_destroy (hb_harfruzz_face_data_t *data) +_hb_harfrust_shaper_face_data_destroy (hb_harfrust_face_data_t *data) { - _hb_harfruzz_shaper_face_data_destroy_rs (data); + _hb_harfrust_shaper_face_data_destroy_rs (data); } @@ -57,22 +57,22 @@ _hb_harfruzz_shaper_face_data_destroy (hb_harfruzz_face_data_t *data) */ extern "C" void * -_hb_harfruzz_shaper_font_data_create_rs (hb_font_t *font, const void *face_data); +_hb_harfrust_shaper_font_data_create_rs (hb_font_t *font, const void *face_data); -hb_harfruzz_font_data_t * -_hb_harfruzz_shaper_font_data_create (hb_font_t *font) +hb_harfrust_font_data_t * +_hb_harfrust_shaper_font_data_create (hb_font_t *font) { - const hb_harfruzz_face_data_t *face_data = font->face->data.harfruzz; - return (hb_harfruzz_font_data_t *) _hb_harfruzz_shaper_font_data_create_rs (font, face_data); + const hb_harfrust_face_data_t *face_data = font->face->data.harfrust; + return (hb_harfrust_font_data_t *) _hb_harfrust_shaper_font_data_create_rs (font, face_data); } extern "C" void -_hb_harfruzz_shaper_font_data_destroy_rs (void *data); +_hb_harfrust_shaper_font_data_destroy_rs (void *data); void -_hb_harfruzz_shaper_font_data_destroy (hb_harfruzz_font_data_t *data) +_hb_harfrust_shaper_font_data_destroy (hb_harfrust_font_data_t *data) { - _hb_harfruzz_shaper_font_data_destroy_rs (data); + _hb_harfrust_shaper_font_data_destroy_rs (data); } /* @@ -80,14 +80,14 @@ _hb_harfruzz_shaper_font_data_destroy (hb_harfruzz_font_data_t *data) */ extern "C" void * -_hb_harfruzz_shape_plan_create_rs (const void *font_data, +_hb_harfrust_shape_plan_create_rs (const void *font_data, const void *face_data, hb_script_t script, hb_language_t language, hb_direction_t direction); extern "C" void -_hb_harfruzz_shape_plan_destroy_rs (void *data); +_hb_harfrust_shape_plan_destroy_rs (void *data); /* @@ -95,7 +95,7 @@ _hb_harfruzz_shape_plan_destroy_rs (void *data); */ extern "C" hb_bool_t -_hb_harfruzz_shape_rs (const void *font_data, +_hb_harfrust_shape_rs (const void *font_data, const void *face_data, const void *rs_shape_plan, hb_font_t *font, @@ -106,14 +106,14 @@ _hb_harfruzz_shape_rs (const void *font_data, static hb_user_data_key_t hr_shape_plan_key = {0}; hb_bool_t -_hb_harfruzz_shape (hb_shape_plan_t *shape_plan, +_hb_harfrust_shape (hb_shape_plan_t *shape_plan, hb_font_t *font, hb_buffer_t *buffer, const hb_feature_t *features, unsigned int num_features) { - const hb_harfruzz_font_data_t *font_data = font->data.harfruzz; - const hb_harfruzz_face_data_t *face_data = font->face->data.harfruzz; + const hb_harfrust_font_data_t *font_data = font->data.harfrust; + const hb_harfrust_face_data_t *face_data = font->face->data.harfrust; void *hr_shape_plan = nullptr; @@ -124,7 +124,7 @@ _hb_harfruzz_shape (hb_shape_plan_t *shape_plan, &hr_shape_plan_key); if (unlikely (!hr_shape_plan)) { - hr_shape_plan = _hb_harfruzz_shape_plan_create_rs (font_data, face_data, + hr_shape_plan = _hb_harfrust_shape_plan_create_rs (font_data, face_data, shape_plan->key.props.script, shape_plan->key.props.language, shape_plan->key.props.direction); @@ -132,16 +132,16 @@ _hb_harfruzz_shape (hb_shape_plan_t *shape_plan, !hb_shape_plan_set_user_data (shape_plan, &hr_shape_plan_key, hr_shape_plan, - _hb_harfruzz_shape_plan_destroy_rs, + _hb_harfrust_shape_plan_destroy_rs, false)) { - _hb_harfruzz_shape_plan_destroy_rs (hr_shape_plan); + _hb_harfrust_shape_plan_destroy_rs (hr_shape_plan); goto retry; } } } - return _hb_harfruzz_shape_rs (font_data, + return _hb_harfrust_shape_rs (font_data, face_data, hr_shape_plan, font, diff --git a/src/meson.build b/src/meson.build index 0520c820b..b9cd4d557 100644 --- a/src/meson.build +++ b/src/meson.build @@ -338,8 +338,8 @@ hb_ft_headers = files('hb-ft.h') hb_fontations_sources = files() hb_fontations_headers = files('hb-fontations.h') -hb_harfruzz_sources = files('hb-harfruzz.cc') -hb_harfruzz_headers = files() +hb_harfrust_sources = files('hb-harfrust.cc') +hb_harfrust_headers = files() hb_glib_sources = files('hb-glib.cc') hb_glib_headers = files('hb-glib.h') @@ -545,8 +545,8 @@ if conf.get('HAVE_FONTATIONS', 0) == 1 endif if conf.get('HAVE_HARFRUZZ', 0) == 1 - hb_sources += hb_harfruzz_sources - hb_headers += hb_harfruzz_headers + hb_sources += hb_harfrust_sources + hb_headers += hb_harfrust_headers endif have_icu = conf.get('HAVE_ICU', 0) == 1 diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 4a52a037f..6e2a28d2d 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -50,14 +50,14 @@ dependencies = [ name = "harfbuzz_rust" version = "0.0.0" dependencies = [ - "harfruzz", + "harfrust", "skrifa", ] [[package]] -name = "harfruzz" +name = "harfrust" version = "0.1.0" -source = "git+https://github.com/harfbuzz/harfruzz#b4ba3a04febba9ea602403a25b725840eb7078af" +source = "git+https://github.com/harfbuzz/harfrust#2c3a8da47c8d67c88f63669ec44d8cb4f9771c62" dependencies = [ "bitflags", "bytemuck", diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 5d0368a8d..ba4cb0358 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" [dependencies] skrifa = { version = "0.*", optional = true } -harfruzz = { git = "https://github.com/harfbuzz/harfruzz", optional = true } +harfrust = { git = "https://github.com/harfbuzz/harfrust", optional = true } [lib] name = "harfbuzz_rust" @@ -13,7 +13,7 @@ crate-type = ["staticlib"] [features] font = ["dep:skrifa"] -shape = ["dep:harfruzz"] +shape = ["dep:harfrust"] [profile.release] strip = true diff --git a/src/rust/shape.rs b/src/rust/shape.rs index 35d130c1b..2a42f34dd 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -6,7 +6,7 @@ use std::ffi::c_void; use std::ptr::null_mut; use std::str::FromStr; -use harfruzz::{FontRef, NormalizedCoord, ShaperData, ShaperInstance, Tag}; +use harfrust::{FontRef, NormalizedCoord, ShaperData, ShaperInstance, Tag}; pub struct HBHarfRuzzFaceData<'a> { face_blob: *mut hb_blob_t, @@ -15,7 +15,7 @@ pub struct HBHarfRuzzFaceData<'a> { } #[no_mangle] -pub unsafe extern "C" fn _hb_harfruzz_shaper_face_data_create_rs( +pub unsafe extern "C" fn _hb_harfrust_shaper_face_data_create_rs( face: *mut hb_face_t, ) -> *mut c_void { let face_index = hb_face_get_index(face); @@ -43,7 +43,7 @@ pub unsafe extern "C" fn _hb_harfruzz_shaper_face_data_create_rs( } #[no_mangle] -pub unsafe extern "C" fn _hb_harfruzz_shaper_face_data_destroy_rs(data: *mut c_void) { +pub unsafe extern "C" fn _hb_harfrust_shaper_face_data_destroy_rs(data: *mut c_void) { let data = data as *mut HBHarfRuzzFaceData; let hr_face_data = Box::from_raw(data); let blob = hr_face_data.face_blob; @@ -67,7 +67,7 @@ fn font_to_shaper_instance(font: *mut hb_font_t, font_ref: &FontRef<'_>) -> Shap } #[no_mangle] -pub unsafe extern "C" fn _hb_harfruzz_shaper_font_data_create_rs( +pub unsafe extern "C" fn _hb_harfrust_shaper_font_data_create_rs( font: *mut hb_font_t, face_data: *const c_void, ) -> *mut c_void { @@ -83,23 +83,23 @@ pub unsafe extern "C" fn _hb_harfruzz_shaper_font_data_create_rs( } #[no_mangle] -pub unsafe extern "C" fn _hb_harfruzz_shaper_font_data_destroy_rs(data: *mut c_void) { +pub unsafe extern "C" fn _hb_harfrust_shaper_font_data_destroy_rs(data: *mut c_void) { let data = data as *mut HBHarfRuzzFontData; let _hr_font_data = Box::from_raw(data); } -fn hb_language_to_hr_language(language: hb_language_t) -> Option { +fn hb_language_to_hr_language(language: hb_language_t) -> Option { let language_str = unsafe { hb_language_to_string(language) }; if language_str.is_null() { return None; } let language_str = unsafe { std::ffi::CStr::from_ptr(language_str) }; let language_str = language_str.to_str().unwrap_or_default(); - Some(harfruzz::Language::from_str(language_str).unwrap()) + Some(harfrust::Language::from_str(language_str).unwrap()) } #[no_mangle] -pub unsafe extern "C" fn _hb_harfruzz_shape_plan_create_rs( +pub unsafe extern "C" fn _hb_harfrust_shape_plan_create_rs( font_data: *const c_void, face_data: *const c_void, script: hb_script_t, @@ -111,14 +111,14 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_plan_create_rs( let font_ref = &(*face_data).font_ref; - let script = harfruzz::Script::from_iso15924_tag(Tag::from_u32(script)); + let script = harfrust::Script::from_iso15924_tag(Tag::from_u32(script)); let language = hb_language_to_hr_language(language); let direction = match direction { - hb_direction_t_HB_DIRECTION_LTR => harfruzz::Direction::LeftToRight, - hb_direction_t_HB_DIRECTION_RTL => harfruzz::Direction::RightToLeft, - hb_direction_t_HB_DIRECTION_TTB => harfruzz::Direction::TopToBottom, - hb_direction_t_HB_DIRECTION_BTT => harfruzz::Direction::BottomToTop, - _ => harfruzz::Direction::Invalid, + hb_direction_t_HB_DIRECTION_LTR => harfrust::Direction::LeftToRight, + hb_direction_t_HB_DIRECTION_RTL => harfrust::Direction::RightToLeft, + hb_direction_t_HB_DIRECTION_TTB => harfrust::Direction::TopToBottom, + hb_direction_t_HB_DIRECTION_BTT => harfrust::Direction::BottomToTop, + _ => harfrust::Direction::Invalid, }; let shaper = (*face_data) @@ -128,19 +128,19 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_plan_create_rs( .build(); let hr_shape_plan = - harfruzz::ShapePlan::new(&shaper, direction, script, language.as_ref(), &[]); + harfrust::ShapePlan::new(&shaper, direction, script, language.as_ref(), &[]); let hr_shape_plan = Box::new(hr_shape_plan); Box::into_raw(hr_shape_plan) as *mut c_void } #[no_mangle] -pub unsafe extern "C" fn _hb_harfruzz_shape_plan_destroy_rs(data: *mut c_void) { - let data = data as *mut harfruzz::ShapePlan; +pub unsafe extern "C" fn _hb_harfrust_shape_plan_destroy_rs(data: *mut c_void) { + let data = data as *mut harfrust::ShapePlan; let _hr_shape_plan = Box::from_raw(data); } #[no_mangle] -pub unsafe extern "C" fn _hb_harfruzz_shape_rs( +pub unsafe extern "C" fn _hb_harfrust_shape_rs( font_data: *const c_void, face_data: *const c_void, shape_plan: *const c_void, @@ -154,28 +154,28 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( let font_ref = &(*face_data).font_ref; - let mut hr_buffer = harfruzz::UnicodeBuffer::new(); + let mut hr_buffer = harfrust::UnicodeBuffer::new(); // Set buffer properties let cluster_level = hb_buffer_get_cluster_level(buffer); let cluster_level = match cluster_level { hb_buffer_cluster_level_t_HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES => { - harfruzz::BufferClusterLevel::MonotoneGraphemes + harfrust::BufferClusterLevel::MonotoneGraphemes } hb_buffer_cluster_level_t_HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS => { - harfruzz::BufferClusterLevel::MonotoneCharacters + harfrust::BufferClusterLevel::MonotoneCharacters } hb_buffer_cluster_level_t_HB_BUFFER_CLUSTER_LEVEL_CHARACTERS => { - harfruzz::BufferClusterLevel::Characters + harfrust::BufferClusterLevel::Characters } hb_buffer_cluster_level_t_HB_BUFFER_CLUSTER_LEVEL_GRAPHEMES => { - harfruzz::BufferClusterLevel::Graphemes + harfrust::BufferClusterLevel::Graphemes } - _ => harfruzz::BufferClusterLevel::default(), + _ => harfrust::BufferClusterLevel::default(), }; hr_buffer.set_cluster_level(cluster_level); let flags = hb_buffer_get_flags(buffer); - hr_buffer.set_flags(harfruzz::BufferFlags::from_bits_truncate(flags)); + hr_buffer.set_flags(harfrust::BufferFlags::from_bits_truncate(flags)); let not_found_variation_selector_glyph = hb_buffer_get_not_found_variation_selector_glyph(buffer); if not_found_variation_selector_glyph != u32::MAX { @@ -187,15 +187,15 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( let language = hb_buffer_get_language(buffer); let direction = hb_buffer_get_direction(buffer); // Convert to HarfRuzz types - let script = harfruzz::Script::from_iso15924_tag(Tag::from_u32(script)) - .unwrap_or(harfruzz::script::UNKNOWN); + let script = harfrust::Script::from_iso15924_tag(Tag::from_u32(script)) + .unwrap_or(harfrust::script::UNKNOWN); let language = hb_language_to_hr_language(language); let direction = match direction { - hb_direction_t_HB_DIRECTION_LTR => harfruzz::Direction::LeftToRight, - hb_direction_t_HB_DIRECTION_RTL => harfruzz::Direction::RightToLeft, - hb_direction_t_HB_DIRECTION_TTB => harfruzz::Direction::TopToBottom, - hb_direction_t_HB_DIRECTION_BTT => harfruzz::Direction::BottomToTop, - _ => harfruzz::Direction::Invalid, + hb_direction_t_HB_DIRECTION_LTR => harfrust::Direction::LeftToRight, + hb_direction_t_HB_DIRECTION_RTL => harfrust::Direction::RightToLeft, + hb_direction_t_HB_DIRECTION_TTB => harfrust::Direction::TopToBottom, + hb_direction_t_HB_DIRECTION_BTT => harfrust::Direction::BottomToTop, + _ => harfrust::Direction::Invalid, }; // Set properties on the buffer hr_buffer.set_script(script); @@ -236,7 +236,7 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( let value = f.value; let start = f.start; let end = f.end; - harfruzz::Feature { + harfrust::Feature { tag: Tag::from_u32(tag), value, start, @@ -249,7 +249,7 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs( let glyphs = if shape_plan.is_null() { shaper.shape(hr_buffer, &features) } else { - let shape_plan = shape_plan as *const harfruzz::ShapePlan; + let shape_plan = shape_plan as *const harfrust::ShapePlan; shaper.shape_with_plan(shape_plan.as_ref().unwrap(), hr_buffer, &features) }; From cd16559c278732cd4671921d35bfda27378f628a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 10 Jun 2025 08:24:56 -0600 Subject: [PATCH 36/39] [README] Link to HarfBuzz Study: Introducing HarfRust --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8f235612d..cb60652ae 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ Internationalization and Unicode Conference over the years: More presentations and papers are available on [behdad][11]'s website. In particular, the following _studies_ are relevant to HarfBuzz development: +- 2025 - [Introducing HarfRust][22] - 2025 – [Subsetting][21] - 2025 – [Caching][12] - 2025 – [`hb-decycler`][13] @@ -134,3 +135,4 @@ transliterated using the Latin script. It also means "talkative" or [19]: https://prezi.com/view/THNPJGFVDUCWoM20syev/ [20]: https://behdad.org/doc/harfbuzz10years-slides.pdf [21]: https://docs.google.com/document/d/1_vZrt97OorJ0jA1YzJ29LRcGr3YGrNJANdOABjVZGEs/preview +[22]: https://docs.google.com/document/d/1aH_waagdEM5UhslQxCeFEb82ECBhPlZjy5_MwLNLBYo/preview From fc6231726e514f96bfbb098283aab332fc6b45fb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 10 Jun 2025 16:44:24 -0600 Subject: [PATCH 37/39] [gen-ucd] Make clippy happy --- src/gen-ucd-table.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gen-ucd-table.py b/src/gen-ucd-table.py index f16cdc980..2a48a21fe 100755 --- a/src/gen-ucd-table.py +++ b/src/gen-ucd-table.py @@ -193,6 +193,7 @@ elif language.name == "rust": print("pub(crate) mod ucd {") print() print("#![allow(unused_parens)]") + print("#![allow(clippy::unnecessary_cast)]") print() print("use crate::hb::algs::{HB_CODEPOINT_ENCODE3, HB_CODEPOINT_ENCODE3_11_7_14};") print("use crate::hb::common::script;") From 2617e89df1d065191463cb30dfc8a5f5f7a5a031 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jun 2025 15:52:47 -0600 Subject: [PATCH 38/39] [rust] Finish renaming HarfRuzz to HarfRust --- src/check-symbols.py | 2 +- src/hb-shaper-list.hh | 4 ++-- src/meson.build | 4 ++-- src/rust/meson.build | 2 +- src/rust/shape.rs | 24 ++++++++++++------------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/check-symbols.py b/src/check-symbols.py index 8de58b824..7321ed75a 100755 --- a/src/check-symbols.py +++ b/src/check-symbols.py @@ -42,7 +42,7 @@ IGNORED_SYMBOLS += [ "_ZN3std3sys3pal4unix4args3imp15ARGV_INIT_ARRAY.*", # 'std::sys::pal::unix::args::imp::ARGV_INIT_ARRAY::.*' "_ZN3std3sys4args4unix3imp15ARGV_INIT_ARRAY.*", # std::sys::args::unix::imp::ARGV_INIT_ARRAY::.* "_ZN17compiler_builtins.*", # 'compiler_builtins::.*' - '_hb_harfruzz_.*_rs', + '_hb_harfrust_.*_rs', ] IGNORED_SYMBOLS = "|".join(IGNORED_SYMBOLS) diff --git a/src/hb-shaper-list.hh b/src/hb-shaper-list.hh index dc494d236..41673a384 100644 --- a/src/hb-shaper-list.hh +++ b/src/hb-shaper-list.hh @@ -57,8 +57,8 @@ HB_SHAPER_IMPLEMENT (directwrite) HB_SHAPER_IMPLEMENT (coretext) #endif -#ifdef HAVE_HARFRUZZ -HB_SHAPER_IMPLEMENT (harfruzz) +#ifdef HAVE_HARFRUST +HB_SHAPER_IMPLEMENT (harfrust) #endif #ifndef HB_NO_FALLBACK_SHAPE diff --git a/src/meson.build b/src/meson.build index b9cd4d557..7476716ae 100644 --- a/src/meson.build +++ b/src/meson.build @@ -534,7 +534,7 @@ if conf.get('HAVE_CORETEXT', 0) == 1 harfbuzz_deps += coretext_deps endif -if conf.get('HAVE_FONTATIONS', 0) == 1 or conf.get('HAVE_HARFRUZZ', 0) == 1 +if conf.get('HAVE_FONTATIONS', 0) == 1 or conf.get('HAVE_HARFRUST', 0) == 1 subdir('rust') harfbuzz_deps += [harfbuzz_rust_dep] endif @@ -544,7 +544,7 @@ if conf.get('HAVE_FONTATIONS', 0) == 1 hb_headers += hb_fontations_headers endif -if conf.get('HAVE_HARFRUZZ', 0) == 1 +if conf.get('HAVE_HARFRUST', 0) == 1 hb_sources += hb_harfrust_sources hb_headers += hb_harfrust_headers endif diff --git a/src/rust/meson.build b/src/rust/meson.build index 313f1ca74..b40cd9471 100644 --- a/src/rust/meson.build +++ b/src/rust/meson.build @@ -25,7 +25,7 @@ features = [] if conf.get('HAVE_FONTATIONS', 0) == 1 features += ['font'] endif -if conf.get('HAVE_HARFRUZZ', 0) == 1 +if conf.get('HAVE_HARFRUST', 0) == 1 features += ['shape'] endif if features.length() > 0 diff --git a/src/rust/shape.rs b/src/rust/shape.rs index 2a42f34dd..22edde8bf 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -8,7 +8,7 @@ use std::str::FromStr; use harfrust::{FontRef, NormalizedCoord, ShaperData, ShaperInstance, Tag}; -pub struct HBHarfRuzzFaceData<'a> { +pub struct HBHarfRustFaceData<'a> { face_blob: *mut hb_blob_t, font_ref: FontRef<'a>, shaper_data: ShaperData, @@ -33,7 +33,7 @@ pub unsafe extern "C" fn _hb_harfrust_shaper_face_data_create_rs( }; let shaper_data = ShaperData::new(&font_ref); - let hr_face_data = Box::new(HBHarfRuzzFaceData { + let hr_face_data = Box::new(HBHarfRustFaceData { face_blob, font_ref, shaper_data, @@ -44,13 +44,13 @@ pub unsafe extern "C" fn _hb_harfrust_shaper_face_data_create_rs( #[no_mangle] pub unsafe extern "C" fn _hb_harfrust_shaper_face_data_destroy_rs(data: *mut c_void) { - let data = data as *mut HBHarfRuzzFaceData; + let data = data as *mut HBHarfRustFaceData; let hr_face_data = Box::from_raw(data); let blob = hr_face_data.face_blob; hb_blob_destroy(blob); } -pub struct HBHarfRuzzFontData { +pub struct HBHarfRustFontData { shaper_instance: ShaperInstance, } @@ -71,12 +71,12 @@ pub unsafe extern "C" fn _hb_harfrust_shaper_font_data_create_rs( font: *mut hb_font_t, face_data: *const c_void, ) -> *mut c_void { - let face_data = face_data as *const HBHarfRuzzFaceData; + let face_data = face_data as *const HBHarfRustFaceData; let font_ref = &(*face_data).font_ref; let shaper_instance = font_to_shaper_instance(font, font_ref); - let hr_font_data = Box::new(HBHarfRuzzFontData { shaper_instance }); + let hr_font_data = Box::new(HBHarfRustFontData { shaper_instance }); let hr_font_data_ptr = Box::into_raw(hr_font_data); hr_font_data_ptr as *mut c_void @@ -84,7 +84,7 @@ pub unsafe extern "C" fn _hb_harfrust_shaper_font_data_create_rs( #[no_mangle] pub unsafe extern "C" fn _hb_harfrust_shaper_font_data_destroy_rs(data: *mut c_void) { - let data = data as *mut HBHarfRuzzFontData; + let data = data as *mut HBHarfRustFontData; let _hr_font_data = Box::from_raw(data); } @@ -106,8 +106,8 @@ pub unsafe extern "C" fn _hb_harfrust_shape_plan_create_rs( language: hb_language_t, direction: hb_direction_t, ) -> *mut c_void { - let font_data = font_data as *const HBHarfRuzzFontData; - let face_data = face_data as *const HBHarfRuzzFaceData; + let font_data = font_data as *const HBHarfRustFontData; + let face_data = face_data as *const HBHarfRustFaceData; let font_ref = &(*face_data).font_ref; @@ -149,8 +149,8 @@ pub unsafe extern "C" fn _hb_harfrust_shape_rs( features: *const hb_feature_t, num_features: u32, ) -> hb_bool_t { - let font_data = font_data as *const HBHarfRuzzFontData; - let face_data = face_data as *const HBHarfRuzzFaceData; + let font_data = font_data as *const HBHarfRustFontData; + let face_data = face_data as *const HBHarfRustFaceData; let font_ref = &(*face_data).font_ref; @@ -186,7 +186,7 @@ pub unsafe extern "C" fn _hb_harfrust_shape_rs( let script = hb_buffer_get_script(buffer); let language = hb_buffer_get_language(buffer); let direction = hb_buffer_get_direction(buffer); - // Convert to HarfRuzz types + // Convert to HarfRust types let script = harfrust::Script::from_iso15924_tag(Tag::from_u32(script)) .unwrap_or(harfrust::script::UNKNOWN); let language = hb_language_to_hr_language(language); From 5060ccf4aa107dc9aa8e6a691755d4afe4f94744 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jun 2025 16:01:54 -0600 Subject: [PATCH 39/39] [rust] Ignore one more compiler symbol --- src/check-symbols.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/check-symbols.py b/src/check-symbols.py index 7321ed75a..6e00ba60b 100755 --- a/src/check-symbols.py +++ b/src/check-symbols.py @@ -42,6 +42,7 @@ IGNORED_SYMBOLS += [ "_ZN3std3sys3pal4unix4args3imp15ARGV_INIT_ARRAY.*", # 'std::sys::pal::unix::args::imp::ARGV_INIT_ARRAY::.*' "_ZN3std3sys4args4unix3imp15ARGV_INIT_ARRAY.*", # std::sys::args::unix::imp::ARGV_INIT_ARRAY::.* "_ZN17compiler_builtins.*", # 'compiler_builtins::.*' + ".*__rustc.*", # '.*__rustc.*' # Eg. _RNvCsgSLETaxrkfn_7___rustc17___rust_probestack '_hb_harfrust_.*_rs', ]