mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 14:31:10 +01:00
Merge branch 'main' into codex-review-pr-5733
This commit is contained in:
238 files changed
+4019
-1285
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
-r requirements-fonttools.in
|
||||
meson==1.11.1
|
||||
meson==1.11.2
|
||||
ninja
|
||||
setuptools # https://github.com/harfbuzz/harfbuzz/issues/4475
|
||||
@@ -106,9 +106,9 @@ fonttools==4.63.0 \
|
||||
--hash=sha256:fd1e3094f42d806d3d7c79162fc59e5910fcbe3a7360c385b8da969bc4493745 \
|
||||
--hash=sha256:fd1e3094f42d806d3d7c79162fc59e5910fcbe3a7360c385b8da969bc4493745
|
||||
# via -r requirements-fonttools.in
|
||||
meson==1.11.1 \
|
||||
--hash=sha256:9b3a023657e393dbc5335b95c561337d49b7a458f5541e47ec44f2cc566e0d80 \
|
||||
--hash=sha256:9b3a023657e393dbc5335b95c561337d49b7a458f5541e47ec44f2cc566e0d80
|
||||
meson==1.11.2 \
|
||||
--hash=sha256:698feae069cef3ecd4d7aaf281d7df359bdfcf555a9a1564383d3b913fa8a736 \
|
||||
--hash=sha256:7e4f6e83fec83e3eaac928e058b073c7557b282c35b6a2024cea143a39926a39
|
||||
# via -r requirements.in
|
||||
ninja==1.13.0 \
|
||||
--hash=sha256:11be2d22027bde06f14c343f01d31446747dbb51e72d00decca2eb99be911e2f \
|
||||
@@ -133,7 +133,7 @@ ninja==1.13.0 \
|
||||
# via -r requirements.in
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
setuptools==82.0.1 \
|
||||
--hash=sha256:7d872682c5d01cfde07da7bccc7b65469d3dca203318515ada1de5eda35efbf9 \
|
||||
--hash=sha256:a59e362652f08dcd477c78bb6e7bd9d80a7995bc73ce773050228a348ce2e5bb
|
||||
setuptools==83.0.0 \
|
||||
--hash=sha256:025bccbbf0fa05b6192bc64ae1e7b16e001fd6d6d4d5de03c97b1c1ade523bef \
|
||||
--hash=sha256:29b23c360f22f414dc7336bb39178cc7bcbf6021ed2733cde173f09dba19abb3
|
||||
# via -r requirements.in
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
container:
|
||||
image: devkitpro/devkitarm:latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -S . -B build \
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
name: ${{ matrix.config }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Create main.cc
|
||||
run: |
|
||||
cat <<EOF > main.cc
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
latest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- run: sudo apt-get install gcc clang wget git curl pkg-config libfreetype6-dev libglib2.0-dev libicu-dev libgraphite2-dev
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
- name: Install Dependencies
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
zip \
|
||||
${{ matrix.PACKAGES }}
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install Python Dependencies
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
with:
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install Python Dependencies
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
with:
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
zlib1g-dev \
|
||||
help2man
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install Python Dependencies
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
with:
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
ninja \
|
||||
pkgconf
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install Python Dependencies
|
||||
|
||||
@@ -27,14 +27,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
with:
|
||||
variant: sccache
|
||||
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.ARCH }}
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Setup MSVC
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@cf96e00c0aab3788743aaf63b64146f0d383cee9 # v2
|
||||
with:
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
with:
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
zlib1g-dev \
|
||||
bindgen
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install Python Dependencies
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
- name: Install Dependencies
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
libicu-dev \
|
||||
libgraphite2-dev
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install Python Dependencies
|
||||
|
||||
@@ -29,12 +29,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
|
||||
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
@@ -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@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v3.29.5
|
||||
uses: github/codeql-action/upload-sarif@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Setup Ccache
|
||||
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
|
||||
- name: Install Dependencies
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
libicu-dev \
|
||||
libgraphite2-dev
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install Python Dependencies
|
||||
|
||||
+35
-11
@@ -7,7 +7,9 @@ if(POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
## Disallow in-source builds, as CMake generated make files can collide with autotools ones
|
||||
@@ -58,6 +60,18 @@ option(HB_BUILD_SUBSET "Build harfbuzz-subset" ON)
|
||||
option(HB_BUILD_RASTER "Build harfbuzz-raster" ON)
|
||||
option(HB_BUILD_VECTOR "Build harfbuzz-vector" ON)
|
||||
option(HB_BUILD_GPU "Build harfbuzz-gpu" ON)
|
||||
set(HB_BUILD_GPU_DEMO "AUTO" CACHE STRING "Build hb-gpu demo tool (AUTO, ON, or OFF)")
|
||||
set_property(CACHE HB_BUILD_GPU_DEMO PROPERTY STRINGS AUTO ON OFF)
|
||||
string(TOUPPER "${HB_BUILD_GPU_DEMO}" HB_BUILD_GPU_DEMO)
|
||||
if (NOT HB_BUILD_GPU_DEMO MATCHES "^(AUTO|ON|OFF)$")
|
||||
message(FATAL_ERROR "HB_BUILD_GPU_DEMO must be AUTO, ON, or OFF")
|
||||
endif ()
|
||||
if (HB_BUILD_GPU_DEMO STREQUAL "ON" AND NOT HB_BUILD_GPU)
|
||||
message(FATAL_ERROR "HB_BUILD_GPU_DEMO is ON but HB_BUILD_GPU is OFF")
|
||||
endif ()
|
||||
if (HB_BUILD_GPU_DEMO STREQUAL "ON" AND NOT HB_BUILD_UTILS)
|
||||
message(FATAL_ERROR "HB_BUILD_GPU_DEMO is ON but HB_BUILD_UTILS is OFF")
|
||||
endif ()
|
||||
set(HB_HAVE_SUBSET ${HB_BUILD_SUBSET})
|
||||
set(HB_HAVE_RASTER ${HB_BUILD_RASTER})
|
||||
set(HB_HAVE_VECTOR ${HB_BUILD_VECTOR})
|
||||
@@ -246,7 +260,6 @@ set (subset_project_headers
|
||||
${PROJECT_SOURCE_DIR}/src/hb-subset-serialize.h
|
||||
)
|
||||
set (raster_project_sources
|
||||
${PROJECT_SOURCE_DIR}/src/hb-raster.cc
|
||||
${PROJECT_SOURCE_DIR}/src/hb-raster-image.cc
|
||||
${PROJECT_SOURCE_DIR}/src/hb-raster-image.hh
|
||||
${PROJECT_SOURCE_DIR}/src/hb-raster.hh
|
||||
@@ -352,7 +365,8 @@ if (HB_HAVE_ICU)
|
||||
|
||||
find_package(ICU REQUIRED COMPONENTS uc)
|
||||
|
||||
if (ICU_VERSION VERSION_GREATER_EQUAL 75.1)
|
||||
if (ICU_VERSION VERSION_GREATER_EQUAL 75.1 AND
|
||||
CMAKE_CXX_STANDARD LESS 17)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif ()
|
||||
|
||||
@@ -760,13 +774,6 @@ if (UNIX OR MINGW OR VITA)
|
||||
# No threadsafe statics as we do it ourselves
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics")
|
||||
endif ()
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
if (COMPILER_SUPPORTS_CXX11)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
else()
|
||||
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
|
||||
@@ -1037,7 +1044,7 @@ if (HB_BUILD_UTILS)
|
||||
target_link_libraries(hb-info harfbuzz-gobject harfbuzz)
|
||||
endif()
|
||||
|
||||
if (HB_BUILD_GPU)
|
||||
if (HB_BUILD_GPU AND NOT HB_BUILD_GPU_DEMO STREQUAL "OFF")
|
||||
find_package(OpenGL QUIET)
|
||||
find_package(GLEW QUIET)
|
||||
find_package(glfw3 QUIET)
|
||||
@@ -1071,6 +1078,23 @@ if (HB_BUILD_UTILS)
|
||||
"${D3D11_LIBRARY}"
|
||||
"${D3DCOMPILER_LIBRARY}")
|
||||
endif ()
|
||||
else ()
|
||||
set(_hb_gpu_demo_missing_deps)
|
||||
if (NOT OpenGL_FOUND)
|
||||
list(APPEND _hb_gpu_demo_missing_deps OpenGL)
|
||||
endif ()
|
||||
if (NOT GLEW_FOUND)
|
||||
list(APPEND _hb_gpu_demo_missing_deps GLEW)
|
||||
endif ()
|
||||
if (NOT glfw3_FOUND)
|
||||
list(APPEND _hb_gpu_demo_missing_deps glfw3)
|
||||
endif ()
|
||||
string(REPLACE ";" ", " _hb_gpu_demo_missing_deps "${_hb_gpu_demo_missing_deps}")
|
||||
if (HB_BUILD_GPU_DEMO STREQUAL "ON")
|
||||
message(FATAL_ERROR "HB_BUILD_GPU_DEMO is ON but missing dependencies: ${_hb_gpu_demo_missing_deps}")
|
||||
else ()
|
||||
message(STATUS "Not building hb-gpu: missing dependencies: ${_hb_gpu_demo_missing_deps}")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
+8
-4
@@ -119,10 +119,14 @@ You can make Wine less verbose, without hiding all errors, by setting:
|
||||
|
||||
Add this to your `.bashrc` or `.zshrc` file as well.
|
||||
|
||||
Next, let's try some non-Latin text. Unfortunately, the command-line parsing of
|
||||
our cross-compiled glib is not quite Unicode-aware, at least when run under
|
||||
Wine. So you will need to find some other way to feed Unicode text to the
|
||||
shaper. There are three different ways you can try:
|
||||
Next, let's try some non-Latin text. You can pass Unicode text to the commands
|
||||
and they /should/ just work:
|
||||
|
||||
- `wine build-win/util/hb-shape.exe perf/fonts/Amiri-Regular.ttf حرف`
|
||||
|
||||
If not, there are other ways to pass them to the commands that do not involve
|
||||
parsing Unicode-aware command-line arguments. There are three different ways
|
||||
you can try:
|
||||
|
||||
- `echo حرف | wine build-win/util/hb-shape.exe perf/fonts/Amiri-Regular.ttf`
|
||||
- `wine build-win/util/hb-shape.exe perf/fonts/Amiri-Regular.ttf -u 062D,0631,0641`
|
||||
|
||||
@@ -267,6 +267,8 @@ hb_paint_pop_transform_func_t
|
||||
hb_paint_funcs_set_pop_transform_func
|
||||
hb_paint_color_glyph_func_t
|
||||
hb_paint_funcs_set_color_glyph_func
|
||||
hb_paint_fill_glyph_func_t
|
||||
hb_paint_funcs_set_fill_glyph_func
|
||||
hb_paint_push_clip_glyph_func_t
|
||||
hb_paint_funcs_set_push_clip_glyph_func
|
||||
hb_paint_push_clip_rectangle_func_t
|
||||
@@ -312,6 +314,7 @@ hb_paint_push_font_transform
|
||||
hb_paint_push_inverse_font_transform
|
||||
hb_paint_pop_transform
|
||||
hb_paint_color_glyph
|
||||
hb_paint_fill_glyph
|
||||
hb_paint_push_clip_glyph
|
||||
hb_paint_push_clip_rectangle
|
||||
hb_paint_push_clip_path_start
|
||||
@@ -997,6 +1000,7 @@ hb_subset_serialize_link_t
|
||||
hb_subset_serialize_object_t
|
||||
hb_subset_serialize_or_fail
|
||||
<SUBSECTION Private>
|
||||
hb_subset_input_to_string_or_fail
|
||||
hb_subset_input_override_name_table
|
||||
hb_subset_cff_get_charstring_data
|
||||
hb_subset_cff_get_charstrings_index
|
||||
|
||||
@@ -207,8 +207,8 @@ struct IndexSubtable
|
||||
hb_barrier ();
|
||||
switch (u.header.indexFormat)
|
||||
{
|
||||
case 1: return_trace (u.format1.sanitize (c, glyph_count));
|
||||
case 3: return_trace (u.format3.sanitize (c, glyph_count));
|
||||
case 1: hb_barrier (); return_trace (u.format1.sanitize (c, glyph_count));
|
||||
case 3: hb_barrier (); return_trace (u.format3.sanitize (c, glyph_count));
|
||||
default:return_trace (true);
|
||||
}
|
||||
}
|
||||
@@ -224,8 +224,9 @@ struct IndexSubtable
|
||||
unsigned int local_offset = cbdt_prime_len - u.header.imageDataOffset;
|
||||
switch (u.header.indexFormat)
|
||||
{
|
||||
case 1: return_trace (u.format1.add_offset (c, local_offset, size));
|
||||
case 1: hb_barrier (); return_trace (u.format1.add_offset (c, local_offset, size));
|
||||
case 3: {
|
||||
hb_barrier ();
|
||||
if (!u.format3.add_offset (c, local_offset, size))
|
||||
return_trace (false);
|
||||
if (!(num_glyphs & 0x01)) // Pad to 32-bit alignment if needed.
|
||||
@@ -252,6 +253,7 @@ struct IndexSubtable
|
||||
switch (u.header.indexFormat)
|
||||
{
|
||||
case 1: {
|
||||
hb_barrier ();
|
||||
for (unsigned int i = 0; i < num_missing; i++)
|
||||
{
|
||||
if (unlikely (!u.format1.add_offset (c, local_offset, size)))
|
||||
@@ -261,6 +263,7 @@ struct IndexSubtable
|
||||
return_trace (true);
|
||||
}
|
||||
case 3: {
|
||||
hb_barrier ();
|
||||
for (unsigned int i = 0; i < num_missing; i++)
|
||||
{
|
||||
if (unlikely (!u.format3.add_offset (c, local_offset, size)))
|
||||
@@ -303,8 +306,8 @@ struct IndexSubtable
|
||||
TRACE_SERIALIZE (this);
|
||||
switch (u.header.indexFormat)
|
||||
{
|
||||
case 1: return_trace (u.format1.add_offset (c, local_offset, size));
|
||||
case 3: return_trace (u.format3.add_offset (c, local_offset, size));
|
||||
case 1: hb_barrier (); return_trace (u.format1.add_offset (c, local_offset, size));
|
||||
case 3: hb_barrier (); return_trace (u.format3.add_offset (c, local_offset, size));
|
||||
// TODO: Implement tables 2, 4, 5
|
||||
case 2: // Should be a no-op.
|
||||
case 4: case 5: // Handle sparse cases.
|
||||
@@ -329,8 +332,8 @@ struct IndexSubtable
|
||||
*format = u.header.imageFormat;
|
||||
switch (u.header.indexFormat)
|
||||
{
|
||||
case 1: return u.format1.get_image_data (idx, offset, length);
|
||||
case 3: return u.format3.get_image_data (idx, offset, length);
|
||||
case 1: hb_barrier (); return u.format1.get_image_data (idx, offset, length);
|
||||
case 3: hb_barrier (); return u.format3.get_image_data (idx, offset, length);
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
+144
-98
@@ -123,7 +123,9 @@ public:
|
||||
static unsigned
|
||||
color_alpha (hb_color_t color, float alpha)
|
||||
{
|
||||
return roundf (hb_color_get_alpha (color) * alpha);
|
||||
/* Font-supplied alpha is F2DOT14 plus variation deltas, so it can be
|
||||
* negative or greater than one; converting that to unsigned is UB. */
|
||||
return roundf (hb_color_get_alpha (color) * hb_clamp (alpha, 0.f, 1.f));
|
||||
}
|
||||
|
||||
hb_color_t get_color (unsigned int color_index, float alpha, hb_bool_t *is_foreground)
|
||||
@@ -391,6 +393,12 @@ struct Variable
|
||||
value.get_color_stop (c, stop, varIdxBase, instancer);
|
||||
}
|
||||
|
||||
void get_solid_color (hb_paint_context_t *c,
|
||||
hb_bool_t *is_foreground, hb_color_t *color) const
|
||||
{
|
||||
value.get_solid_color (c, varIdxBase, is_foreground, color);
|
||||
}
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
{
|
||||
return value.get_extend ();
|
||||
@@ -449,6 +457,12 @@ struct NoVariable
|
||||
value.get_color_stop (c, stop, VarIdx::NO_VARIATION, instancer);
|
||||
}
|
||||
|
||||
void get_solid_color (hb_paint_context_t *c,
|
||||
hb_bool_t *is_foreground, hb_color_t *color) const
|
||||
{
|
||||
value.get_solid_color (c, VarIdx::NO_VARIATION, is_foreground, color);
|
||||
}
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
{
|
||||
return value.get_extend ();
|
||||
@@ -624,44 +638,6 @@ struct ColorLine
|
||||
// or all of the specified modes.
|
||||
struct CompositeMode : HBUINT8
|
||||
{
|
||||
enum {
|
||||
// Porter-Duff modes
|
||||
// https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators
|
||||
COMPOSITE_CLEAR = 0, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_clear
|
||||
COMPOSITE_SRC = 1, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_src
|
||||
COMPOSITE_DEST = 2, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_dst
|
||||
COMPOSITE_SRC_OVER = 3, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcover
|
||||
COMPOSITE_DEST_OVER = 4, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_dstover
|
||||
COMPOSITE_SRC_IN = 5, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcin
|
||||
COMPOSITE_DEST_IN = 6, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_dstin
|
||||
COMPOSITE_SRC_OUT = 7, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcout
|
||||
COMPOSITE_DEST_OUT = 8, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_dstout
|
||||
COMPOSITE_SRC_ATOP = 9, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcatop
|
||||
COMPOSITE_DEST_ATOP = 10, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_dstatop
|
||||
COMPOSITE_XOR = 11, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_xor
|
||||
COMPOSITE_PLUS = 12, // https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_plus
|
||||
|
||||
// Blend modes
|
||||
// https://www.w3.org/TR/compositing-1/#blending
|
||||
COMPOSITE_SCREEN = 13, // https://www.w3.org/TR/compositing-1/#blendingscreen
|
||||
COMPOSITE_OVERLAY = 14, // https://www.w3.org/TR/compositing-1/#blendingoverlay
|
||||
COMPOSITE_DARKEN = 15, // https://www.w3.org/TR/compositing-1/#blendingdarken
|
||||
COMPOSITE_LIGHTEN = 16, // https://www.w3.org/TR/compositing-1/#blendinglighten
|
||||
COMPOSITE_COLOR_DODGE = 17, // https://www.w3.org/TR/compositing-1/#blendingcolordodge
|
||||
COMPOSITE_COLOR_BURN = 18, // https://www.w3.org/TR/compositing-1/#blendingcolorburn
|
||||
COMPOSITE_HARD_LIGHT = 19, // https://www.w3.org/TR/compositing-1/#blendinghardlight
|
||||
COMPOSITE_SOFT_LIGHT = 20, // https://www.w3.org/TR/compositing-1/#blendingsoftlight
|
||||
COMPOSITE_DIFFERENCE = 21, // https://www.w3.org/TR/compositing-1/#blendingdifference
|
||||
COMPOSITE_EXCLUSION = 22, // https://www.w3.org/TR/compositing-1/#blendingexclusion
|
||||
COMPOSITE_MULTIPLY = 23, // https://www.w3.org/TR/compositing-1/#blendingmultiply
|
||||
|
||||
// Modes that, uniquely, do not operate on components
|
||||
// https://www.w3.org/TR/compositing-1/#blendingnonseparable
|
||||
COMPOSITE_HSL_HUE = 24, // https://www.w3.org/TR/compositing-1/#blendinghue
|
||||
COMPOSITE_HSL_SATURATION = 25, // https://www.w3.org/TR/compositing-1/#blendingsaturation
|
||||
COMPOSITE_HSL_COLOR = 26, // https://www.w3.org/TR/compositing-1/#blendingcolor
|
||||
COMPOSITE_HSL_LUMINOSITY = 27, // https://www.w3.org/TR/compositing-1/#blendingluminosity
|
||||
};
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (1);
|
||||
};
|
||||
@@ -785,15 +761,21 @@ struct PaintSolid
|
||||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
void get_solid_color (hb_paint_context_t *c, uint32_t varIdxBase,
|
||||
hb_bool_t *is_foreground, hb_color_t *color) const
|
||||
{
|
||||
*color = c->get_color (paletteIndex,
|
||||
alpha.to_float (c->instancer (varIdxBase, 0)),
|
||||
is_foreground);
|
||||
}
|
||||
|
||||
void paint_glyph (hb_paint_context_t *c, uint32_t varIdxBase) const
|
||||
{
|
||||
TRACE_PAINT (this);
|
||||
hb_bool_t is_foreground;
|
||||
hb_color_t color;
|
||||
|
||||
color = c->get_color (paletteIndex,
|
||||
alpha.to_float (c->instancer (varIdxBase, 0)),
|
||||
&is_foreground);
|
||||
get_solid_color (c, varIdxBase, &is_foreground, &color);
|
||||
c->funcs->color (c->data, is_foreground, color);
|
||||
}
|
||||
|
||||
@@ -899,10 +881,10 @@ struct PaintRadialGradient
|
||||
{
|
||||
out->x0 = x0 + (int) roundf (instancer (varIdxBase, 0));
|
||||
out->y0 = y0 + (int) roundf (instancer (varIdxBase, 1));
|
||||
out->radius0 = radius0 + (unsigned) roundf (instancer (varIdxBase, 2));
|
||||
out->radius0 = hb_clamp ((int) radius0 + (int) roundf (instancer (varIdxBase, 2)), 0, 0xFFFF);
|
||||
out->x1 = x1 + (int) roundf (instancer (varIdxBase, 3));
|
||||
out->y1 = y1 + (int) roundf (instancer (varIdxBase, 4));
|
||||
out->radius1 = radius1 + (unsigned) roundf (instancer (varIdxBase, 5));
|
||||
out->radius1 = hb_clamp ((int) radius1 + (int) roundf (instancer (varIdxBase, 5)), 0, 0xFFFF);
|
||||
}
|
||||
|
||||
if (format == 7 && c->plan->all_axes_pinned)
|
||||
@@ -1040,17 +1022,7 @@ struct PaintGlyph
|
||||
return_trace (c->check_struct (this) && paint.sanitize (c, this));
|
||||
}
|
||||
|
||||
void paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
TRACE_PAINT (this);
|
||||
c->funcs->push_inverse_font_transform (c->data, c->font);
|
||||
c->funcs->push_clip_glyph (c->data, gid, c->font);
|
||||
c->funcs->push_font_transform (c->data, c->font);
|
||||
c->recurse (this+paint);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_clip (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
inline void paint_glyph (hb_paint_context_t *c) const;
|
||||
|
||||
HBUINT8 format; /* format = 10 */
|
||||
Offset24To<Paint> paint; /* Offset (from beginning of PaintGlyph table) to Paint subtable. */
|
||||
@@ -1618,11 +1590,49 @@ struct PaintComposite
|
||||
void paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
TRACE_PAINT (this);
|
||||
hb_paint_composite_mode_t composite_mode;
|
||||
switch ((unsigned int) mode)
|
||||
{
|
||||
case HB_PAINT_COMPOSITE_MODE_CLEAR:
|
||||
case HB_PAINT_COMPOSITE_MODE_SRC:
|
||||
case HB_PAINT_COMPOSITE_MODE_DEST:
|
||||
case HB_PAINT_COMPOSITE_MODE_SRC_OVER:
|
||||
case HB_PAINT_COMPOSITE_MODE_DEST_OVER:
|
||||
case HB_PAINT_COMPOSITE_MODE_SRC_IN:
|
||||
case HB_PAINT_COMPOSITE_MODE_DEST_IN:
|
||||
case HB_PAINT_COMPOSITE_MODE_SRC_OUT:
|
||||
case HB_PAINT_COMPOSITE_MODE_DEST_OUT:
|
||||
case HB_PAINT_COMPOSITE_MODE_SRC_ATOP:
|
||||
case HB_PAINT_COMPOSITE_MODE_DEST_ATOP:
|
||||
case HB_PAINT_COMPOSITE_MODE_XOR:
|
||||
case HB_PAINT_COMPOSITE_MODE_PLUS:
|
||||
case HB_PAINT_COMPOSITE_MODE_SCREEN:
|
||||
case HB_PAINT_COMPOSITE_MODE_OVERLAY:
|
||||
case HB_PAINT_COMPOSITE_MODE_DARKEN:
|
||||
case HB_PAINT_COMPOSITE_MODE_LIGHTEN:
|
||||
case HB_PAINT_COMPOSITE_MODE_COLOR_DODGE:
|
||||
case HB_PAINT_COMPOSITE_MODE_COLOR_BURN:
|
||||
case HB_PAINT_COMPOSITE_MODE_HARD_LIGHT:
|
||||
case HB_PAINT_COMPOSITE_MODE_SOFT_LIGHT:
|
||||
case HB_PAINT_COMPOSITE_MODE_DIFFERENCE:
|
||||
case HB_PAINT_COMPOSITE_MODE_EXCLUSION:
|
||||
case HB_PAINT_COMPOSITE_MODE_MULTIPLY:
|
||||
case HB_PAINT_COMPOSITE_MODE_HSL_HUE:
|
||||
case HB_PAINT_COMPOSITE_MODE_HSL_SATURATION:
|
||||
case HB_PAINT_COMPOSITE_MODE_HSL_COLOR:
|
||||
case HB_PAINT_COMPOSITE_MODE_HSL_LUMINOSITY:
|
||||
composite_mode = (hb_paint_composite_mode_t) (unsigned int) mode;
|
||||
break;
|
||||
default:
|
||||
composite_mode = HB_PAINT_COMPOSITE_MODE_CLEAR;
|
||||
break;
|
||||
}
|
||||
|
||||
c->funcs->push_group_for (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
|
||||
c->recurse (this+backdrop);
|
||||
c->funcs->push_group_for (c->data, (hb_paint_composite_mode_t) (int) mode);
|
||||
c->funcs->push_group_for (c->data, composite_mode);
|
||||
c->recurse (this+src);
|
||||
c->funcs->pop_group (c->data, (hb_paint_composite_mode_t) (int) mode);
|
||||
c->funcs->pop_group (c->data, composite_mode);
|
||||
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
|
||||
}
|
||||
|
||||
@@ -1712,8 +1722,8 @@ struct ClipBox
|
||||
{
|
||||
TRACE_SUBSET (this);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.subset (c, instancer, VarIdx::NO_VARIATION));
|
||||
case 2: return_trace (u.format2.subset (c, instancer));
|
||||
case 1: hb_barrier (); return_trace (u.format1.subset (c, instancer, VarIdx::NO_VARIATION));
|
||||
case 2: hb_barrier (); return_trace (u.format2.subset (c, instancer));
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
@@ -1721,7 +1731,7 @@ struct ClipBox
|
||||
void closurev1 (hb_colrv1_closure_context_t* c) const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 2: u.format2.closurev1 (c); return;
|
||||
case 2: hb_barrier (); u.format2.closurev1 (c); return;
|
||||
default:return;
|
||||
}
|
||||
}
|
||||
@@ -1732,8 +1742,8 @@ struct ClipBox
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
@@ -1744,9 +1754,11 @@ struct ClipBox
|
||||
ClipBoxData clip_box;
|
||||
switch (u.format.v) {
|
||||
case 1:
|
||||
hb_barrier ();
|
||||
u.format1.get_clip_box (clip_box, instancer);
|
||||
break;
|
||||
case 2:
|
||||
hb_barrier ();
|
||||
u.format2.get_clip_box (clip_box, instancer);
|
||||
break;
|
||||
default:
|
||||
@@ -1942,42 +1954,52 @@ struct Paint
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.paintformat1, std::forward<Ts> (ds)...));
|
||||
case 2: return_trace (c->dispatch (u.paintformat2, std::forward<Ts> (ds)...));
|
||||
case 3: return_trace (c->dispatch (u.paintformat3, std::forward<Ts> (ds)...));
|
||||
case 4: return_trace (c->dispatch (u.paintformat4, std::forward<Ts> (ds)...));
|
||||
case 5: return_trace (c->dispatch (u.paintformat5, std::forward<Ts> (ds)...));
|
||||
case 6: return_trace (c->dispatch (u.paintformat6, std::forward<Ts> (ds)...));
|
||||
case 7: return_trace (c->dispatch (u.paintformat7, std::forward<Ts> (ds)...));
|
||||
case 8: return_trace (c->dispatch (u.paintformat8, std::forward<Ts> (ds)...));
|
||||
case 9: return_trace (c->dispatch (u.paintformat9, std::forward<Ts> (ds)...));
|
||||
case 10: return_trace (c->dispatch (u.paintformat10, std::forward<Ts> (ds)...));
|
||||
case 11: return_trace (c->dispatch (u.paintformat11, std::forward<Ts> (ds)...));
|
||||
case 12: return_trace (c->dispatch (u.paintformat12, std::forward<Ts> (ds)...));
|
||||
case 13: return_trace (c->dispatch (u.paintformat13, std::forward<Ts> (ds)...));
|
||||
case 14: return_trace (c->dispatch (u.paintformat14, std::forward<Ts> (ds)...));
|
||||
case 15: return_trace (c->dispatch (u.paintformat15, std::forward<Ts> (ds)...));
|
||||
case 16: return_trace (c->dispatch (u.paintformat16, std::forward<Ts> (ds)...));
|
||||
case 17: return_trace (c->dispatch (u.paintformat17, std::forward<Ts> (ds)...));
|
||||
case 18: return_trace (c->dispatch (u.paintformat18, std::forward<Ts> (ds)...));
|
||||
case 19: return_trace (c->dispatch (u.paintformat19, std::forward<Ts> (ds)...));
|
||||
case 20: return_trace (c->dispatch (u.paintformat20, std::forward<Ts> (ds)...));
|
||||
case 21: return_trace (c->dispatch (u.paintformat21, std::forward<Ts> (ds)...));
|
||||
case 22: return_trace (c->dispatch (u.paintformat22, std::forward<Ts> (ds)...));
|
||||
case 23: return_trace (c->dispatch (u.paintformat23, std::forward<Ts> (ds)...));
|
||||
case 24: return_trace (c->dispatch (u.paintformat24, std::forward<Ts> (ds)...));
|
||||
case 25: return_trace (c->dispatch (u.paintformat25, std::forward<Ts> (ds)...));
|
||||
case 26: return_trace (c->dispatch (u.paintformat26, std::forward<Ts> (ds)...));
|
||||
case 27: return_trace (c->dispatch (u.paintformat27, std::forward<Ts> (ds)...));
|
||||
case 28: return_trace (c->dispatch (u.paintformat28, std::forward<Ts> (ds)...));
|
||||
case 29: return_trace (c->dispatch (u.paintformat29, std::forward<Ts> (ds)...));
|
||||
case 30: return_trace (c->dispatch (u.paintformat30, std::forward<Ts> (ds)...));
|
||||
case 31: return_trace (c->dispatch (u.paintformat31, std::forward<Ts> (ds)...));
|
||||
case 32: return_trace (c->dispatch (u.paintformat32, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.paintformat1, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.paintformat2, std::forward<Ts> (ds)...));
|
||||
case 3: hb_barrier (); return_trace (c->dispatch (u.paintformat3, std::forward<Ts> (ds)...));
|
||||
case 4: hb_barrier (); return_trace (c->dispatch (u.paintformat4, std::forward<Ts> (ds)...));
|
||||
case 5: hb_barrier (); return_trace (c->dispatch (u.paintformat5, std::forward<Ts> (ds)...));
|
||||
case 6: hb_barrier (); return_trace (c->dispatch (u.paintformat6, std::forward<Ts> (ds)...));
|
||||
case 7: hb_barrier (); return_trace (c->dispatch (u.paintformat7, std::forward<Ts> (ds)...));
|
||||
case 8: hb_barrier (); return_trace (c->dispatch (u.paintformat8, std::forward<Ts> (ds)...));
|
||||
case 9: hb_barrier (); return_trace (c->dispatch (u.paintformat9, std::forward<Ts> (ds)...));
|
||||
case 10: hb_barrier (); return_trace (c->dispatch (u.paintformat10, std::forward<Ts> (ds)...));
|
||||
case 11: hb_barrier (); return_trace (c->dispatch (u.paintformat11, std::forward<Ts> (ds)...));
|
||||
case 12: hb_barrier (); return_trace (c->dispatch (u.paintformat12, std::forward<Ts> (ds)...));
|
||||
case 13: hb_barrier (); return_trace (c->dispatch (u.paintformat13, std::forward<Ts> (ds)...));
|
||||
case 14: hb_barrier (); return_trace (c->dispatch (u.paintformat14, std::forward<Ts> (ds)...));
|
||||
case 15: hb_barrier (); return_trace (c->dispatch (u.paintformat15, std::forward<Ts> (ds)...));
|
||||
case 16: hb_barrier (); return_trace (c->dispatch (u.paintformat16, std::forward<Ts> (ds)...));
|
||||
case 17: hb_barrier (); return_trace (c->dispatch (u.paintformat17, std::forward<Ts> (ds)...));
|
||||
case 18: hb_barrier (); return_trace (c->dispatch (u.paintformat18, std::forward<Ts> (ds)...));
|
||||
case 19: hb_barrier (); return_trace (c->dispatch (u.paintformat19, std::forward<Ts> (ds)...));
|
||||
case 20: hb_barrier (); return_trace (c->dispatch (u.paintformat20, std::forward<Ts> (ds)...));
|
||||
case 21: hb_barrier (); return_trace (c->dispatch (u.paintformat21, std::forward<Ts> (ds)...));
|
||||
case 22: hb_barrier (); return_trace (c->dispatch (u.paintformat22, std::forward<Ts> (ds)...));
|
||||
case 23: hb_barrier (); return_trace (c->dispatch (u.paintformat23, std::forward<Ts> (ds)...));
|
||||
case 24: hb_barrier (); return_trace (c->dispatch (u.paintformat24, std::forward<Ts> (ds)...));
|
||||
case 25: hb_barrier (); return_trace (c->dispatch (u.paintformat25, std::forward<Ts> (ds)...));
|
||||
case 26: hb_barrier (); return_trace (c->dispatch (u.paintformat26, std::forward<Ts> (ds)...));
|
||||
case 27: hb_barrier (); return_trace (c->dispatch (u.paintformat27, std::forward<Ts> (ds)...));
|
||||
case 28: hb_barrier (); return_trace (c->dispatch (u.paintformat28, std::forward<Ts> (ds)...));
|
||||
case 29: hb_barrier (); return_trace (c->dispatch (u.paintformat29, std::forward<Ts> (ds)...));
|
||||
case 30: hb_barrier (); return_trace (c->dispatch (u.paintformat30, std::forward<Ts> (ds)...));
|
||||
case 31: hb_barrier (); return_trace (c->dispatch (u.paintformat31, std::forward<Ts> (ds)...));
|
||||
case 32: hb_barrier (); return_trace (c->dispatch (u.paintformat32, std::forward<Ts> (ds)...));
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
|
||||
bool get_solid_color (hb_paint_context_t *c,
|
||||
hb_bool_t *is_foreground, hb_color_t *color) const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 2: hb_barrier (); u.paintformat2.get_solid_color (c, is_foreground, color); return true;
|
||||
case 3: hb_barrier (); u.paintformat3.get_solid_color (c, is_foreground, color); return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
union {
|
||||
struct { HBUINT8 v; } format;
|
||||
@@ -2207,7 +2229,7 @@ struct COLR
|
||||
hb_array_t<const LayerRecord> all_layers = (this+layersZ).as_array (numLayers);
|
||||
hb_array_t<const LayerRecord> glyph_layers = all_layers.sub_array (record.firstLayerIdx,
|
||||
record.numLayers);
|
||||
if (count)
|
||||
if (count && layers)
|
||||
{
|
||||
+ glyph_layers.sub_array (start_offset, count)
|
||||
| hb_sink (hb_array (layers, *count))
|
||||
@@ -2882,9 +2904,7 @@ struct COLR
|
||||
{
|
||||
hb_bool_t is_foreground;
|
||||
hb_color_t color = c.get_color (r.colorIdx, 1., &is_foreground);
|
||||
c.funcs->push_clip_glyph (c.data, r.glyphId, c.font);
|
||||
c.funcs->color (c.data, is_foreground, color);
|
||||
c.funcs->pop_clip (c.data);
|
||||
c.funcs->fill_glyph (c.data, r.glyphId, c.font, is_foreground, color);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2926,6 +2946,32 @@ hb_paint_context_t::recurse (const Paint &paint)
|
||||
depth_left++;
|
||||
}
|
||||
|
||||
void PaintGlyph::paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
TRACE_PAINT (this);
|
||||
|
||||
hb_bool_t is_foreground;
|
||||
hb_color_t color;
|
||||
/* Optimize cases that can use a simple fill-glyph operation. */
|
||||
if (likely (c->depth_left > 0 && c->edge_count > 0) &&
|
||||
(this+paint).get_solid_color (c, &is_foreground, &color))
|
||||
{
|
||||
c->edge_count--;
|
||||
c->funcs->push_inverse_font_transform (c->data, c->font);
|
||||
c->funcs->fill_glyph (c->data, gid, c->font, is_foreground, color);
|
||||
c->funcs->pop_transform (c->data);
|
||||
return;
|
||||
}
|
||||
|
||||
c->funcs->push_inverse_font_transform (c->data, c->font);
|
||||
c->funcs->push_clip_glyph (c->data, gid, c->font);
|
||||
c->funcs->push_font_transform (c->data, c->font);
|
||||
c->recurse (this+paint);
|
||||
c->funcs->pop_transform (c->data);
|
||||
c->funcs->pop_clip (c->data);
|
||||
c->funcs->pop_transform (c->data);
|
||||
}
|
||||
|
||||
void PaintColrLayers::paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
TRACE_PAINT (this);
|
||||
|
||||
@@ -209,7 +209,7 @@ struct CPAL
|
||||
hb_array_t<const BGRAColor> all_colors ((this+colorRecordsZ).arrayZ, numColorRecords);
|
||||
hb_array_t<const BGRAColor> palette_colors = all_colors.sub_array (start_index,
|
||||
numColors);
|
||||
if (color_count)
|
||||
if (color_count && colors)
|
||||
{
|
||||
+ palette_colors.sub_array (start_offset, color_count)
|
||||
| hb_sink (hb_array (colors, *color_count))
|
||||
|
||||
@@ -499,7 +499,7 @@ parse_cache_entries_linear (const char *svg,
|
||||
while (p + name_len < gt)
|
||||
{
|
||||
unsigned char c = (unsigned char) name[name_len];
|
||||
if (!(isalnum (c) || c == '_' || c == '-' || c == ':'))
|
||||
if (!(ISALNUM (c) || c == '_' || c == '-' || c == ':'))
|
||||
break;
|
||||
name_len++;
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ struct Coverage
|
||||
hb_barrier ();
|
||||
switch (u.format.v)
|
||||
{
|
||||
case 1: return_trace (u.format1.sanitize (c));
|
||||
case 2: return_trace (u.format2.sanitize (c));
|
||||
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
|
||||
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return_trace (u.format3.sanitize (c));
|
||||
case 4: return_trace (u.format4.sanitize (c));
|
||||
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
|
||||
case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
|
||||
#endif
|
||||
default:return_trace (true);
|
||||
}
|
||||
@@ -87,11 +87,11 @@ struct Coverage
|
||||
unsigned int get_coverage (hb_codepoint_t glyph_id) const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1: return u.format1.get_coverage (glyph_id);
|
||||
case 2: return u.format2.get_coverage (glyph_id);
|
||||
case 1: hb_barrier (); return u.format1.get_coverage (glyph_id);
|
||||
case 2: hb_barrier (); return u.format2.get_coverage (glyph_id);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.get_coverage (glyph_id);
|
||||
case 4: return u.format4.get_coverage (glyph_id);
|
||||
case 3: hb_barrier (); return u.format3.get_coverage (glyph_id);
|
||||
case 4: hb_barrier (); return u.format4.get_coverage (glyph_id);
|
||||
#endif
|
||||
default:return NOT_COVERED;
|
||||
}
|
||||
@@ -129,11 +129,11 @@ struct Coverage
|
||||
unsigned get_population () const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1: return u.format1.get_population ();
|
||||
case 2: return u.format2.get_population ();
|
||||
case 1: hb_barrier (); return u.format1.get_population ();
|
||||
case 2: hb_barrier (); return u.format2.get_population ();
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.get_population ();
|
||||
case 4: return u.format4.get_population ();
|
||||
case 3: hb_barrier (); return u.format3.get_population ();
|
||||
case 4: hb_barrier (); return u.format4.get_population ();
|
||||
#endif
|
||||
default:return NOT_COVERED;
|
||||
}
|
||||
@@ -176,11 +176,11 @@ struct Coverage
|
||||
|
||||
switch (u.format.v)
|
||||
{
|
||||
case 1: return_trace (u.format1.serialize (c, glyphs));
|
||||
case 2: return_trace (u.format2.serialize (c, glyphs));
|
||||
case 1: hb_barrier (); return_trace (u.format1.serialize (c, glyphs));
|
||||
case 2: hb_barrier (); return_trace (u.format2.serialize (c, glyphs));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return_trace (u.format3.serialize (c, glyphs));
|
||||
case 4: return_trace (u.format4.serialize (c, glyphs));
|
||||
case 3: hb_barrier (); return_trace (u.format3.serialize (c, glyphs));
|
||||
case 4: hb_barrier (); return_trace (u.format4.serialize (c, glyphs));
|
||||
#endif
|
||||
default:return_trace (false);
|
||||
}
|
||||
@@ -207,11 +207,11 @@ struct Coverage
|
||||
{
|
||||
switch (u.format.v)
|
||||
{
|
||||
case 1: return u.format1.intersects (glyphs);
|
||||
case 2: return u.format2.intersects (glyphs);
|
||||
case 1: hb_barrier (); return u.format1.intersects (glyphs);
|
||||
case 2: hb_barrier (); return u.format2.intersects (glyphs);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.intersects (glyphs);
|
||||
case 4: return u.format4.intersects (glyphs);
|
||||
case 3: hb_barrier (); return u.format3.intersects (glyphs);
|
||||
case 4: hb_barrier (); return u.format4.intersects (glyphs);
|
||||
#endif
|
||||
default:return false;
|
||||
}
|
||||
@@ -220,11 +220,11 @@ struct Coverage
|
||||
{
|
||||
switch (u.format.v)
|
||||
{
|
||||
case 1: return u.format1.intersects_coverage (glyphs, index);
|
||||
case 2: return u.format2.intersects_coverage (glyphs, index);
|
||||
case 1: hb_barrier (); return u.format1.intersects_coverage (glyphs, index);
|
||||
case 2: hb_barrier (); return u.format2.intersects_coverage (glyphs, index);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.intersects_coverage (glyphs, index);
|
||||
case 4: return u.format4.intersects_coverage (glyphs, index);
|
||||
case 3: hb_barrier (); return u.format3.intersects_coverage (glyphs, index);
|
||||
case 4: hb_barrier (); return u.format4.intersects_coverage (glyphs, index);
|
||||
#endif
|
||||
default:return false;
|
||||
}
|
||||
@@ -250,11 +250,11 @@ struct Coverage
|
||||
{
|
||||
switch (u.format.v)
|
||||
{
|
||||
case 1: return u.format1.collect_coverage (glyphs);
|
||||
case 2: return u.format2.collect_coverage (glyphs);
|
||||
case 1: hb_barrier (); return u.format1.collect_coverage (glyphs);
|
||||
case 2: hb_barrier (); return u.format2.collect_coverage (glyphs);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.collect_coverage (glyphs);
|
||||
case 4: return u.format4.collect_coverage (glyphs);
|
||||
case 3: hb_barrier (); return u.format3.collect_coverage (glyphs);
|
||||
case 4: hb_barrier (); return u.format4.collect_coverage (glyphs);
|
||||
#endif
|
||||
default:return false;
|
||||
}
|
||||
@@ -266,11 +266,11 @@ struct Coverage
|
||||
{
|
||||
switch (u.format.v)
|
||||
{
|
||||
case 1: return u.format1.intersect_set (glyphs, intersect_glyphs);
|
||||
case 2: return u.format2.intersect_set (glyphs, intersect_glyphs);
|
||||
case 1: hb_barrier (); return u.format1.intersect_set (glyphs, intersect_glyphs);
|
||||
case 2: hb_barrier (); return u.format2.intersect_set (glyphs, intersect_glyphs);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.intersect_set (glyphs, intersect_glyphs);
|
||||
case 4: return u.format4.intersect_set (glyphs, intersect_glyphs);
|
||||
case 3: hb_barrier (); return u.format3.intersect_set (glyphs, intersect_glyphs);
|
||||
case 4: hb_barrier (); return u.format4.intersect_set (glyphs, intersect_glyphs);
|
||||
#endif
|
||||
default:return ;
|
||||
}
|
||||
@@ -285,11 +285,11 @@ struct Coverage
|
||||
format = c_.u.format.v;
|
||||
switch (format)
|
||||
{
|
||||
case 1: u.format1.init (c_.u.format1); return;
|
||||
case 2: u.format2.init (c_.u.format2); return;
|
||||
case 1: hb_barrier (); u.format1.init (c_.u.format1); return;
|
||||
case 2: hb_barrier (); u.format2.init (c_.u.format2); return;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: u.format3.init (c_.u.format3); return;
|
||||
case 4: u.format4.init (c_.u.format4); return;
|
||||
case 3: hb_barrier (); u.format3.init (c_.u.format3); return;
|
||||
case 4: hb_barrier (); u.format4.init (c_.u.format4); return;
|
||||
#endif
|
||||
default: return;
|
||||
}
|
||||
@@ -298,11 +298,11 @@ struct Coverage
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case 1: return u.format1.__more__ ();
|
||||
case 2: return u.format2.__more__ ();
|
||||
case 1: hb_barrier (); return u.format1.__more__ ();
|
||||
case 2: hb_barrier (); return u.format2.__more__ ();
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.__more__ ();
|
||||
case 4: return u.format4.__more__ ();
|
||||
case 3: hb_barrier (); return u.format3.__more__ ();
|
||||
case 4: hb_barrier (); return u.format4.__more__ ();
|
||||
#endif
|
||||
default:return false;
|
||||
}
|
||||
@@ -311,11 +311,11 @@ struct Coverage
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case 1: u.format1.__next__ (); break;
|
||||
case 2: u.format2.__next__ (); break;
|
||||
case 1: hb_barrier (); u.format1.__next__ (); break;
|
||||
case 2: hb_barrier (); u.format2.__next__ (); break;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: u.format3.__next__ (); break;
|
||||
case 4: u.format4.__next__ (); break;
|
||||
case 3: hb_barrier (); u.format3.__next__ (); break;
|
||||
case 4: hb_barrier (); u.format4.__next__ (); break;
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
@@ -327,11 +327,11 @@ struct Coverage
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case 1: return u.format1.get_glyph ();
|
||||
case 2: return u.format2.get_glyph ();
|
||||
case 1: hb_barrier (); return u.format1.get_glyph ();
|
||||
case 2: hb_barrier (); return u.format2.get_glyph ();
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3.get_glyph ();
|
||||
case 4: return u.format4.get_glyph ();
|
||||
case 3: hb_barrier (); return u.format3.get_glyph ();
|
||||
case 4: hb_barrier (); return u.format4.get_glyph ();
|
||||
#endif
|
||||
default:return 0;
|
||||
}
|
||||
@@ -341,11 +341,11 @@ struct Coverage
|
||||
if (unlikely (format != o.format)) return true;
|
||||
switch (format)
|
||||
{
|
||||
case 1: return u.format1 != o.u.format1;
|
||||
case 2: return u.format2 != o.u.format2;
|
||||
case 1: hb_barrier (); return u.format1 != o.u.format1;
|
||||
case 2: hb_barrier (); return u.format2 != o.u.format2;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return u.format3 != o.u.format3;
|
||||
case 4: return u.format4 != o.u.format4;
|
||||
case 3: hb_barrier (); return u.format3 != o.u.format3;
|
||||
case 4: hb_barrier (); return u.format4 != o.u.format4;
|
||||
#endif
|
||||
default:return false;
|
||||
}
|
||||
@@ -356,11 +356,11 @@ struct Coverage
|
||||
it.format = format;
|
||||
switch (format)
|
||||
{
|
||||
case 1: it.u.format1 = u.format1.__end__ (); break;
|
||||
case 2: it.u.format2 = u.format2.__end__ (); break;
|
||||
case 1: hb_barrier (); it.u.format1 = u.format1.__end__ (); break;
|
||||
case 2: hb_barrier (); it.u.format2 = u.format2.__end__ (); break;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: it.u.format3 = u.format3.__end__ (); break;
|
||||
case 4: it.u.format4 = u.format4.__end__ (); break;
|
||||
case 3: hb_barrier (); it.u.format3 = u.format3.__end__ (); break;
|
||||
case 4: hb_barrier (); it.u.format4 = u.format4.__end__ (); break;
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
|
||||
+46
-45
@@ -70,7 +70,7 @@ struct AttachList
|
||||
|
||||
const AttachPoint &points = this+attachPoint[index];
|
||||
|
||||
if (point_count)
|
||||
if (point_count && point_array)
|
||||
{
|
||||
+ points.as_array ().sub_array (start_offset, point_count)
|
||||
| hb_sink (hb_array (point_array, *point_count))
|
||||
@@ -253,9 +253,9 @@ struct CaretValue
|
||||
const ItemVariationStore &var_store) const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1: return u.format1.get_caret_value (font, direction);
|
||||
case 2: return u.format2.get_caret_value (font, direction, glyph_id);
|
||||
case 3: return u.format3.get_caret_value (font, direction, var_store);
|
||||
case 1: hb_barrier (); return u.format1.get_caret_value (font, direction);
|
||||
case 2: hb_barrier (); return u.format2.get_caret_value (font, direction, glyph_id);
|
||||
case 3: hb_barrier (); return u.format3.get_caret_value (font, direction, var_store);
|
||||
default:return 0;
|
||||
}
|
||||
}
|
||||
@@ -266,9 +266,9 @@ struct CaretValue
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
@@ -280,6 +280,7 @@ struct CaretValue
|
||||
case 2:
|
||||
return;
|
||||
case 3:
|
||||
hb_barrier ();
|
||||
u.format3.collect_variation_indices (c);
|
||||
return;
|
||||
default: return;
|
||||
@@ -292,9 +293,9 @@ struct CaretValue
|
||||
if (!u.format.v.sanitize (c)) return_trace (false);
|
||||
hb_barrier ();
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.sanitize (c));
|
||||
case 2: return_trace (u.format2.sanitize (c));
|
||||
case 3: return_trace (u.format3.sanitize (c));
|
||||
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
|
||||
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
|
||||
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
|
||||
default:return_trace (true);
|
||||
}
|
||||
}
|
||||
@@ -320,7 +321,7 @@ struct LigGlyph
|
||||
unsigned *caret_count /* IN/OUT */,
|
||||
hb_position_t *caret_array /* OUT */) const
|
||||
{
|
||||
if (caret_count)
|
||||
if (caret_count && caret_array)
|
||||
{
|
||||
+ carets.as_array ().sub_array (start_offset, caret_count)
|
||||
| hb_map (hb_add (this))
|
||||
@@ -520,7 +521,7 @@ struct MarkGlyphSets
|
||||
bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1: return u.format1.covers (set_index, glyph_id);
|
||||
case 1: hb_barrier (); return u.format1.covers (set_index, glyph_id);
|
||||
default:return false;
|
||||
}
|
||||
}
|
||||
@@ -529,7 +530,7 @@ struct MarkGlyphSets
|
||||
void collect_coverage (hb_vector_t<set_t> &sets) const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1: u.format1.collect_coverage (sets); return;
|
||||
case 1: hb_barrier (); u.format1.collect_coverage (sets); return;
|
||||
default:return;
|
||||
}
|
||||
}
|
||||
@@ -538,7 +539,7 @@ struct MarkGlyphSets
|
||||
hb_set_t& used_mark_sets /* OUT */) const
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1: u.format1.collect_used_mark_sets (glyph_set, used_mark_sets); return;
|
||||
case 1: hb_barrier (); u.format1.collect_used_mark_sets (glyph_set, used_mark_sets); return;
|
||||
default:return;
|
||||
}
|
||||
}
|
||||
@@ -547,7 +548,7 @@ struct MarkGlyphSets
|
||||
{
|
||||
TRACE_SUBSET (this);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.subset (c));
|
||||
case 1: hb_barrier (); return_trace (u.format1.subset (c));
|
||||
default:return_trace (false);
|
||||
}
|
||||
}
|
||||
@@ -558,7 +559,7 @@ struct MarkGlyphSets
|
||||
if (!u.format.v.sanitize (c)) return_trace (false);
|
||||
hb_barrier ();
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.sanitize (c));
|
||||
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
|
||||
default:return_trace (true);
|
||||
}
|
||||
}
|
||||
@@ -721,7 +722,7 @@ struct GDEFVersion1_2
|
||||
out->version.minor = 3;
|
||||
c->plan->has_gdef_varstore = true;
|
||||
} else if (subset_markglyphsetsdef) {
|
||||
out->version.minor = 2;
|
||||
out->version.minor = 2;
|
||||
} else {
|
||||
out->version.minor = 0;
|
||||
c->serializer->revert (snapshot_version0);
|
||||
@@ -758,9 +759,9 @@ struct GDEF
|
||||
size_t get_size () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version1.get_size ();
|
||||
case 1: hb_barrier (); return u.version1.get_size ();
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.get_size ();
|
||||
case 2: hb_barrier (); return u.version2.get_size ();
|
||||
#endif
|
||||
default: return u.version.static_size;
|
||||
}
|
||||
@@ -772,9 +773,9 @@ struct GDEF
|
||||
if (unlikely (!u.version.sanitize (c))) return_trace (false);
|
||||
hb_barrier ();
|
||||
switch (u.version.major) {
|
||||
case 1: return_trace (u.version1.sanitize (c));
|
||||
case 1: hb_barrier (); return_trace (u.version1.sanitize (c));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return_trace (u.version2.sanitize (c));
|
||||
case 2: hb_barrier (); return_trace (u.version2.sanitize (c));
|
||||
#endif
|
||||
default: return_trace (true);
|
||||
}
|
||||
@@ -783,9 +784,9 @@ struct GDEF
|
||||
bool subset (hb_subset_context_t *c) const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version1.subset (c);
|
||||
case 1: hb_barrier (); return u.version1.subset (c);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.subset (c);
|
||||
case 2: hb_barrier (); return u.version2.subset (c);
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
@@ -794,9 +795,9 @@ struct GDEF
|
||||
bool has_glyph_classes () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version1.glyphClassDef != 0;
|
||||
case 1: hb_barrier (); return u.version1.glyphClassDef != 0;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.glyphClassDef != 0;
|
||||
case 2: hb_barrier (); return u.version2.glyphClassDef != 0;
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
@@ -804,9 +805,9 @@ struct GDEF
|
||||
const ClassDef &get_glyph_class_def () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return this+u.version1.glyphClassDef;
|
||||
case 1: hb_barrier (); return this+u.version1.glyphClassDef;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return this+u.version2.glyphClassDef;
|
||||
case 2: hb_barrier (); return this+u.version2.glyphClassDef;
|
||||
#endif
|
||||
default: return Null(ClassDef);
|
||||
}
|
||||
@@ -814,9 +815,9 @@ struct GDEF
|
||||
bool has_attach_list () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version1.attachList != 0;
|
||||
case 1: hb_barrier (); return u.version1.attachList != 0;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.attachList != 0;
|
||||
case 2: hb_barrier (); return u.version2.attachList != 0;
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
@@ -824,9 +825,9 @@ struct GDEF
|
||||
const AttachList &get_attach_list () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return this+u.version1.attachList;
|
||||
case 1: hb_barrier (); return this+u.version1.attachList;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return this+u.version2.attachList;
|
||||
case 2: hb_barrier (); return this+u.version2.attachList;
|
||||
#endif
|
||||
default: return Null(AttachList);
|
||||
}
|
||||
@@ -834,9 +835,9 @@ struct GDEF
|
||||
bool has_lig_carets () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version1.ligCaretList != 0;
|
||||
case 1: hb_barrier (); return u.version1.ligCaretList != 0;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.ligCaretList != 0;
|
||||
case 2: hb_barrier (); return u.version2.ligCaretList != 0;
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
@@ -844,9 +845,9 @@ struct GDEF
|
||||
const LigCaretList &get_lig_caret_list () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return this+u.version1.ligCaretList;
|
||||
case 1: hb_barrier (); return this+u.version1.ligCaretList;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return this+u.version2.ligCaretList;
|
||||
case 2: hb_barrier (); return this+u.version2.ligCaretList;
|
||||
#endif
|
||||
default: return Null(LigCaretList);
|
||||
}
|
||||
@@ -854,9 +855,9 @@ struct GDEF
|
||||
bool has_mark_attachment_types () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version1.markAttachClassDef != 0;
|
||||
case 1: hb_barrier (); return u.version1.markAttachClassDef != 0;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.markAttachClassDef != 0;
|
||||
case 2: hb_barrier (); return u.version2.markAttachClassDef != 0;
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
@@ -864,9 +865,9 @@ struct GDEF
|
||||
const ClassDef &get_mark_attach_class_def () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return this+u.version1.markAttachClassDef;
|
||||
case 1: hb_barrier (); return this+u.version1.markAttachClassDef;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return this+u.version2.markAttachClassDef;
|
||||
case 2: hb_barrier (); return this+u.version2.markAttachClassDef;
|
||||
#endif
|
||||
default: return Null(ClassDef);
|
||||
}
|
||||
@@ -876,7 +877,7 @@ struct GDEF
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () && u.version1.markGlyphSetsDef != 0;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.markGlyphSetsDef != 0;
|
||||
case 2: hb_barrier (); return u.version2.markGlyphSetsDef != 0;
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
@@ -886,7 +887,7 @@ struct GDEF
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return this+u.version2.markGlyphSetsDef;
|
||||
case 2: hb_barrier (); return this+u.version2.markGlyphSetsDef;
|
||||
#endif
|
||||
default: return Null(MarkGlyphSets);
|
||||
}
|
||||
@@ -896,7 +897,7 @@ struct GDEF
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () && u.version1.varStore != 0;
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.varStore != 0;
|
||||
case 2: hb_barrier (); return u.version2.varStore != 0;
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
@@ -906,7 +907,7 @@ struct GDEF
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () ? this+u.version1.varStore : Null(ItemVariationStore);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return this+u.version2.varStore;
|
||||
case 2: hb_barrier (); return this+u.version2.varStore;
|
||||
#endif
|
||||
default: return Null(ItemVariationStore);
|
||||
}
|
||||
@@ -1003,14 +1004,14 @@ struct GDEF
|
||||
}
|
||||
|
||||
HB_ALWAYS_INLINE
|
||||
bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
|
||||
bool mark_set_may_cover (unsigned int set_index, hb_codepoint_t glyph_id) const
|
||||
{
|
||||
return
|
||||
#ifndef HB_NO_GDEF_CACHE
|
||||
// We can access arrayZ directly because of sanitize_lookup_props() guarantee.
|
||||
mark_glyph_sets.arrayZ[set_index].may_have (glyph_id) &&
|
||||
#endif
|
||||
table->mark_set_covers (set_index, glyph_id)
|
||||
true
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ struct Anchor
|
||||
if (!u.format.v.sanitize (c)) return_trace (false);
|
||||
hb_barrier ();
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.sanitize (c));
|
||||
case 2: return_trace (u.format2.sanitize (c));
|
||||
case 3: return_trace (u.format3.sanitize (c));
|
||||
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
|
||||
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
|
||||
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
|
||||
default:return_trace (true);
|
||||
}
|
||||
}
|
||||
@@ -39,9 +39,9 @@ struct Anchor
|
||||
{
|
||||
*x = *y = 0;
|
||||
switch (u.format.v) {
|
||||
case 1: u.format1.get_anchor (c, glyph_id, x, y); return;
|
||||
case 2: u.format2.get_anchor (c, glyph_id, x, y); return;
|
||||
case 3: u.format3.get_anchor (c, glyph_id, x, y); return;
|
||||
case 1: hb_barrier (); u.format1.get_anchor (c, glyph_id, x, y); return;
|
||||
case 2: hb_barrier (); u.format2.get_anchor (c, glyph_id, x, y); return;
|
||||
case 3: hb_barrier (); u.format3.get_anchor (c, glyph_id, x, y); return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
@@ -50,8 +50,9 @@ struct Anchor
|
||||
{
|
||||
TRACE_SUBSET (this);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
|
||||
case 1: hb_barrier (); return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
|
||||
case 2:
|
||||
hb_barrier ();
|
||||
if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
|
||||
{
|
||||
// AnchorFormat 2 just containins extra hinting information, so
|
||||
@@ -59,7 +60,7 @@ struct Anchor
|
||||
return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
|
||||
}
|
||||
return_trace (bool (reinterpret_cast<Anchor *> (u.format2.copy (c->serializer))));
|
||||
case 3: return_trace (u.format3.subset (c));
|
||||
case 3: hb_barrier (); return_trace (u.format3.subset (c));
|
||||
default:return_trace (false);
|
||||
}
|
||||
}
|
||||
@@ -70,6 +71,7 @@ struct Anchor
|
||||
case 1: case 2:
|
||||
return;
|
||||
case 3:
|
||||
hb_barrier ();
|
||||
u.format3.collect_variation_indices (c);
|
||||
return;
|
||||
default: return;
|
||||
|
||||
@@ -22,7 +22,7 @@ struct CursivePos
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ struct MarkBasePos
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ struct MarkLigPos
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ struct MarkMarkPos
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ struct PairPos
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
|
||||
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
|
||||
@@ -37,15 +37,15 @@ struct PosLookupSubTable
|
||||
{
|
||||
TRACE_DISPATCH (this, lookup_type);
|
||||
switch (lookup_type) {
|
||||
case Single: return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Pair: return_trace (u.pair.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Cursive: return_trace (u.cursive.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case MarkBase: return_trace (u.markBase.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case MarkLig: return_trace (u.markLig.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case MarkMark: return_trace (u.markMark.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Context: return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case ChainContext: return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Extension: return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Single: hb_barrier (); return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Pair: hb_barrier (); return_trace (u.pair.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Cursive: hb_barrier (); return_trace (u.cursive.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case MarkBase: hb_barrier (); return_trace (u.markBase.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case MarkLig: hb_barrier (); return_trace (u.markLig.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case MarkMark: hb_barrier (); return_trace (u.markMark.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Context: hb_barrier (); return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case ChainContext: hb_barrier (); return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Extension: hb_barrier (); return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
|
||||
default: return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ struct SinglePos
|
||||
|
||||
u.format.v = format;
|
||||
switch (u.format.v) {
|
||||
case 1: u.format1.serialize (c,
|
||||
case 1: hb_barrier (); u.format1.serialize (c,
|
||||
src,
|
||||
glyph_val_iter_pairs,
|
||||
new_format,
|
||||
layout_variation_idx_delta_map);
|
||||
return;
|
||||
case 2: u.format2.serialize (c,
|
||||
case 2: hb_barrier (); u.format2.serialize (c,
|
||||
src,
|
||||
glyph_val_iter_pairs,
|
||||
new_format,
|
||||
@@ -73,8 +73,8 @@ struct SinglePos
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ struct AlternateSet
|
||||
unsigned *alternate_count /* IN/OUT. May be NULL. */,
|
||||
hb_codepoint_t *alternate_glyphs /* OUT. May be NULL. */) const
|
||||
{
|
||||
if (alternates.len && alternate_count)
|
||||
if (alternates.len && alternate_count && alternate_glyphs)
|
||||
{
|
||||
+ alternates.as_array ().sub_array (start_offset, alternate_count)
|
||||
| hb_sink (hb_array (alternate_glyphs, *alternate_count))
|
||||
|
||||
@@ -26,9 +26,9 @@ struct AlternateSubst
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
@@ -46,7 +46,7 @@ struct AlternateSubst
|
||||
unsigned int format = 1;
|
||||
u.format.v = format;
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
|
||||
case 1: hb_barrier (); return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
|
||||
default:return_trace (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ struct LigatureSubst
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
@@ -49,7 +49,7 @@ struct LigatureSubst
|
||||
unsigned int format = 1;
|
||||
u.format.v = format;
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.serialize (c,
|
||||
case 1: hb_barrier (); return_trace (u.format1.serialize (c,
|
||||
first_glyphs,
|
||||
ligature_per_first_glyph_count_list,
|
||||
ligatures_list,
|
||||
|
||||
@@ -27,9 +27,9 @@ struct MultipleSubst
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
@@ -45,7 +45,7 @@ struct MultipleSubst
|
||||
unsigned int format = 1;
|
||||
u.format.v = format;
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.serialize (c, it));
|
||||
case 1: hb_barrier (); return_trace (u.format1.serialize (c, it));
|
||||
default:return_trace (false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ struct ReverseChainSingleSubst
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ struct SingleSubst
|
||||
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
|
||||
TRACE_DISPATCH (this, u.format.v);
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
|
||||
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default:return_trace (c->default_return_value ());
|
||||
}
|
||||
@@ -73,17 +73,17 @@ struct SingleSubst
|
||||
|
||||
u.format.v = format;
|
||||
switch (u.format.v) {
|
||||
case 1: return_trace (u.format1.serialize (c,
|
||||
case 1: hb_barrier (); return_trace (u.format1.serialize (c,
|
||||
+ glyphs
|
||||
| hb_map_retains_sorting (hb_first),
|
||||
delta));
|
||||
case 2: return_trace (u.format2.serialize (c, glyphs));
|
||||
case 2: hb_barrier (); return_trace (u.format2.serialize (c, glyphs));
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: return_trace (u.format3.serialize (c,
|
||||
case 3: hb_barrier (); return_trace (u.format3.serialize (c,
|
||||
+ glyphs
|
||||
| hb_map_retains_sorting (hb_first),
|
||||
delta));
|
||||
case 4: return_trace (u.format4.serialize (c, glyphs));
|
||||
case 4: hb_barrier (); return_trace (u.format4.serialize (c, glyphs));
|
||||
#endif
|
||||
default:return_trace (false);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ struct SingleSubstFormat1_3
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (alternate_count && *alternate_count)
|
||||
if (alternate_count && *alternate_count && alternate_glyphs)
|
||||
{
|
||||
hb_codepoint_t d = deltaGlyphID;
|
||||
hb_codepoint_t mask = get_mask ();
|
||||
|
||||
@@ -114,7 +114,7 @@ struct SingleSubstFormat2_4
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (alternate_count && *alternate_count)
|
||||
if (alternate_count && *alternate_count && alternate_glyphs)
|
||||
{
|
||||
glyph_id = substitute[index];
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ struct SubstLookup : Lookup
|
||||
bool is_reverse () const
|
||||
{
|
||||
unsigned int type = get_type ();
|
||||
if (unlikely (type == SubTable::Extension))
|
||||
if (unlikely (type == SubTable::Extension) && hb_barrier ())
|
||||
return get_subtable (0).u.extension.is_reverse ();
|
||||
return lookup_type_is_reverse (type);
|
||||
}
|
||||
|
||||
@@ -50,14 +50,14 @@ struct SubstLookupSubTable
|
||||
{
|
||||
TRACE_DISPATCH (this, lookup_type);
|
||||
switch (lookup_type) {
|
||||
case Single: return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Multiple: return_trace (u.multiple.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Alternate: return_trace (u.alternate.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Ligature: return_trace (u.ligature.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Context: return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case ChainContext: return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Extension: return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case ReverseChainSingle: return_trace (u.reverseChainContextSingle.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Single: hb_barrier (); return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Multiple: hb_barrier (); return_trace (u.multiple.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Alternate: hb_barrier (); return_trace (u.alternate.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Ligature: hb_barrier (); return_trace (u.ligature.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Context: hb_barrier (); return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case ChainContext: hb_barrier (); return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case Extension: hb_barrier (); return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
|
||||
case ReverseChainSingle: hb_barrier (); return_trace (u.reverseChainContextSingle.dispatch (c, std::forward<Ts> (ds)...));
|
||||
default: return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ _add_loca_and_head (hb_subset_context_t *c,
|
||||
unsigned num_offsets = c->plan->num_output_glyphs () + 1;
|
||||
unsigned entry_size = use_short_loca ? 2 : 4;
|
||||
|
||||
char *loca_prime_data = (char *) hb_malloc (entry_size * num_offsets);
|
||||
char *loca_prime_data = (char *) hb_malloc2 (num_offsets, entry_size);
|
||||
|
||||
if (unlikely (!loca_prime_data)) return false;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ if '--experimental-api' not in sys.argv:
|
||||
experimental_symbols = \
|
||||
"""hb_shape_justify
|
||||
hb_subset_input_override_name_table
|
||||
hb_subset_input_to_string_or_fail
|
||||
hb_subset_cff_get_charstring_data
|
||||
hb_subset_cff_get_charstrings_index
|
||||
hb_subset_cff2_get_charstring_data
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace graph {
|
||||
|
||||
struct ClassDefFormat1 : public OT::ClassDefFormat1_3<SmallTypes>
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
constexpr unsigned min_size = OT::ClassDefFormat1_3<SmallTypes>::min_size;
|
||||
@@ -46,7 +46,7 @@ struct ClassDefFormat1 : public OT::ClassDefFormat1_3<SmallTypes>
|
||||
|
||||
struct ClassDefFormat2 : public OT::ClassDefFormat2_4<SmallTypes>
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
constexpr unsigned min_size = OT::ClassDefFormat2_4<SmallTypes>::min_size;
|
||||
@@ -112,7 +112,7 @@ struct ClassDef : public OT::ClassDef
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < OT::ClassDef::min_size) return false;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace graph {
|
||||
|
||||
static bool sanitize (
|
||||
const OT::Layout::Common::CoverageFormat1_3<OT::Layout::SmallTypes>* thiz,
|
||||
graph_t::vertex_t& vertex
|
||||
const graph_t::vertex_t& vertex
|
||||
) {
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
constexpr unsigned min_size = OT::Layout::Common::CoverageFormat1_3<OT::Layout::SmallTypes>::min_size;
|
||||
@@ -45,7 +45,7 @@ static bool sanitize (
|
||||
|
||||
static bool sanitize (
|
||||
const OT::Layout::Common::CoverageFormat2_4<OT::Layout::SmallTypes>* thiz,
|
||||
graph_t::vertex_t& vertex
|
||||
const graph_t::vertex_t& vertex
|
||||
) {
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
constexpr unsigned min_size = OT::Layout::Common::CoverageFormat2_4<OT::Layout::SmallTypes>::min_size;
|
||||
@@ -156,7 +156,7 @@ struct Coverage : public OT::Layout::Common::Coverage
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < OT::Layout::Common::Coverage::min_size) return false;
|
||||
|
||||
+86
-76
@@ -52,6 +52,7 @@ struct graph_t
|
||||
unsigned single_parent = (unsigned) -1;
|
||||
bool has_incoming_virtual_edges_ = false;
|
||||
hb_hashmap_t<unsigned, unsigned> parents;
|
||||
hb_set_t virtual_parents;
|
||||
public:
|
||||
|
||||
auto parents_iter () const HB_AUTO_RETURN
|
||||
@@ -64,7 +65,7 @@ struct graph_t
|
||||
|
||||
bool in_error () const
|
||||
{
|
||||
return parents.in_error ();
|
||||
return parents.in_error () || virtual_parents.in_error ();
|
||||
}
|
||||
|
||||
bool has_incoming_virtual_edges () const
|
||||
@@ -171,6 +172,7 @@ struct graph_t
|
||||
hb_swap (a.space, b.space);
|
||||
hb_swap (a.single_parent, b.single_parent);
|
||||
hb_swap (a.parents, b.parents);
|
||||
hb_swap (a.virtual_parents, b.virtual_parents);
|
||||
hb_swap (a.incoming_edges_, b.incoming_edges_);
|
||||
hb_swap (a.has_incoming_virtual_edges_, b.has_incoming_virtual_edges_);
|
||||
hb_swap (a.start, b.start);
|
||||
@@ -193,7 +195,7 @@ struct graph_t
|
||||
|
||||
bool is_shared () const
|
||||
{
|
||||
return parents.get_population () > 1;
|
||||
return parents.get_population () > virtual_parents.get_population () + 1;
|
||||
}
|
||||
|
||||
unsigned incoming_edges () const
|
||||
@@ -221,12 +223,15 @@ struct graph_t
|
||||
has_incoming_virtual_edges_ = false;
|
||||
single_parent = (unsigned) -1;
|
||||
parents.reset ();
|
||||
virtual_parents.reset ();
|
||||
}
|
||||
|
||||
void add_parent (unsigned parent_index, bool is_virtual)
|
||||
{
|
||||
assert (parent_index != (unsigned) -1);
|
||||
has_incoming_virtual_edges_ |= is_virtual;
|
||||
if (is_virtual)
|
||||
virtual_parents.add (parent_index);
|
||||
|
||||
if (incoming_edges_ == 0)
|
||||
{
|
||||
@@ -258,6 +263,7 @@ struct graph_t
|
||||
{
|
||||
single_parent = (unsigned) -1;
|
||||
incoming_edges_--;
|
||||
virtual_parents.reset ();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,7 +274,10 @@ struct graph_t
|
||||
if (*v > 1)
|
||||
(*v)--;
|
||||
else
|
||||
{
|
||||
parents.del (parent_index);
|
||||
virtual_parents.del (parent_index);
|
||||
}
|
||||
|
||||
if (incoming_edges_ == 1)
|
||||
{
|
||||
@@ -295,37 +304,19 @@ struct graph_t
|
||||
}
|
||||
}
|
||||
|
||||
bool remap_parents (const hb_vector_t<unsigned>& id_map)
|
||||
{
|
||||
if (single_parent != (unsigned) -1)
|
||||
{
|
||||
assert (single_parent < id_map.length);
|
||||
single_parent = id_map[single_parent];
|
||||
return true;
|
||||
}
|
||||
|
||||
hb_hashmap_t<unsigned, unsigned> new_parents;
|
||||
new_parents.alloc (parents.get_population ());
|
||||
for (auto _ : parents)
|
||||
{
|
||||
assert (_.first < id_map.length);
|
||||
assert (!new_parents.has (id_map[_.first]));
|
||||
new_parents.set (id_map[_.first], _.second);
|
||||
}
|
||||
|
||||
if (parents.in_error() || new_parents.in_error ())
|
||||
return false;
|
||||
|
||||
parents = std::move (new_parents);
|
||||
return true;
|
||||
}
|
||||
|
||||
void remap_parent (unsigned old_index, unsigned new_index)
|
||||
{
|
||||
if (single_parent != (unsigned) -1)
|
||||
{
|
||||
if (single_parent == old_index)
|
||||
{
|
||||
single_parent = new_index;
|
||||
if (virtual_parents.has (old_index))
|
||||
{
|
||||
virtual_parents.del (old_index);
|
||||
virtual_parents.add (new_index);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -343,6 +334,12 @@ struct graph_t
|
||||
parents.reset ();
|
||||
}
|
||||
}
|
||||
|
||||
if (virtual_parents.has (old_index))
|
||||
{
|
||||
virtual_parents.del (old_index);
|
||||
virtual_parents.add (new_index);
|
||||
}
|
||||
}
|
||||
|
||||
bool is_leaf () const
|
||||
@@ -437,19 +434,29 @@ struct graph_t
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
enum vertex_mutability_t
|
||||
{
|
||||
Immutable,
|
||||
Mutable
|
||||
};
|
||||
|
||||
template <typename T, vertex_mutability_t mutability = Mutable>
|
||||
struct vertex_and_table_t
|
||||
{
|
||||
vertex_and_table_t () : index (0), vertex (nullptr), table (nullptr)
|
||||
{}
|
||||
|
||||
unsigned index;
|
||||
vertex_t* vertex;
|
||||
T* table;
|
||||
template <vertex_mutability_t other_mutability>
|
||||
vertex_and_table_t (const vertex_and_table_t<T, other_mutability>& o)
|
||||
: index (o.index), vertex (o.vertex), table (o.table)
|
||||
{}
|
||||
|
||||
operator bool () {
|
||||
return table && vertex;
|
||||
}
|
||||
unsigned index;
|
||||
typename std::conditional<mutability == Immutable, const vertex_t*, vertex_t*>::type vertex;
|
||||
typename std::conditional<mutability == Immutable, const T*, T*>::type table;
|
||||
|
||||
operator bool () const
|
||||
{ return table && vertex; }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -712,32 +719,32 @@ struct graph_t
|
||||
}
|
||||
|
||||
template <typename T, typename ...Ts>
|
||||
vertex_and_table_t<T> as_table (unsigned parent, const void* offset, Ts... ds)
|
||||
const vertex_and_table_t<T, Immutable> as_table (unsigned parent, const void* offset, Ts... ds)
|
||||
{
|
||||
return as_table_from_index<T> (index_for_offset (parent, offset), std::forward<Ts>(ds)...);
|
||||
}
|
||||
|
||||
template <typename T, typename ...Ts>
|
||||
vertex_and_table_t<T> as_mutable_table (unsigned parent, const void* offset, Ts... ds)
|
||||
vertex_and_table_t<T, Mutable> as_mutable_table (unsigned parent, const void* offset, Ts... ds)
|
||||
{
|
||||
return as_table_from_index<T> (mutable_index_for_offset (parent, offset), std::forward<Ts>(ds)...);
|
||||
return as_table_from_index<T, Mutable> (mutable_index_for_offset (parent, offset), std::forward<Ts>(ds)...);
|
||||
}
|
||||
|
||||
template <typename T, typename ...Ts>
|
||||
vertex_and_table_t<T> as_table_from_index (unsigned index, Ts... ds)
|
||||
template <typename T, vertex_mutability_t mutability = Mutable, typename ...Ts>
|
||||
vertex_and_table_t<T, mutability> as_table_from_index (unsigned index, Ts... ds)
|
||||
{
|
||||
if (index >= vertices_.length)
|
||||
return vertex_and_table_t<T> ();
|
||||
return vertex_and_table_t<T, mutability> ();
|
||||
|
||||
vertex_and_table_t<T> r;
|
||||
r.vertex = &vertices_[index];
|
||||
r.table = (T*) r.vertex->obj.head;
|
||||
vertex_and_table_t<T, mutability> r;
|
||||
r.vertex = (typename std::conditional<mutability == Immutable, const vertex_t*, vertex_t*>::type) &vertices_[index];
|
||||
r.table = (typename std::conditional<mutability == Immutable, const T*, T*>::type) r.vertex->obj.head;
|
||||
r.index = index;
|
||||
if (!r.table)
|
||||
return vertex_and_table_t<T> ();
|
||||
return vertex_and_table_t<T, mutability> ();
|
||||
|
||||
if (!r.table->sanitize (*(r.vertex), std::forward<Ts>(ds)...))
|
||||
return vertex_and_table_t<T> ();
|
||||
return vertex_and_table_t<T, mutability> ();
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -773,7 +780,7 @@ struct graph_t
|
||||
for (unsigned p : child.parents_iter ())
|
||||
{
|
||||
if (p != node_idx) {
|
||||
return duplicate (node_idx, child_idx);
|
||||
return duplicate (node_idx, child_idx, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,6 +823,9 @@ struct graph_t
|
||||
unsigned next_space = this->next_space ();
|
||||
if (next_space >= HB_REPACKER_MAX_SPACES)
|
||||
{
|
||||
DEBUG_MSG (SUBSET_REPACK, nullptr,
|
||||
"num of spaces %u exceeds HB_REPACKER_MAX_SPACES.",
|
||||
next_space);
|
||||
check_success (false);
|
||||
break;
|
||||
}
|
||||
@@ -1065,10 +1075,13 @@ struct graph_t
|
||||
/*
|
||||
* Creates a copy of node_idx and returns it's new index.
|
||||
*/
|
||||
unsigned duplicate (unsigned node_idx)
|
||||
unsigned duplicate (unsigned node_idx, bool copy_table = false)
|
||||
{
|
||||
if (vertices_.length >= HB_REPACKER_MAX_VERTICES)
|
||||
{
|
||||
DEBUG_MSG (SUBSET_REPACK, nullptr,
|
||||
"duplicating node: num of vertices %u exceeds HB_REPACKER_MAX_VERTICES.",
|
||||
vertices_.length);
|
||||
check_success (false);
|
||||
return -1;
|
||||
}
|
||||
@@ -1085,8 +1098,24 @@ struct graph_t
|
||||
return -1;
|
||||
}
|
||||
|
||||
clone->obj.head = child.obj.head;
|
||||
clone->obj.tail = child.obj.tail;
|
||||
unsigned table_size = child.obj.tail - child.obj.head;
|
||||
if (copy_table && table_size)
|
||||
{
|
||||
char* buffer = (char*) hb_malloc (table_size);
|
||||
if (!check_success (buffer && add_buffer (buffer)))
|
||||
{
|
||||
hb_free (buffer);
|
||||
return -1;
|
||||
}
|
||||
hb_memcpy (buffer, child.obj.head, table_size);
|
||||
clone->obj.head = buffer;
|
||||
clone->obj.tail = buffer + table_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
clone->obj.head = child.obj.head;
|
||||
clone->obj.tail = child.obj.tail;
|
||||
}
|
||||
clone->distance = child.distance;
|
||||
clone->space = child.space;
|
||||
clone->reset_parents ();
|
||||
@@ -1118,7 +1147,7 @@ struct graph_t
|
||||
* If the child_idx only has incoming edges from parent_idx,
|
||||
* duplication isn't possible and this will return -1.
|
||||
*/
|
||||
unsigned duplicate (unsigned parent_idx, unsigned child_idx)
|
||||
unsigned duplicate (unsigned parent_idx, unsigned child_idx, bool copy_table = false)
|
||||
{
|
||||
update_parents ();
|
||||
|
||||
@@ -1142,7 +1171,7 @@ struct graph_t
|
||||
DEBUG_MSG (SUBSET_REPACK, nullptr, " Duplicating %u => %u",
|
||||
parent_idx, child_idx);
|
||||
|
||||
unsigned clone_idx = duplicate (child_idx);
|
||||
unsigned clone_idx = duplicate (child_idx, copy_table);
|
||||
if (clone_idx == (unsigned) -1) return -1;
|
||||
// duplicate shifts the root node idx, so if parent_idx was root update it.
|
||||
if (parent_idx == clone_idx) parent_idx++;
|
||||
@@ -1234,6 +1263,9 @@ struct graph_t
|
||||
{
|
||||
if (vertices_.length >= HB_REPACKER_MAX_VERTICES)
|
||||
{
|
||||
DEBUG_MSG (SUBSET_REPACK, nullptr,
|
||||
"creating new node: num of vertices %u exceeds HB_REPACKER_MAX_VERTICES.",
|
||||
vertices_.length);
|
||||
check_success (false);
|
||||
return -1;
|
||||
}
|
||||
@@ -1285,31 +1317,6 @@ struct graph_t
|
||||
return new_child_idx;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new child node and remap the old child at specified position to it.
|
||||
*
|
||||
* Returns the index of the newly created child.
|
||||
*
|
||||
*/
|
||||
unsigned remap_child_at_position (unsigned parent_idx, unsigned old_child_idx, const void* offset)
|
||||
{
|
||||
const auto& parent = object (parent_idx);
|
||||
if (!offset || offset < parent.head || offset >= parent.tail) return -1;
|
||||
|
||||
for (auto& l : parent.real_links)
|
||||
{
|
||||
if (l.objidx != old_child_idx || offset != parent.head + l.position)
|
||||
continue;
|
||||
|
||||
unsigned new_child_idx = duplicate (old_child_idx);
|
||||
if (new_child_idx == (unsigned) -1) return -1;
|
||||
reassign_link (l, parent_idx, new_child_idx, false);
|
||||
return new_child_idx;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Raises the sorting priority of all children.
|
||||
*/
|
||||
@@ -1428,6 +1435,9 @@ struct graph_t
|
||||
{
|
||||
if (num_roots_for_space_.length >= HB_REPACKER_MAX_SPACES)
|
||||
{
|
||||
DEBUG_MSG (SUBSET_REPACK, nullptr,
|
||||
"move_to_new_space: num of spaces %u exceeds HB_REPACKER_MAX_SPACES.",
|
||||
num_roots_for_space_.length);
|
||||
check_success (false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ struct ExtensionFormat1 : public OT::ExtensionFormat1<T>
|
||||
this->extensionOffset = 0;
|
||||
}
|
||||
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
return vertex_len >= OT::ExtensionFormat1<T>::static_size;
|
||||
@@ -74,7 +74,7 @@ struct Lookup : public OT::Lookup
|
||||
return subTable.len;
|
||||
}
|
||||
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < OT::Lookup::min_size) return false;
|
||||
@@ -414,9 +414,9 @@ struct GSTAR : public OT::GSUBGPOS
|
||||
const void* get_lookup_list_field_offset () const
|
||||
{
|
||||
switch (u.version.major) {
|
||||
case 1: return u.version1.get_lookup_list_offset ();
|
||||
case 1: hb_barrier (); return u.version1.get_lookup_list_offset ();
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: return u.version2.get_lookup_list_offset ();
|
||||
case 2: hb_barrier (); return u.version2.get_lookup_list_offset ();
|
||||
#endif
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
+12
-30
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* Copyright © 2025 Google, Inc.
|
||||
*
|
||||
@@ -39,7 +40,7 @@ namespace graph {
|
||||
|
||||
struct LigatureSet : public OT::Layout::GSUB_impl::LigatureSet<SmallTypes>
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < OT::Layout::GSUB_impl::LigatureSet<SmallTypes>::min_size) return false;
|
||||
@@ -55,7 +56,7 @@ struct LigatureSet : public OT::Layout::GSUB_impl::LigatureSet<SmallTypes>
|
||||
|
||||
struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1_2<SmallTypes>
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
unsigned min_size = OT::Layout::GSUB_impl::LigatureSubstFormat1_2<SmallTypes>::min_size;
|
||||
@@ -70,7 +71,7 @@ struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1
|
||||
unsigned this_index)
|
||||
{
|
||||
auto split_points = compute_split_points(c, this_index);
|
||||
if (!split_points || !duplicate_shared_liga_sets(c, this_index))
|
||||
if (!split_points)
|
||||
return hb_vector_t<unsigned> ();
|
||||
|
||||
split_context_t split_context {
|
||||
@@ -107,7 +108,8 @@ struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1
|
||||
return result;
|
||||
}
|
||||
|
||||
hb_vector_t<unsigned> ligature_index_to_object_id(const graph_t::vertex_and_table_t<LigatureSet>& liga_set) const {
|
||||
template <graph_t::vertex_mutability_t mutability>
|
||||
hb_vector_t<unsigned> ligature_index_to_object_id(const graph_t::vertex_and_table_t<LigatureSet, mutability>& liga_set) const {
|
||||
hb_vector_t<unsigned> map;
|
||||
map.resize_exact(liga_set.table->ligature.len);
|
||||
if (map.in_error()) return map;
|
||||
@@ -124,28 +126,6 @@ struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1
|
||||
return map;
|
||||
}
|
||||
|
||||
bool duplicate_shared_liga_sets(gsubgpos_graph_context_t& c, unsigned this_index) const
|
||||
{
|
||||
hb_set_t visited;
|
||||
for (unsigned i = 0; i < ligatureSet.len; i++)
|
||||
{
|
||||
auto liga_set = c.graph.as_table<LigatureSet>(this_index, &ligatureSet[i]);
|
||||
if (!liga_set.table) return false;
|
||||
|
||||
unsigned liga_set_index = liga_set.index;
|
||||
if (visited.has (liga_set_index))
|
||||
{
|
||||
unsigned new_index = c.graph.remap_child_at_position (this_index, liga_set_index, &ligatureSet[i]);
|
||||
if (new_index == (unsigned) -1) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
visited.add (liga_set_index);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
hb_vector_t<unsigned> compute_split_points(gsubgpos_graph_context_t& c,
|
||||
unsigned this_index) const
|
||||
{
|
||||
@@ -342,12 +322,12 @@ struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1
|
||||
continue;
|
||||
}
|
||||
|
||||
auto liga_set_index = c.graph.index_for_offset(this_index, &ligatureSet[i]);
|
||||
auto liga_set = c.graph.as_table<LigatureSet>(this_index, &ligatureSet[i]);
|
||||
auto liga_set = c.graph.as_mutable_table<LigatureSet>(this_index, &ligatureSet[i]);
|
||||
if (!liga_set.table) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned liga_set_index = liga_set.index;
|
||||
// Bounds may need to be adjusted if some ligas have been previously removed.
|
||||
hb_pair_t<unsigned, unsigned> liga_bounds = current_liga_set_bounds(c, liga_set_index, liga_set.vertex->obj);
|
||||
current_start = hb_max(count + liga_bounds.first, current_start);
|
||||
@@ -428,7 +408,7 @@ struct LigatureSubstFormat1 : public OT::Layout::GSUB_impl::LigatureSubstFormat1
|
||||
unsigned new_liga_set_count = 0;
|
||||
for (unsigned i = 0; i < liga_counts.length; i++)
|
||||
{
|
||||
auto liga_set = c.graph.as_table<LigatureSet>(this_index, &ligatureSet[i]);
|
||||
auto liga_set = c.graph.as_mutable_table<LigatureSet>(this_index, &ligatureSet[i]);
|
||||
if (!liga_set.table) {
|
||||
return false;
|
||||
}
|
||||
@@ -505,6 +485,7 @@ struct LigatureSubst : public OT::Layout::GSUB_impl::LigatureSubst
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1:
|
||||
hb_barrier ();
|
||||
return ((LigatureSubstFormat1*)(&u.format1))->split_subtables (c, this_index);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: HB_FALLTHROUGH;
|
||||
@@ -515,7 +496,7 @@ struct LigatureSubst : public OT::Layout::GSUB_impl::LigatureSubst
|
||||
}
|
||||
}
|
||||
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < u.format.v.get_size ()) return false;
|
||||
@@ -523,6 +504,7 @@ struct LigatureSubst : public OT::Layout::GSUB_impl::LigatureSubst
|
||||
|
||||
switch (u.format.v) {
|
||||
case 1:
|
||||
hb_barrier ();
|
||||
return ((LigatureSubstFormat1*)(&u.format1))->sanitize (vertex);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: HB_FALLTHROUGH;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace graph {
|
||||
|
||||
struct AnchorMatrix : public OT::Layout::GPOS_impl::AnchorMatrix
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex, unsigned class_count) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex, unsigned class_count) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < AnchorMatrix::min_size) return false;
|
||||
@@ -124,7 +124,7 @@ struct AnchorMatrix : public OT::Layout::GPOS_impl::AnchorMatrix
|
||||
|
||||
struct MarkArray : public OT::Layout::GPOS_impl::MarkArray
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
unsigned min_size = MarkArray::min_size;
|
||||
@@ -205,7 +205,7 @@ struct MarkArray : public OT::Layout::GPOS_impl::MarkArray
|
||||
|
||||
struct MarkBasePosFormat1 : public OT::Layout::GPOS_impl::MarkBasePosFormat1_2<SmallTypes>
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
return vertex_len >= MarkBasePosFormat1::static_size;
|
||||
@@ -448,7 +448,7 @@ struct MarkBasePosFormat1 : public OT::Layout::GPOS_impl::MarkBasePosFormat1_2<S
|
||||
return -1;
|
||||
|
||||
auto mark_array =
|
||||
graph.as_table <MarkArray> (sc.this_index, &markArray);
|
||||
graph.as_mutable_table <MarkArray> (sc.this_index, &markArray);
|
||||
if (!mark_array) return -1;
|
||||
unsigned new_mark_array =
|
||||
mark_array.table->clone (sc.c,
|
||||
@@ -460,7 +460,7 @@ struct MarkBasePosFormat1 : public OT::Layout::GPOS_impl::MarkBasePosFormat1_2<S
|
||||
|
||||
unsigned class_count = classCount;
|
||||
auto base_array =
|
||||
graph.as_table<AnchorMatrix> (sc.this_index, &baseArray, class_count);
|
||||
graph.as_mutable_table<AnchorMatrix> (sc.this_index, &baseArray, class_count);
|
||||
if (!base_array) return -1;
|
||||
unsigned new_base_array =
|
||||
base_array.table->clone (sc.c,
|
||||
@@ -480,6 +480,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1:
|
||||
hb_barrier ();
|
||||
return ((MarkBasePosFormat1*)(&u.format1))->split_subtables (c, this_index);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: HB_FALLTHROUGH;
|
||||
@@ -490,7 +491,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
|
||||
}
|
||||
}
|
||||
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < u.format.v.get_size ()) return false;
|
||||
@@ -498,6 +499,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
|
||||
|
||||
switch (u.format.v) {
|
||||
case 1:
|
||||
hb_barrier ();
|
||||
return ((MarkBasePosFormat1*)(&u.format1))->sanitize (vertex);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 2: HB_FALLTHROUGH;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace graph {
|
||||
|
||||
struct PairPosFormat1 : public OT::Layout::GPOS_impl::PairPosFormat1_3<SmallTypes>
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
unsigned min_size = OT::Layout::GPOS_impl::PairPosFormat1_3<SmallTypes>::min_size;
|
||||
@@ -193,7 +193,7 @@ struct PairPosFormat1 : public OT::Layout::GPOS_impl::PairPosFormat1_3<SmallType
|
||||
|
||||
struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallTypes>
|
||||
{
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.table_size ();
|
||||
unsigned min_size = OT::Layout::GPOS_impl::PairPosFormat2_4<SmallTypes>::min_size;
|
||||
@@ -608,8 +608,10 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos
|
||||
{
|
||||
switch (u.format.v) {
|
||||
case 1:
|
||||
hb_barrier ();
|
||||
return ((PairPosFormat1*)(&u.format1))->split_subtables (c, this_index);
|
||||
case 2:
|
||||
hb_barrier ();
|
||||
return ((PairPosFormat2*)(&u.format2))->split_subtables (c, this_index);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: HB_FALLTHROUGH;
|
||||
@@ -621,7 +623,7 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos
|
||||
}
|
||||
}
|
||||
|
||||
bool sanitize (graph_t::vertex_t& vertex) const
|
||||
bool sanitize (const graph_t::vertex_t& vertex) const
|
||||
{
|
||||
size_t vertex_len = vertex.obj.tail - vertex.obj.head;
|
||||
if (vertex_len < u.format.v.get_size ()) return false;
|
||||
@@ -629,8 +631,10 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos
|
||||
|
||||
switch (u.format.v) {
|
||||
case 1:
|
||||
hb_barrier ();
|
||||
return ((PairPosFormat1*)(&u.format1))->sanitize (vertex);
|
||||
case 2:
|
||||
hb_barrier ();
|
||||
return ((PairPosFormat2*)(&u.format2))->sanitize (vertex);
|
||||
#ifndef HB_NO_BEYOND_64K
|
||||
case 3: HB_FALLTHROUGH;
|
||||
|
||||
@@ -176,7 +176,12 @@ serialize_link_of_type (const hb_serialize_context_t::object_t::link_t& link,
|
||||
const hb_vector_t<unsigned>& id_map,
|
||||
hb_serialize_context_t* c)
|
||||
{
|
||||
assert(link.position + link.width <= size);
|
||||
// A link must never write outside the bounds of its parent object.
|
||||
if (unlikely (link.position + link.width > size))
|
||||
{
|
||||
c->err (HB_SERIALIZE_ERROR_OTHER);
|
||||
return;
|
||||
}
|
||||
|
||||
OT::Offset<O>* offset = reinterpret_cast<OT::Offset<O>*> (head + link.position);
|
||||
*offset = 0;
|
||||
|
||||
@@ -4,31 +4,40 @@ set_and_check(HARFBUZZ_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
|
||||
set(HARFBUZZ_VERSION "@HARFBUZZ_VERSION@")
|
||||
|
||||
function(_harfbuzz_set_imported_library target library_name)
|
||||
set_target_properties("${target}" PROPERTIES
|
||||
IMPORTED_LOCATION "@HB_LIB_DIR@/@HB_LIB_PREFIX@${library_name}@HB_LIB_SUFFIX@")
|
||||
if (@HB_HAS_IMPORT_LIBRARY@)
|
||||
set_target_properties("${target}" PROPERTIES
|
||||
IMPORTED_IMPLIB "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@HB_IMPLIB_PREFIX@${library_name}@HB_IMPLIB_SUFFIX@")
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
# Add the libraries.
|
||||
add_library(harfbuzz::harfbuzz @HB_LIBRARY_TYPE@ IMPORTED)
|
||||
set_target_properties(harfbuzz::harfbuzz PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "@PACKAGE_INCLUDE_INSTALL_DIR@"
|
||||
IMPORTED_LOCATION "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@HB_LIB_PREFIX@harfbuzz@HB_LIB_SUFFIX@")
|
||||
INTERFACE_INCLUDE_DIRECTORIES "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
_harfbuzz_set_imported_library(harfbuzz::harfbuzz harfbuzz)
|
||||
|
||||
add_library(harfbuzz::icu @HB_LIBRARY_TYPE@ IMPORTED)
|
||||
set_target_properties(harfbuzz::icu PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "@PACKAGE_INCLUDE_INSTALL_DIR@"
|
||||
INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz"
|
||||
IMPORTED_LOCATION "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@HB_LIB_PREFIX@harfbuzz-icu@HB_LIB_SUFFIX@")
|
||||
INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz")
|
||||
_harfbuzz_set_imported_library(harfbuzz::icu harfbuzz-icu)
|
||||
|
||||
add_library(harfbuzz::subset @HB_LIBRARY_TYPE@ IMPORTED)
|
||||
set_target_properties(harfbuzz::subset PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "@PACKAGE_INCLUDE_INSTALL_DIR@"
|
||||
INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz"
|
||||
IMPORTED_LOCATION "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@HB_LIB_PREFIX@harfbuzz-subset@HB_LIB_SUFFIX@")
|
||||
INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz")
|
||||
_harfbuzz_set_imported_library(harfbuzz::subset harfbuzz-subset)
|
||||
|
||||
# Only add the gobject library if it was built.
|
||||
if (@HB_HAVE_GOBJECT@)
|
||||
add_library(harfbuzz::gobject @HB_LIBRARY_TYPE@ IMPORTED)
|
||||
set_target_properties(harfbuzz::gobject PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "@PACKAGE_INCLUDE_INSTALL_DIR@"
|
||||
INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz"
|
||||
IMPORTED_LOCATION "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@HB_LIB_PREFIX@harfbuzz-gobject@HB_LIB_SUFFIX@")
|
||||
INTERFACE_LINK_LIBRARIES "harfbuzz::harfbuzz")
|
||||
_harfbuzz_set_imported_library(harfbuzz::gobject harfbuzz-gobject)
|
||||
endif ()
|
||||
|
||||
check_required_components(harfbuzz)
|
||||
@@ -55,7 +55,6 @@
|
||||
#include "hb-style.cc"
|
||||
#include "hb-subset-cff-common.cc"
|
||||
#include "hb-subset-cff1.cc"
|
||||
#include "hb-subset-cff2-to-cff1.cc"
|
||||
#include "hb-subset-cff2.cc"
|
||||
#include "hb-subset-input.cc"
|
||||
#include "hb-subset-instancer-iup.cc"
|
||||
|
||||
@@ -137,7 +137,6 @@
|
||||
#include "hb-raster-draw.cc"
|
||||
#include "hb-raster-image.cc"
|
||||
#include "hb-raster-paint.cc"
|
||||
#include "hb-raster.cc"
|
||||
#include "hb-static.cc"
|
||||
#endif
|
||||
|
||||
@@ -150,7 +149,6 @@
|
||||
#include "hb-static.cc"
|
||||
#include "hb-subset-cff-common.cc"
|
||||
#include "hb-subset-cff1.cc"
|
||||
#include "hb-subset-cff2-to-cff1.cc"
|
||||
#include "hb-subset-cff2.cc"
|
||||
#include "hb-subset-input.cc"
|
||||
#include "hb-subset-instancer-iup.cc"
|
||||
|
||||
@@ -127,10 +127,10 @@ struct bsln
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case 0: return_trace (parts.format0.sanitize (c));
|
||||
case 1: return_trace (parts.format1.sanitize (c));
|
||||
case 2: return_trace (parts.format2.sanitize (c));
|
||||
case 3: return_trace (parts.format3.sanitize (c));
|
||||
case 0: hb_barrier (); return_trace (parts.format0.sanitize (c));
|
||||
case 1: hb_barrier (); return_trace (parts.format1.sanitize (c));
|
||||
case 2: hb_barrier (); return_trace (parts.format2.sanitize (c));
|
||||
case 3: hb_barrier (); return_trace (parts.format3.sanitize (c));
|
||||
default:return_trace (true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ struct Lookup
|
||||
public:
|
||||
DEFINE_SIZE_UNION (2, format.v);
|
||||
};
|
||||
DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2);
|
||||
DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 13);
|
||||
|
||||
/*
|
||||
* (Extended) State Table
|
||||
|
||||
@@ -114,7 +114,7 @@ struct FeatureName
|
||||
if (pdefault_index)
|
||||
*pdefault_index = default_index;
|
||||
|
||||
if (selectors_count)
|
||||
if (selectors_count && selectors)
|
||||
{
|
||||
+ settings_table.sub_array (start_offset, selectors_count)
|
||||
| hb_map ([=] (const SettingName& setting) { return setting.get_info (default_selector); })
|
||||
@@ -168,7 +168,7 @@ struct feat
|
||||
unsigned int *count,
|
||||
hb_aat_layout_feature_type_t *features) const
|
||||
{
|
||||
if (count)
|
||||
if (count && features)
|
||||
{
|
||||
+ namesZ.as_array (featureNameCount).sub_array (start_offset, count)
|
||||
| hb_map (&FeatureName::get_feature_type)
|
||||
|
||||
@@ -870,11 +870,11 @@ struct KerxSubTable
|
||||
unsigned int subtable_type = get_type ();
|
||||
TRACE_DISPATCH (this, subtable_type);
|
||||
switch (subtable_type) {
|
||||
case 0: return_trace (c->dispatch (u.format0, std::forward<Ts> (ds)...));
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
|
||||
case 6: return_trace (c->dispatch (u.format6, std::forward<Ts> (ds)...));
|
||||
case 0: hb_barrier (); return_trace (c->dispatch (u.format0, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
|
||||
case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
|
||||
case 6: hb_barrier (); return_trace (c->dispatch (u.format6, std::forward<Ts> (ds)...));
|
||||
default: return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
@@ -884,11 +884,11 @@ struct KerxSubTable
|
||||
{
|
||||
unsigned int subtable_type = get_type ();
|
||||
switch (subtable_type) {
|
||||
case 0: u.format0.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 1: u.format1.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 2: u.format2.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 4: u.format4.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 6: u.format6.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 0: hb_barrier (); u.format0.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 1: hb_barrier (); u.format1.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 2: hb_barrier (); u.format2.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 4: hb_barrier (); u.format4.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
case 6: hb_barrier (); u.format6.collect_glyphs (first_set, second_set, num_glyphs); return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1078,11 +1078,11 @@ struct ChainSubtable
|
||||
unsigned int subtable_type = get_type ();
|
||||
TRACE_DISPATCH (this, subtable_type);
|
||||
switch (subtable_type) {
|
||||
case Rearrangement: return_trace (c->dispatch (u.rearrangement, std::forward<Ts> (ds)...));
|
||||
case Contextual: return_trace (c->dispatch (u.contextual, std::forward<Ts> (ds)...));
|
||||
case Ligature: return_trace (c->dispatch (u.ligature, std::forward<Ts> (ds)...));
|
||||
case Noncontextual: return_trace (c->dispatch (u.noncontextual, std::forward<Ts> (ds)...));
|
||||
case Insertion: return_trace (c->dispatch (u.insertion, std::forward<Ts> (ds)...));
|
||||
case Rearrangement: hb_barrier (); return_trace (c->dispatch (u.rearrangement, std::forward<Ts> (ds)...));
|
||||
case Contextual: hb_barrier (); return_trace (c->dispatch (u.contextual, std::forward<Ts> (ds)...));
|
||||
case Ligature: hb_barrier (); return_trace (c->dispatch (u.ligature, std::forward<Ts> (ds)...));
|
||||
case Noncontextual: hb_barrier (); return_trace (c->dispatch (u.noncontextual, std::forward<Ts> (ds)...));
|
||||
case Insertion: hb_barrier (); return_trace (c->dispatch (u.insertion, std::forward<Ts> (ds)...));
|
||||
default: return_trace (c->default_return_value ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
|
||||
* @start_offset: offset of the first feature type to retrieve
|
||||
* @feature_count: (inout) (optional): Input = the maximum number of feature types to return;
|
||||
* Output = the actual number of feature types returned (may be zero)
|
||||
* @features: (out caller-allocates) (array length=feature_count): Array of feature types found
|
||||
* @features: (out caller-allocates) (array length=feature_count) (nullable): Array of feature types found
|
||||
*
|
||||
* Fetches a list of the AAT feature types included in the specified face.
|
||||
*
|
||||
|
||||
@@ -39,6 +39,19 @@
|
||||
#include <functional>
|
||||
#include <new>
|
||||
|
||||
static HB_ALWAYS_INLINE void *
|
||||
hb_malloc2 (size_t nmemb, size_t size)
|
||||
{
|
||||
if (size && nmemb > SIZE_MAX / size) return nullptr;
|
||||
return hb_malloc (nmemb * size);
|
||||
}
|
||||
static HB_ALWAYS_INLINE void *
|
||||
hb_realloc2 (void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
if (size && nmemb > SIZE_MAX / size) return nullptr;
|
||||
return hb_realloc (ptr, nmemb * size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Flags
|
||||
*/
|
||||
@@ -877,6 +890,18 @@ struct
|
||||
}
|
||||
HB_FUNCOBJ (hb_clamp);
|
||||
|
||||
/* Convert a floating-point value to integer type T, saturating to T's
|
||||
* range instead of relying on the undefined behavior of an out-of-range
|
||||
* float-to-int conversion. NaN saturates to the minimum of T. */
|
||||
template <typename T>
|
||||
static inline T
|
||||
hb_clamp_to (double v)
|
||||
{
|
||||
return (T) hb_clamp (v,
|
||||
(double) hb_int_min (T),
|
||||
(double) hb_int_max (T));
|
||||
}
|
||||
|
||||
/*
|
||||
* Bithacks.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -662,7 +662,7 @@ _hb_blob_try_mmap (const char *file_name)
|
||||
if (unlikely (!file)) return nullptr;
|
||||
auto file_guard = hb_make_scope_guard ([&]() { hb_free (file); });
|
||||
|
||||
unsigned int size = strlen (file_name) + 1;
|
||||
size_t size = strlen (file_name) + 1;
|
||||
wchar_t *wchar_file_name = (wchar_t *) hb_malloc (sizeof (wchar_t) * size);
|
||||
if (unlikely (!wchar_file_name)) return nullptr;
|
||||
|
||||
|
||||
@@ -796,19 +796,19 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
|
||||
return false;
|
||||
}
|
||||
|
||||
hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_GLYPHS);
|
||||
|
||||
if (!font)
|
||||
font = hb_font_get_empty ();
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case HB_BUFFER_SERIALIZE_FORMAT_TEXT:
|
||||
hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_GLYPHS);
|
||||
return _hb_buffer_deserialize_text_glyphs (buffer,
|
||||
buf, buf_len, end_ptr,
|
||||
font);
|
||||
|
||||
case HB_BUFFER_SERIALIZE_FORMAT_JSON:
|
||||
hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_GLYPHS);
|
||||
return _hb_buffer_deserialize_json (buffer,
|
||||
buf, buf_len, end_ptr,
|
||||
font);
|
||||
@@ -867,18 +867,18 @@ hb_buffer_deserialize_unicode (hb_buffer_t *buffer,
|
||||
return false;
|
||||
}
|
||||
|
||||
hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_UNICODE);
|
||||
|
||||
hb_font_t* font = hb_font_get_empty ();
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case HB_BUFFER_SERIALIZE_FORMAT_TEXT:
|
||||
hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_UNICODE);
|
||||
return _hb_buffer_deserialize_text_unicode (buffer,
|
||||
buf, buf_len, end_ptr,
|
||||
font);
|
||||
|
||||
case HB_BUFFER_SERIALIZE_FORMAT_JSON:
|
||||
hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_UNICODE);
|
||||
return _hb_buffer_deserialize_json (buffer,
|
||||
buf, buf_len, end_ptr,
|
||||
font);
|
||||
|
||||
@@ -167,7 +167,7 @@ buffer_verify_unsafe_to_break (hb_buffer_t *buffer,
|
||||
|
||||
hb_buffer_append (fragment, text_buffer, text_start, text_end);
|
||||
if (!hb_shape_full (font, fragment, features, num_features, shapers) ||
|
||||
fragment->successful)
|
||||
!fragment->successful)
|
||||
return true;
|
||||
hb_buffer_append (reconstruction, fragment, 0, -1);
|
||||
|
||||
|
||||
+27
-1
@@ -94,6 +94,32 @@ _hb_cairo_destroy_blob (void *p)
|
||||
hb_blob_destroy ((hb_blob_t *) p);
|
||||
}
|
||||
|
||||
void
|
||||
_hb_cairo_set_source_color (hb_cairo_context_t *c,
|
||||
hb_bool_t use_foreground,
|
||||
hb_color_t color)
|
||||
{
|
||||
cairo_t *cr = c->cr;
|
||||
|
||||
if (use_foreground)
|
||||
{
|
||||
#ifdef HAVE_CAIRO_USER_SCALED_FONT_GET_FOREGROUND_SOURCE
|
||||
double r, g, b, a;
|
||||
cairo_pattern_t *foreground = cairo_user_scaled_font_get_foreground_source (c->scaled_font);
|
||||
if (cairo_pattern_get_rgba (foreground, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS)
|
||||
cairo_set_source_rgba (cr, r, g, b, a * hb_color_get_alpha (color) / 255.);
|
||||
else
|
||||
#endif
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, hb_color_get_alpha (color) / 255.);
|
||||
}
|
||||
else
|
||||
cairo_set_source_rgba (cr,
|
||||
hb_color_get_red (color) / 255.,
|
||||
hb_color_get_green (color) / 255.,
|
||||
hb_color_get_blue (color) / 255.,
|
||||
hb_color_get_alpha (color) / 255.);
|
||||
}
|
||||
|
||||
hb_bool_t
|
||||
_hb_cairo_paint_glyph_image (hb_cairo_context_t *c,
|
||||
hb_blob_t *blob,
|
||||
@@ -211,7 +237,7 @@ _hb_cairo_get_color_stops (hb_cairo_context_t *c,
|
||||
return false;
|
||||
if (len > *count)
|
||||
{
|
||||
*stops = (hb_color_stop_t *) hb_malloc (len * sizeof (hb_color_stop_t));
|
||||
*stops = (hb_color_stop_t *) hb_malloc2 (len, sizeof (hb_color_stop_t));
|
||||
if (unlikely (!*stops))
|
||||
return false;
|
||||
allocated = true;
|
||||
|
||||
@@ -75,6 +75,11 @@ _hb_paint_composite_mode_to_cairo (hb_paint_composite_mode_t mode)
|
||||
}
|
||||
}
|
||||
|
||||
HB_INTERNAL void
|
||||
_hb_cairo_set_source_color (hb_cairo_context_t *c,
|
||||
hb_bool_t use_foreground,
|
||||
hb_color_t color);
|
||||
|
||||
HB_INTERNAL hb_bool_t
|
||||
_hb_cairo_paint_glyph_image (hb_cairo_context_t *c,
|
||||
hb_blob_t *blob,
|
||||
|
||||
+28
-21
@@ -166,6 +166,29 @@ hb_cairo_pop_transform (hb_paint_funcs_t *pfuncs HB_UNUSED,
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
hb_cairo_fill_glyph (hb_paint_funcs_t *pfuncs HB_UNUSED,
|
||||
void *paint_data,
|
||||
hb_codepoint_t glyph,
|
||||
hb_font_t *font,
|
||||
hb_bool_t use_foreground,
|
||||
hb_color_t color,
|
||||
void *user_data HB_UNUSED)
|
||||
{
|
||||
hb_cairo_context_t *c = (hb_cairo_context_t *) paint_data;
|
||||
cairo_t *cr = c->cr;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_new_path (cr);
|
||||
hb_font_draw_glyph (font, glyph, hb_cairo_draw_get_funcs (), cr);
|
||||
cairo_close_path (cr);
|
||||
_hb_cairo_set_source_color (c, use_foreground, color);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static hb_bool_t
|
||||
hb_cairo_paint_color_glyph (hb_paint_funcs_t *pfuncs HB_UNUSED,
|
||||
void *paint_data,
|
||||
@@ -303,23 +326,7 @@ hb_cairo_paint_color (hb_paint_funcs_t *pfuncs HB_UNUSED,
|
||||
hb_cairo_context_t *c = (hb_cairo_context_t *) paint_data;
|
||||
cairo_t *cr = c->cr;
|
||||
|
||||
if (use_foreground)
|
||||
{
|
||||
#ifdef HAVE_CAIRO_USER_SCALED_FONT_GET_FOREGROUND_SOURCE
|
||||
double r, g, b, a;
|
||||
cairo_pattern_t *foreground = cairo_user_scaled_font_get_foreground_source (c->scaled_font);
|
||||
if (cairo_pattern_get_rgba (foreground, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS)
|
||||
cairo_set_source_rgba (cr, r, g, b, a * hb_color_get_alpha (color) / 255.);
|
||||
else
|
||||
#endif
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, hb_color_get_alpha (color) / 255.);
|
||||
}
|
||||
else
|
||||
cairo_set_source_rgba (cr,
|
||||
hb_color_get_red (color) / 255.,
|
||||
hb_color_get_green (color) / 255.,
|
||||
hb_color_get_blue (color) / 255.,
|
||||
hb_color_get_alpha (color) / 255.);
|
||||
_hb_cairo_set_source_color (c, use_foreground, color);
|
||||
cairo_paint (cr);
|
||||
}
|
||||
|
||||
@@ -452,6 +459,7 @@ static struct hb_cairo_paint_funcs_lazy_loader_t : hb_paint_funcs_lazy_loader_t<
|
||||
|
||||
hb_paint_funcs_set_push_transform_func (funcs, hb_cairo_push_transform, nullptr, nullptr);
|
||||
hb_paint_funcs_set_pop_transform_func (funcs, hb_cairo_pop_transform, nullptr, nullptr);
|
||||
hb_paint_funcs_set_fill_glyph_func (funcs, hb_cairo_fill_glyph, nullptr, nullptr);
|
||||
hb_paint_funcs_set_color_glyph_func (funcs, hb_cairo_paint_color_glyph, nullptr, nullptr);
|
||||
hb_paint_funcs_set_push_clip_glyph_func (funcs, hb_cairo_push_clip_glyph, nullptr, nullptr);
|
||||
hb_paint_funcs_set_push_clip_rectangle_func (funcs, hb_cairo_push_clip_rectangle, nullptr, nullptr);
|
||||
@@ -675,10 +683,9 @@ hb_cairo_render_color_glyph (cairo_scaled_font_t *scaled_font,
|
||||
c.color_cache = (hb_map_t *) cairo_scaled_font_get_user_data (scaled_font, &color_cache_key);
|
||||
|
||||
/* Synthesizing variant: mono glyphs render here too via the
|
||||
* push_clip_glyph + foreground-fill fallback inside
|
||||
* hb_font_paint_glyph. Callers that want the cheaper
|
||||
* outline path for mono fonts set CAIRO_COLOR_MODE_NO_COLOR
|
||||
* on the font options instead. */
|
||||
* fill_glyph foreground fallback inside hb_font_paint_glyph.
|
||||
* Callers that want the cheaper outline path for mono fonts set
|
||||
* CAIRO_COLOR_MODE_NO_COLOR on the font options instead. */
|
||||
hb_font_paint_glyph (font, glyph, hb_cairo_paint_get_funcs (), &c, palette, color);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
@@ -220,16 +220,32 @@ inline unsigned int OpCode_Size (op_code_t op) { return Is_OpCode_ESC (op) ? 2:
|
||||
struct number_t
|
||||
{
|
||||
void set_int (int v) { value = v; }
|
||||
int to_int () const { return value; }
|
||||
bool to_int (int *v) const
|
||||
{
|
||||
if (unlikely (!(value >= INT_MIN && value <= INT_MAX)))
|
||||
{
|
||||
*v = 0;
|
||||
return false;
|
||||
}
|
||||
*v = (int) value;
|
||||
return true;
|
||||
}
|
||||
int to_int () const
|
||||
{
|
||||
int v;
|
||||
if (likely (to_int (&v))) return v;
|
||||
return value < 0 ? INT_MIN : value > 0 ? INT_MAX : 0;
|
||||
}
|
||||
|
||||
void set_fixed (int32_t v) { value = v / 65536.0; }
|
||||
int32_t to_fixed () const { return value * 65536.0; }
|
||||
int32_t to_fixed () const
|
||||
{ return (int32_t) hb_clamp (value * 65536.0, (double) INT32_MIN, (double) INT32_MAX); }
|
||||
|
||||
void set_real (double v) { value = v; }
|
||||
double to_real () const { return value; }
|
||||
|
||||
bool in_int_range () const
|
||||
{ return ((double) (int16_t) to_int () == value); }
|
||||
{ return value >= INT16_MIN && value <= INT16_MAX && (double) (int16_t) value == value; }
|
||||
|
||||
bool operator > (const number_t &n) const { return value > n.to_real (); }
|
||||
bool operator < (const number_t &n) const { return n > *this; }
|
||||
@@ -446,7 +462,13 @@ struct arg_stack_t : cff_stack_t<ARG, 513>
|
||||
|
||||
ARG& pop_num () { return this->pop (); }
|
||||
|
||||
int pop_int () { return this->pop ().to_int (); }
|
||||
int pop_int ()
|
||||
{
|
||||
int v;
|
||||
if (unlikely (!this->pop ().to_int (&v)))
|
||||
S::set_error ();
|
||||
return v;
|
||||
}
|
||||
|
||||
unsigned int pop_uint ()
|
||||
{
|
||||
|
||||
@@ -78,7 +78,8 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs>
|
||||
num_coords = num_coords_;
|
||||
varStore = acc.varStore;
|
||||
do_blend = num_coords && varStore->size;
|
||||
set_ivs (acc.privateDicts[fd].ivs);
|
||||
orig_ivs = acc.privateDicts[fd].ivs;
|
||||
set_ivs (orig_ivs);
|
||||
}
|
||||
|
||||
~cff2_cs_interp_env_t ()
|
||||
@@ -179,6 +180,8 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs>
|
||||
void set_region_count (unsigned int region_count_) { region_count = region_count_; }
|
||||
unsigned int get_ivs () const { return ivs; }
|
||||
void set_ivs (unsigned int ivs_) { ivs = ivs_; }
|
||||
/* The FD's private-dict ivs, before any vsindex op in the charstring. */
|
||||
unsigned int get_orig_ivs () const { return orig_ivs; }
|
||||
bool seen_vsindex () const { return seen_vsindex_; }
|
||||
|
||||
double blend_deltas (hb_array_t<const ELEM> deltas) const
|
||||
@@ -204,6 +207,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs>
|
||||
const CFF2ItemVariationStore *varStore;
|
||||
unsigned int region_count;
|
||||
unsigned int ivs;
|
||||
unsigned int orig_ivs;
|
||||
hb_vector_t<float> *scalars = nullptr;
|
||||
hb_atomic_t<hb_vector_t<float> *> *cached_scalars_vector = nullptr;
|
||||
bool do_blend;
|
||||
@@ -260,6 +264,19 @@ struct cff2_cs_opset_t : cs_opset_t<ELEM, OPSET, cff2_cs_interp_env_t<ELEM>, PAR
|
||||
{
|
||||
if (env.have_coords ())
|
||||
arg.set_int (round (arg.to_real () + env.blend_deltas (blends)));
|
||||
else if (unlikely (arg.blending ()))
|
||||
{
|
||||
/* A blend result used as an operand of a later blend: the value is
|
||||
* default + inner deltas + outer deltas, so accumulate the deltas. */
|
||||
hb_vector_t<number_t> inner = std::move (arg.deltas);
|
||||
arg.set_blends (n, i, blends);
|
||||
if (likely (inner.length == arg.deltas.length))
|
||||
for (unsigned j = 0; j < inner.length; j++)
|
||||
arg.deltas.arrayZ[j].set_real (arg.deltas.arrayZ[j].to_real () +
|
||||
inner.arrayZ[j].to_real ());
|
||||
else
|
||||
env.set_error ();
|
||||
}
|
||||
else
|
||||
arg.set_blends (n, i, blends);
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@
|
||||
#define HB_NO_SUBSET_DEPEND
|
||||
#endif
|
||||
|
||||
#ifdef HB_SUBSET_DEPEND_API
|
||||
#undef HB_NO_SUBSET_DEPEND
|
||||
#endif
|
||||
|
||||
#ifdef HB_TINY
|
||||
#define HB_LEAN
|
||||
#define HB_MINI
|
||||
@@ -147,10 +143,6 @@
|
||||
#define HB_NO_PAINT
|
||||
#endif
|
||||
|
||||
#if defined(HB_TINY) && defined(HB_NO_DRAW)
|
||||
#define HB_NO_CFF
|
||||
#endif
|
||||
|
||||
#ifdef HB_NO_CFF
|
||||
#define HB_NO_OT_FONT_CFF
|
||||
#define HB_NO_SUBSET_CFF
|
||||
|
||||
+7
-6
@@ -107,11 +107,12 @@ _hb_cg_get_table_tags (const hb_face_t *face HB_UNUSED,
|
||||
end_offset = hb_min (end_offset, (unsigned) population);
|
||||
|
||||
*table_count = end_offset - start_offset;
|
||||
for (unsigned i = start_offset; i < end_offset; i++)
|
||||
{
|
||||
CTFontTableTag tag = (CTFontTableTag)(uintptr_t) CFArrayGetValueAtIndex (arr, i);
|
||||
table_tags[i - start_offset] = tag;
|
||||
}
|
||||
if (table_tags)
|
||||
for (unsigned i = start_offset; i < end_offset; i++)
|
||||
{
|
||||
CTFontTableTag tag = (CTFontTableTag)(uintptr_t) CFArrayGetValueAtIndex (arr, i);
|
||||
table_tags[i - start_offset] = tag;
|
||||
}
|
||||
|
||||
return population;
|
||||
}
|
||||
@@ -446,7 +447,7 @@ hb_coretext_face_create_from_file_or_fail (const char *file_name,
|
||||
* Creates an #hb_face_t face object from the specified
|
||||
* blob and face index.
|
||||
*
|
||||
* This is similar in functionality to hb_face_create_from_blob_or_fail(),
|
||||
* This is similar in functionality to hb_face_create_or_fail(),
|
||||
* but uses the CoreText library for loading the font data.
|
||||
*
|
||||
* Return value: (transfer full): The new face object, or `NULL` if
|
||||
|
||||
@@ -315,7 +315,7 @@ hb_directwrite_face_create_from_file_or_fail (const char *file_name,
|
||||
* Creates an #hb_face_t face object from the specified
|
||||
* blob and face index.
|
||||
*
|
||||
* This is similar in functionality to hb_face_create_from_blob_or_fail(),
|
||||
* This is similar in functionality to hb_face_create_or_fail(),
|
||||
* but uses the DirectWrite library for loading the font data.
|
||||
*
|
||||
* Return value: (transfer full): The new face object, or `NULL` if
|
||||
|
||||
+13
-5
@@ -65,12 +65,20 @@ 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_TWO_THIRD 0.66666666666666666666666667f
|
||||
/* Compute in double precision, so that the result does not depend
|
||||
* on how the compiler evaluates float expressions. */
|
||||
#define HB_TWO_THIRD 0.66666666666666666666666667
|
||||
double current_x = (double) st->current_x;
|
||||
double current_y = (double) st->current_y;
|
||||
double cx = (double) control_x;
|
||||
double cy = (double) control_y;
|
||||
double tx = (double) to_x;
|
||||
double ty = (double) to_y;
|
||||
dfuncs->emit_cubic_to (draw_data, *st,
|
||||
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,
|
||||
(float) (current_x + (cx - current_x) * HB_TWO_THIRD),
|
||||
(float) (current_y + (cy - current_y) * HB_TWO_THIRD),
|
||||
(float) (tx + (cx - tx) * HB_TWO_THIRD),
|
||||
(float) (ty + (cy - ty) * HB_TWO_THIRD),
|
||||
to_x, to_y);
|
||||
#undef HB_TWO_THIRD
|
||||
}
|
||||
|
||||
@@ -185,11 +185,14 @@ _hb_face_builder_get_table_tags (const hb_face_t *face HB_UNUSED,
|
||||
});
|
||||
|
||||
auto array = sorted_tags.as_array ().sub_array (start_offset, table_count);
|
||||
auto out = hb_array (table_tags, *table_count);
|
||||
if (table_tags)
|
||||
{
|
||||
auto out = hb_array (table_tags, *table_count);
|
||||
|
||||
+ array.iter ()
|
||||
| hb_sink (out)
|
||||
;
|
||||
+ array.iter ()
|
||||
| hb_sink (out)
|
||||
;
|
||||
}
|
||||
|
||||
return population;
|
||||
}
|
||||
|
||||
+1
-1
@@ -909,7 +909,7 @@ hb_face_set_get_table_tags_func (hb_face_t *face,
|
||||
* @start_offset: The index of first table tag to retrieve
|
||||
* @table_count: (inout): Input = the maximum number of table tags to return;
|
||||
* Output = the actual number of table tags returned (may be zero)
|
||||
* @table_tags: (out) (array length=table_count): The array of table tags found
|
||||
* @table_tags: (out) (array length=table_count) (nullable): The array of table tags found
|
||||
*
|
||||
* Fetches a list of all table tags for a face, if possible. The list returned will
|
||||
* begin at the offset provided
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ hb_face_get_glyph_count (const hb_face_t *face);
|
||||
* @start_offset: The index of first table tag to retrieve
|
||||
* @table_count: (inout): Input = the maximum number of table tags to return;
|
||||
* Output = the actual number of table tags returned (may be zero)
|
||||
* @table_tags: (out) (array length=table_count): The array of table tags found
|
||||
* @table_tags: (out) (array length=table_count) (nullable): The array of table tags found
|
||||
* @user_data: User data pointer passed by the caller
|
||||
*
|
||||
* Callback function for hb_face_get_table_tags().
|
||||
|
||||
+5
-7
@@ -1670,9 +1670,7 @@ hb_font_t::paint_glyph (hb_codepoint_t glyph,
|
||||
return;
|
||||
|
||||
/* Fallback for outline glyph. */
|
||||
paint_funcs->push_clip_glyph (paint_data, glyph, this);
|
||||
paint_funcs->color (paint_data, true, foreground);
|
||||
paint_funcs->pop_clip (paint_data);
|
||||
paint_funcs->fill_glyph (paint_data, glyph, this, true, foreground);
|
||||
}
|
||||
|
||||
|
||||
@@ -2500,9 +2498,9 @@ hb_font_get_face (hb_font_t *font)
|
||||
/**
|
||||
* hb_font_set_funcs:
|
||||
* @font: #hb_font_t to work upon
|
||||
* @klass: (closure font_data) (destroy destroy) (scope notified): The font-functions structure.
|
||||
* @klass: The font-functions structure.
|
||||
* @font_data: Data to attach to @font
|
||||
* @destroy: (nullable): The function to call when @font_data is not needed anymore
|
||||
* @destroy: (nullable) (scope async) (closure font_data): The function to call when @font_data is not needed anymore
|
||||
*
|
||||
* Replaces the font-functions structure attached to a font, updating
|
||||
* the font's user-data with @font-data and the @destroy callback.
|
||||
@@ -2540,8 +2538,8 @@ hb_font_set_funcs (hb_font_t *font,
|
||||
/**
|
||||
* hb_font_set_funcs_data:
|
||||
* @font: #hb_font_t to work upon
|
||||
* @font_data: (destroy destroy) (scope notified): Data to attach to @font
|
||||
* @destroy: (nullable): The function to call when @font_data is not needed anymore
|
||||
* @font_data: Data to attach to @font
|
||||
* @destroy: (nullable) (scope async) (closure font_data): The function to call when @font_data is not needed anymore
|
||||
*
|
||||
* Replaces the user data attached to a font, updating the font's
|
||||
* @destroy callback.
|
||||
|
||||
+59
-30
@@ -250,6 +250,42 @@ _hb_ft_color_line_get_extend (hb_color_line_t *color_line,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_hb_ft_get_solid_color (hb_ft_paint_context_t *c,
|
||||
const FT_ColorIndex &color_index,
|
||||
hb_bool_t *is_foreground,
|
||||
hb_color_t *color)
|
||||
{
|
||||
*is_foreground = color_index.palette_index == 0xFFFF;
|
||||
|
||||
if (*is_foreground)
|
||||
{
|
||||
*color = HB_COLOR (hb_color_get_blue (c->foreground),
|
||||
hb_color_get_green (c->foreground),
|
||||
hb_color_get_red (c->foreground),
|
||||
_hb_ft_color_alpha (hb_color_get_alpha (c->foreground),
|
||||
color_index.alpha));
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->funcs->custom_palette_color (c->data, color_index.palette_index, color))
|
||||
{
|
||||
*color = HB_COLOR (hb_color_get_blue (*color),
|
||||
hb_color_get_green (*color),
|
||||
hb_color_get_red (*color),
|
||||
_hb_ft_color_alpha (hb_color_get_alpha (*color),
|
||||
color_index.alpha));
|
||||
return;
|
||||
}
|
||||
|
||||
FT_Color ft_color = c->palette[color_index.palette_index];
|
||||
*color = HB_COLOR (ft_color.blue,
|
||||
ft_color.green,
|
||||
ft_color.red,
|
||||
_hb_ft_color_alpha (ft_color.alpha,
|
||||
color_index.alpha));
|
||||
}
|
||||
|
||||
void
|
||||
_hb_ft_paint (hb_ft_paint_context_t *c,
|
||||
FT_OpaquePaint opaque_paint)
|
||||
@@ -280,34 +316,9 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
|
||||
break;
|
||||
case FT_COLR_PAINTFORMAT_SOLID:
|
||||
{
|
||||
bool is_foreground = paint.u.solid.color.palette_index == 0xFFFF;
|
||||
hb_bool_t is_foreground;
|
||||
hb_color_t color;
|
||||
if (is_foreground)
|
||||
color = HB_COLOR (hb_color_get_blue (c->foreground),
|
||||
hb_color_get_green (c->foreground),
|
||||
hb_color_get_red (c->foreground),
|
||||
_hb_ft_color_alpha (hb_color_get_alpha (c->foreground),
|
||||
paint.u.solid.color.alpha));
|
||||
else
|
||||
{
|
||||
if (c->funcs->custom_palette_color (c->data, paint.u.solid.color.palette_index, &color))
|
||||
{
|
||||
color = HB_COLOR (hb_color_get_blue (color),
|
||||
hb_color_get_green (color),
|
||||
hb_color_get_red (color),
|
||||
_hb_ft_color_alpha (hb_color_get_alpha (color),
|
||||
paint.u.solid.color.alpha));
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_Color ft_color = c->palette[paint.u.solid.color.palette_index];
|
||||
color = HB_COLOR (ft_color.blue,
|
||||
ft_color.green,
|
||||
ft_color.red,
|
||||
_hb_ft_color_alpha (ft_color.alpha,
|
||||
paint.u.solid.color.alpha));
|
||||
}
|
||||
}
|
||||
_hb_ft_get_solid_color (c, paint.u.solid.color, &is_foreground, &color);
|
||||
c->funcs->color (c->data, is_foreground, color);
|
||||
}
|
||||
break;
|
||||
@@ -362,6 +373,26 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
|
||||
break;
|
||||
case FT_COLR_PAINTFORMAT_GLYPH:
|
||||
{
|
||||
/* Optimize cases that can use a simple fill-glyph operation. */
|
||||
FT_COLR_Paint fill;
|
||||
if (likely (c->depth_left > 0 && c->edge_count > 0) &&
|
||||
FT_Get_Paint (ft_face, paint.u.glyph.paint, &fill) &&
|
||||
fill.format == FT_COLR_PAINTFORMAT_SOLID)
|
||||
{
|
||||
hb_bool_t is_foreground;
|
||||
hb_color_t color;
|
||||
_hb_ft_get_solid_color (c, fill.u.solid.color, &is_foreground, &color);
|
||||
|
||||
c->edge_count--;
|
||||
c->funcs->push_inverse_font_transform (c->data, c->font);
|
||||
c->ft_font->lock.unlock ();
|
||||
c->funcs->fill_glyph (c->data, paint.u.glyph.glyphID, c->font,
|
||||
is_foreground, color);
|
||||
c->ft_font->lock.lock ();
|
||||
c->funcs->pop_transform (c->data);
|
||||
break;
|
||||
}
|
||||
|
||||
c->funcs->push_inverse_font_transform (c->data, c->font);
|
||||
c->ft_font->lock.unlock ();
|
||||
c->funcs->push_clip_glyph (c->data, paint.u.glyph.glyphID, c->font);
|
||||
@@ -600,10 +631,8 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
|
||||
}
|
||||
|
||||
ft_font->lock.unlock ();
|
||||
paint_funcs->push_clip_glyph (paint_data, layer_glyph_index, font);
|
||||
paint_funcs->fill_glyph (paint_data, layer_glyph_index, font, is_foreground, color);
|
||||
ft_font->lock.lock ();
|
||||
paint_funcs->color (paint_data, is_foreground, color);
|
||||
paint_funcs->pop_clip (paint_data);
|
||||
|
||||
} while (FT_Get_Color_Glyph_Layer(ft_face,
|
||||
gid,
|
||||
|
||||
+21
-15
@@ -1152,23 +1152,29 @@ _hb_ft_get_table_tags (const hb_face_t *face HB_UNUSED,
|
||||
|
||||
if (!table_count)
|
||||
return population;
|
||||
else
|
||||
*table_count = 0;
|
||||
|
||||
if (unlikely (start_offset >= population))
|
||||
{
|
||||
*table_count = 0;
|
||||
return population;
|
||||
}
|
||||
|
||||
unsigned end_offset = hb_min (start_offset + *table_count, (unsigned) population);
|
||||
if (unlikely (end_offset < start_offset))
|
||||
unsigned end_offset = start_offset + *table_count;
|
||||
if (unlikely (end_offset < start_offset)) /* Overflow. */
|
||||
{
|
||||
*table_count = 0;
|
||||
return population;
|
||||
}
|
||||
end_offset = hb_min (end_offset, (unsigned) population);
|
||||
|
||||
*table_count = end_offset - start_offset;
|
||||
for (unsigned i = start_offset; i < end_offset; i++)
|
||||
{
|
||||
FT_ULong tag = 0, length;
|
||||
FT_Sfnt_Table_Info (ft_face, i, &tag, &length);
|
||||
table_tags[i - start_offset] = tag;
|
||||
}
|
||||
if (table_tags)
|
||||
for (unsigned i = start_offset; i < end_offset; i++)
|
||||
{
|
||||
FT_ULong tag = 0, length;
|
||||
FT_Sfnt_Table_Info (ft_face, i, &tag, &length);
|
||||
table_tags[i - start_offset] = tag;
|
||||
}
|
||||
|
||||
return population;
|
||||
}
|
||||
@@ -1176,8 +1182,8 @@ _hb_ft_get_table_tags (const hb_face_t *face HB_UNUSED,
|
||||
|
||||
/**
|
||||
* hb_ft_face_create:
|
||||
* @ft_face: (destroy destroy) (scope notified): FT_Face to work upon
|
||||
* @destroy: (nullable): A callback to call when the face object is not needed anymore
|
||||
* @ft_face: FT_Face to work upon
|
||||
* @destroy: (nullable) (scope async): A callback to call when the face object is not needed anymore
|
||||
*
|
||||
* Creates an #hb_face_t face object from the specified FT_Face.
|
||||
*
|
||||
@@ -1300,8 +1306,8 @@ hb_ft_face_create_cached (FT_Face ft_face)
|
||||
|
||||
/**
|
||||
* hb_ft_font_create:
|
||||
* @ft_face: (destroy destroy) (scope notified): FT_Face to work upon
|
||||
* @destroy: (nullable): A callback to call when the font object is not needed anymore
|
||||
* @ft_face: FT_Face to work upon
|
||||
* @destroy: (nullable) (scope async): A callback to call when the font object is not needed anymore
|
||||
*
|
||||
* Creates an #hb_font_t font object from the specified FT_Face.
|
||||
*
|
||||
@@ -1609,7 +1615,7 @@ _destroy_blob (void *p)
|
||||
* Creates an #hb_face_t face object from the specified
|
||||
* font blob and face index.
|
||||
*
|
||||
* This is similar in functionality to hb_face_create_from_blob_or_fail(),
|
||||
* This is similar in functionality to hb_face_create_or_fail(),
|
||||
* but uses the FreeType library for loading the font blob. This can
|
||||
* be useful, for example, to load WOFF and WOFF2 font data.
|
||||
*
|
||||
|
||||
@@ -43,7 +43,7 @@ HB_BEGIN_DECLS
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
HB_EXTERN GType
|
||||
@enum_name@_get_type (void) G_GNUC_CONST;
|
||||
@enum_name@_get_type (void);
|
||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
||||
|
||||
/*** END value-header ***/
|
||||
|
||||
+10
-6
@@ -446,6 +446,16 @@ hb_gpu_draw_encode (hb_gpu_draw_t *draw,
|
||||
if (unlikely (!s.curve_infos.resize (num_curves)))
|
||||
return nullptr;
|
||||
|
||||
/* Validate the extents fit in i16 before quantizing: the casts in
|
||||
* quantize_down()/quantize_up() are undefined for out-of-range
|
||||
* values, and every later i16 conversion of a curve point is bounded
|
||||
* by these extents. */
|
||||
if (!quantize_down_fits_i16 (draw->ext_min_x) ||
|
||||
!quantize_down_fits_i16 (draw->ext_min_y) ||
|
||||
!quantize_up_fits_i16 (draw->ext_max_x) ||
|
||||
!quantize_up_fits_i16 (draw->ext_max_y))
|
||||
return nullptr;
|
||||
|
||||
int16_t min_x_q = quantize_down (draw->ext_min_x);
|
||||
int16_t min_y_q = quantize_down (draw->ext_min_y);
|
||||
int16_t max_x_q = quantize_up (draw->ext_max_x);
|
||||
@@ -653,12 +663,6 @@ hb_gpu_draw_encode (hb_gpu_draw_t *draw,
|
||||
if (total_len > (unsigned) UINT16_MAX + 1u)
|
||||
return nullptr;
|
||||
|
||||
if (!quantize_down_fits_i16 (draw->ext_min_x) ||
|
||||
!quantize_down_fits_i16 (draw->ext_min_y) ||
|
||||
!quantize_up_fits_i16 (draw->ext_max_x) ||
|
||||
!quantize_up_fits_i16 (draw->ext_max_y))
|
||||
return nullptr;
|
||||
|
||||
/* Allocate or reuse encode buffer */
|
||||
unsigned needed_bytes;
|
||||
if (unlikely (hb_unsigned_mul_overflows (total_len,
|
||||
|
||||
+8
-1
@@ -165,6 +165,13 @@ hb_gpu_paint_push_clip_path_end (hb_paint_funcs_t *funcs HB_UNUSED,
|
||||
}
|
||||
int idx = (int) (c->sub_blobs.length - 1);
|
||||
|
||||
if (unlikely (c->clip_depth >= HB_GPU_PAINT_MAX_CLIP_DEPTH))
|
||||
{
|
||||
c->unsupported = true;
|
||||
c->clip_depth++;
|
||||
return;
|
||||
}
|
||||
|
||||
int x0 = ext.x_bearing;
|
||||
int x1 = (int) ((int64_t) ext.x_bearing + ext.width);
|
||||
int y0 = ext.y_bearing;
|
||||
@@ -870,7 +877,7 @@ hb_gpu_paint_emit_sweep (hb_gpu_paint_t *c,
|
||||
hb_color_stop_t *heap_stops = nullptr;
|
||||
if (count > 16)
|
||||
{
|
||||
heap_stops = (hb_color_stop_t *) hb_malloc (count * sizeof (hb_color_stop_t));
|
||||
heap_stops = (hb_color_stop_t *) hb_malloc2 (count, sizeof (hb_color_stop_t));
|
||||
if (unlikely (!heap_stops)) { c->unsupported = true; return; }
|
||||
stops = heap_stops;
|
||||
}
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef HB_MAX_FEATURE_INDICES
|
||||
#define HB_MAX_FEATURE_INDICES 1500
|
||||
#define HB_MAX_FEATURE_INDICES 8000
|
||||
#endif
|
||||
|
||||
#ifndef HB_MAX_LOOKUP_VISIT_COUNT
|
||||
@@ -130,7 +130,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef HB_REPACKER_MAX_VERTICES
|
||||
#define HB_REPACKER_MAX_VERTICES 100000
|
||||
#define HB_REPACKER_MAX_VERTICES 800000
|
||||
#endif
|
||||
|
||||
#ifndef HB_REPACKER_MAX_SPACES
|
||||
|
||||
+1
-1
@@ -204,7 +204,7 @@ struct hb_hashmap_t
|
||||
|
||||
unsigned int power = hb_bit_storage (hb_max (hb_max ((unsigned) population, new_population) * 2, 4u));
|
||||
unsigned int new_size = 1u << power;
|
||||
item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t));
|
||||
item_t *new_items = (item_t *) hb_malloc2 ((size_t) new_size, sizeof (item_t));
|
||||
if (unlikely (!new_items))
|
||||
{
|
||||
successful = false;
|
||||
|
||||
+9
-9
@@ -88,7 +88,7 @@ typedef struct OpenTypeOffsetTable
|
||||
unsigned int *table_count, /* IN/OUT */
|
||||
hb_tag_t *table_tags /* OUT */) const
|
||||
{
|
||||
if (table_count)
|
||||
if (table_count && table_tags)
|
||||
{
|
||||
+ tables.as_array ().sub_array (start_offset, table_count)
|
||||
| hb_map (&TableRecord::tag)
|
||||
@@ -474,8 +474,8 @@ struct OpenTypeFontFile
|
||||
case TrueTag:
|
||||
case Typ1Tag:
|
||||
case TrueTypeTag: return 1;
|
||||
case TTCTag: return u.ttcHeader.get_face_count ();
|
||||
case DFontTag: return u.rfHeader.get_face_count ();
|
||||
case TTCTag: hb_barrier (); return u.ttcHeader.get_face_count ();
|
||||
case DFontTag: hb_barrier (); return u.rfHeader.get_face_count ();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -490,9 +490,9 @@ struct OpenTypeFontFile
|
||||
case CFFTag: /* All the non-collection tags */
|
||||
case TrueTag:
|
||||
case Typ1Tag:
|
||||
case TrueTypeTag: return u.fontFace;
|
||||
case TTCTag: return u.ttcHeader.get_face (i);
|
||||
case DFontTag: return u.rfHeader.get_face (i, base_offset);
|
||||
case TrueTypeTag: hb_barrier (); return u.fontFace;
|
||||
case TTCTag: hb_barrier (); return u.ttcHeader.get_face (i);
|
||||
case DFontTag: hb_barrier (); return u.rfHeader.get_face (i, base_offset);
|
||||
default: return Null (OpenTypeFontFace);
|
||||
}
|
||||
}
|
||||
@@ -518,9 +518,9 @@ struct OpenTypeFontFile
|
||||
case CFFTag: /* All the non-collection tags */
|
||||
case TrueTag:
|
||||
case Typ1Tag:
|
||||
case TrueTypeTag: return_trace (u.fontFace.sanitize (c));
|
||||
case TTCTag: return_trace (u.ttcHeader.sanitize (c));
|
||||
case DFontTag: return_trace (u.rfHeader.sanitize (c));
|
||||
case TrueTypeTag: hb_barrier (); return_trace (u.fontFace.sanitize (c));
|
||||
case TTCTag: hb_barrier (); return_trace (u.ttcHeader.sanitize (c));
|
||||
case DFontTag: hb_barrier (); return_trace (u.rfHeader.sanitize (c));
|
||||
default: return_trace (true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,6 +346,12 @@ struct cff2_private_dict_opset_subset_t : dict_opset_t
|
||||
env.clear_args ();
|
||||
break;
|
||||
|
||||
case OpCode_vsindexdict:
|
||||
env.process_vsindex ();
|
||||
dictval.ivs = env.get_ivs ();
|
||||
env.clear_args ();
|
||||
break;
|
||||
|
||||
default:
|
||||
SUPER::process_op (op, env);
|
||||
if (!env.argStack.is_empty ()) return;
|
||||
|
||||
@@ -658,6 +658,7 @@ struct CmapSubtableFormat4
|
||||
hb_codepoint_t gid = this->glyphIdArray[index];
|
||||
if (unlikely (!gid))
|
||||
continue;
|
||||
gid = (gid + this->idDelta[i]) & 0xFFFFu;
|
||||
unicodes->add (codepoint);
|
||||
mapping->set (codepoint, gid);
|
||||
}
|
||||
@@ -2058,7 +2059,7 @@ struct cmap
|
||||
this->subtable_uvs = &Null (CmapSubtableFormat14);
|
||||
{
|
||||
const CmapSubtable *st = table->find_subtable (0, 5);
|
||||
if (st && st->u.format.v == 14)
|
||||
if (st && st->u.format.v == 14 && hb_barrier ())
|
||||
subtable_uvs = &st->u.format14;
|
||||
}
|
||||
|
||||
@@ -2140,6 +2141,7 @@ struct cmap
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
hb_barrier ();
|
||||
this->format4_accel.init (&subtable->u.format4,
|
||||
get_subtable_data_size (subtable));
|
||||
this->get_glyph_data = &this->format4_accel;
|
||||
|
||||
+3
-1
@@ -289,7 +289,7 @@ struct hb_ot_font_t
|
||||
|
||||
void check_serial (hb_font_t *font) const
|
||||
{
|
||||
int font_serial = font->serial_coords.get_acquire ();
|
||||
int font_serial = font->serial.get_acquire ();
|
||||
if (cached_serial.get_acquire () != font_serial)
|
||||
{
|
||||
/* These caches are dependent on scale and synthetic settings.
|
||||
@@ -644,6 +644,8 @@ hb_ot_get_glyph_v_origins (hb_font_t *font,
|
||||
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
|
||||
const hb_ot_face_t *ot_face = ot_font->ot_face;
|
||||
|
||||
ot_font->check_serial (font);
|
||||
|
||||
/* First, set all the x values to half the advance width. */
|
||||
font->get_glyph_h_advances (count,
|
||||
first_glyph, glyph_stride,
|
||||
|
||||
+10
-10
@@ -144,13 +144,13 @@ struct KernSubTable
|
||||
unsigned int subtable_type = get_type ();
|
||||
TRACE_DISPATCH (this, subtable_type);
|
||||
switch (subtable_type) {
|
||||
case 0: return_trace (c->dispatch (u.format0));
|
||||
case 0: hb_barrier (); return_trace (c->dispatch (u.format0));
|
||||
#ifndef HB_NO_AAT_SHAPE
|
||||
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
case 2: return_trace (c->dispatch (u.format2));
|
||||
case 2: hb_barrier (); return_trace (c->dispatch (u.format2));
|
||||
#ifndef HB_NO_AAT_SHAPE
|
||||
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default: return_trace (c->default_return_value ());
|
||||
}
|
||||
@@ -161,10 +161,10 @@ struct KernSubTable
|
||||
{
|
||||
unsigned int subtable_type = get_type ();
|
||||
switch (subtable_type) {
|
||||
case 0: u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
case 1: u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
case 2: u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
case 3: u.format3.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
case 0: hb_barrier (); u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
case 1: hb_barrier (); u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
case 2: hb_barrier (); u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
case 3: hb_barrier (); u.format3.collect_glyphs (left_set, right_set, num_glyphs); return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
@@ -352,9 +352,9 @@ struct kern
|
||||
unsigned int subtable_type = get_type ();
|
||||
TRACE_DISPATCH (this, subtable_type);
|
||||
switch (subtable_type) {
|
||||
case 0: return_trace (c->dispatch (u.ot, std::forward<Ts> (ds)...));
|
||||
case 0: hb_barrier (); return_trace (c->dispatch (u.ot, std::forward<Ts> (ds)...));
|
||||
#ifndef HB_NO_AAT_SHAPE
|
||||
case 1: return_trace (c->dispatch (u.aat, std::forward<Ts> (ds)...));
|
||||
case 1: hb_barrier (); return_trace (c->dispatch (u.aat, std::forward<Ts> (ds)...));
|
||||
#endif
|
||||
default: return_trace (c->default_return_value ());
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ struct IndexArray : Array16Of<Index>
|
||||
unsigned int *_count /* IN/OUT */,
|
||||
unsigned int *_indexes /* OUT */) const
|
||||
{
|
||||
if (_count)
|
||||
if (_count && _indexes)
|
||||
{
|
||||
+ this->as_array ().sub_array (start_offset, _count)
|
||||
| hb_sink (hb_array (_indexes, *_count))
|
||||
@@ -628,7 +628,7 @@ struct FeatureParamsCharacterVariants
|
||||
unsigned
|
||||
get_characters (unsigned start_offset, unsigned *char_count, hb_codepoint_t *chars) const
|
||||
{
|
||||
if (char_count)
|
||||
if (char_count && chars)
|
||||
{
|
||||
+ characters.as_array ().sub_array (start_offset, char_count)
|
||||
| hb_sink (hb_array (chars, *char_count))
|
||||
@@ -706,7 +706,7 @@ struct FeatureParams
|
||||
return true;
|
||||
#endif
|
||||
TRACE_SANITIZE (this);
|
||||
if (tag == HB_TAG ('s','i','z','e'))
|
||||
if (tag == HB_TAG ('s','i','z','e') && hb_barrier ())
|
||||
return_trace (u.size.sanitize (c));
|
||||
if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
|
||||
return_trace (u.stylisticSet.sanitize (c));
|
||||
@@ -720,7 +720,7 @@ struct FeatureParams
|
||||
#ifdef HB_NO_LAYOUT_FEATURE_PARAMS
|
||||
return;
|
||||
#endif
|
||||
if (tag == HB_TAG ('s','i','z','e'))
|
||||
if (tag == HB_TAG ('s','i','z','e') && hb_barrier ())
|
||||
return (u.size.collect_name_ids (nameids_to_retain));
|
||||
if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
|
||||
return (u.stylisticSet.collect_name_ids (nameids_to_retain));
|
||||
@@ -732,7 +732,7 @@ struct FeatureParams
|
||||
{
|
||||
TRACE_SUBSET (this);
|
||||
if (!tag) return_trace (false);
|
||||
if (*tag == HB_TAG ('s','i','z','e'))
|
||||
if (*tag == HB_TAG ('s','i','z','e') && hb_barrier ())
|
||||
return_trace (u.size.subset (c));
|
||||
if ((*tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
|
||||
return_trace (u.stylisticSet.subset (c));
|
||||
@@ -744,7 +744,7 @@ struct FeatureParams
|
||||
#ifndef HB_NO_LAYOUT_FEATURE_PARAMS
|
||||
const FeatureParamsSize& get_size_params (hb_tag_t tag) const
|
||||
{
|
||||
if (tag == HB_TAG ('s','i','z','e'))
|
||||
if (tag == HB_TAG ('s','i','z','e') && hb_barrier ())
|
||||
return u.size;
|
||||
return Null (FeatureParamsSize);
|
||||
}
|
||||
@@ -900,7 +900,7 @@ struct RecordArrayOf : SortedArray16Of<Record<Type>>
|
||||
unsigned int *record_count /* IN/OUT */,
|
||||
hb_tag_t *record_tags /* OUT */) const
|
||||
{
|
||||
if (record_count)
|
||||
if (record_count && record_tags)
|
||||
{
|
||||
+ this->as_array ().sub_array (start_offset, record_count)
|
||||
| hb_map (&Record<Type>::tag)
|
||||
@@ -2633,8 +2633,9 @@ struct hb_scalar_cache_t
|
||||
*cached_value = roundf(value * MULTIPLIER);
|
||||
}
|
||||
|
||||
private:
|
||||
public:
|
||||
unsigned length;
|
||||
private:
|
||||
mutable hb_atomic_t<int> static_values[STATIC_LENGTH];
|
||||
};
|
||||
|
||||
@@ -4959,10 +4960,12 @@ struct Device
|
||||
{
|
||||
#ifndef HB_NO_HINTING
|
||||
case 1: case 2: case 3:
|
||||
hb_barrier ();
|
||||
return u.hinting.get_x_delta (font);
|
||||
#endif
|
||||
#ifndef HB_NO_VAR
|
||||
case 0x8000:
|
||||
hb_barrier ();
|
||||
return u.variation.get_x_delta (font, store, store_cache);
|
||||
#endif
|
||||
default:
|
||||
@@ -4977,10 +4980,12 @@ struct Device
|
||||
{
|
||||
case 1: case 2: case 3:
|
||||
#ifndef HB_NO_HINTING
|
||||
hb_barrier ();
|
||||
return u.hinting.get_y_delta (font);
|
||||
#endif
|
||||
#ifndef HB_NO_VAR
|
||||
case 0x8000:
|
||||
hb_barrier ();
|
||||
return u.variation.get_y_delta (font, store, store_cache);
|
||||
#endif
|
||||
default:
|
||||
@@ -4995,10 +5000,12 @@ struct Device
|
||||
switch (u.b.format) {
|
||||
#ifndef HB_NO_HINTING
|
||||
case 1: case 2: case 3:
|
||||
hb_barrier ();
|
||||
return_trace (u.hinting.sanitize (c));
|
||||
#endif
|
||||
#ifndef HB_NO_VAR
|
||||
case 0x8000:
|
||||
hb_barrier ();
|
||||
return_trace (u.variation.sanitize (c));
|
||||
#endif
|
||||
default:
|
||||
@@ -5015,10 +5022,12 @@ struct Device
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
hb_barrier ();
|
||||
return_trace (reinterpret_cast<Device *> (u.hinting.copy (c)));
|
||||
#endif
|
||||
#ifndef HB_NO_VAR
|
||||
case 0x8000:
|
||||
hb_barrier ();
|
||||
return_trace (reinterpret_cast<Device *> (u.variation.copy (c, layout_variation_idx_delta_map)));
|
||||
#endif
|
||||
default:
|
||||
@@ -5037,6 +5046,7 @@ struct Device
|
||||
#endif
|
||||
#ifndef HB_NO_VAR
|
||||
case 0x8000:
|
||||
hb_barrier ();
|
||||
u.variation.collect_variation_index (c);
|
||||
return;
|
||||
#endif
|
||||
@@ -5050,6 +5060,7 @@ struct Device
|
||||
switch (u.b.format) {
|
||||
#ifndef HB_NO_VAR
|
||||
case 0x8000:
|
||||
hb_barrier ();
|
||||
return u.variation.varIdx;
|
||||
#endif
|
||||
default:
|
||||
|
||||
@@ -675,9 +675,6 @@ struct skipping_iterator_t
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
#ifndef HB_OPTIMIZE_SIZE
|
||||
HB_ALWAYS_INLINE
|
||||
#endif
|
||||
bool next (unsigned *unsafe_to = nullptr)
|
||||
{
|
||||
auto *info = c->buffer->info;
|
||||
@@ -706,9 +703,6 @@ struct skipping_iterator_t
|
||||
*unsafe_to = end;
|
||||
return false;
|
||||
}
|
||||
#ifndef HB_OPTIMIZE_SIZE
|
||||
HB_ALWAYS_INLINE
|
||||
#endif
|
||||
bool prev (unsigned *unsafe_from = nullptr)
|
||||
{
|
||||
auto *out_info = c->buffer->out_info;
|
||||
@@ -949,7 +943,11 @@ struct hb_ot_apply_context_t :
|
||||
* match_props has the set index.
|
||||
*/
|
||||
if (match_props & LookupFlag::UseMarkFilteringSet)
|
||||
return gdef_accel.mark_set_covers (match_props >> 16, info->codepoint);
|
||||
{
|
||||
unsigned set_index = match_props >> 16;
|
||||
return gdef_accel.mark_set_may_cover (set_index, info->codepoint) &&
|
||||
gdef.mark_set_covers (set_index, info->codepoint);
|
||||
}
|
||||
|
||||
/* The second byte of match_props has the meaning
|
||||
* "ignore marks of attachment type different than
|
||||
|
||||
+16
-16
@@ -345,7 +345,7 @@ hb_ot_layout_get_glyphs_in_class (hb_face_t *face,
|
||||
* @start_offset: offset of the first attachment point to retrieve
|
||||
* @point_count: (inout) (nullable): Input = the maximum number of attachment points to return;
|
||||
* Output = the actual number of attachment points returned (may be zero)
|
||||
* @point_array: (out) (array length=point_count): The array of attachment points found for the query
|
||||
* @point_array: (out) (array length=point_count) (nullable): The array of attachment points found for the query
|
||||
*
|
||||
* Fetches a list of all attachment points for the specified glyph in the GDEF
|
||||
* table of the face. The list returned will begin at the offset provided.
|
||||
@@ -375,7 +375,7 @@ hb_ot_layout_get_attach_points (hb_face_t *face,
|
||||
* @start_offset: offset of the first caret position to retrieve
|
||||
* @caret_count: (inout) (nullable): Input = the maximum number of caret positions to return;
|
||||
* Output = the actual number of caret positions returned (may be zero)
|
||||
* @caret_array: (out) (array length=caret_count): The array of caret positions found for the query
|
||||
* @caret_array: (out) (array length=caret_count) (nullable): The array of caret positions found for the query
|
||||
*
|
||||
* Fetches a list of the caret positions defined for a ligature glyph in the GDEF
|
||||
* table of the font. The list returned will begin at the offset provided.
|
||||
@@ -446,7 +446,7 @@ get_gsubgpos_table (hb_face_t *face,
|
||||
* @start_offset: offset of the first script tag to retrieve
|
||||
* @script_count: (inout) (nullable): Input = the maximum number of script tags to return;
|
||||
* Output = the actual number of script tags returned (may be zero)
|
||||
* @script_tags: (out) (array length=script_count): The array of #hb_tag_t script tags found for the query
|
||||
* @script_tags: (out) (array length=script_count) (nullable): The array of #hb_tag_t script tags found for the query
|
||||
*
|
||||
* Fetches a list of all scripts enumerated in the specified face's GSUB table
|
||||
* or GPOS table. The list returned will begin at the offset provided.
|
||||
@@ -615,7 +615,7 @@ hb_ot_layout_table_select_script (hb_face_t *face,
|
||||
* @start_offset: offset of the first feature tag to retrieve
|
||||
* @feature_count: (inout) (nullable): Input = the maximum number of feature tags to return;
|
||||
* Output = the actual number of feature tags returned (may be zero)
|
||||
* @feature_tags: (out) (array length=feature_count): Array of feature tags found in the table
|
||||
* @feature_tags: (out) (array length=feature_count) (nullable): Array of feature tags found in the table
|
||||
*
|
||||
* Fetches a list of all feature tags in the given face's GSUB or GPOS table.
|
||||
* Note that there might be duplicate feature tags, belonging to different
|
||||
@@ -685,7 +685,7 @@ hb_ot_layout_table_find_feature (hb_face_t *face,
|
||||
* @start_offset: offset of the first language tag to retrieve
|
||||
* @language_count: (inout) (nullable): Input = the maximum number of language tags to return;
|
||||
* Output = the actual number of language tags returned (may be zero)
|
||||
* @language_tags: (out) (array length=language_count): Array of language tags found in the table
|
||||
* @language_tags: (out) (array length=language_count) (nullable): Array of language tags found in the table
|
||||
*
|
||||
* Fetches a list of language tags in the given face's GSUB or GPOS table, underneath
|
||||
* the specified script index. The list returned will begin at the offset provided.
|
||||
@@ -913,7 +913,7 @@ hb_ot_layout_language_get_required_feature (hb_face_t *face,
|
||||
* @start_offset: offset of the first feature tag to retrieve
|
||||
* @feature_count: (inout) (nullable): Input = the maximum number of feature tags to return;
|
||||
* Output: the actual number of feature tags returned (may be zero)
|
||||
* @feature_indexes: (out) (array length=feature_count): The array of feature indexes found for the query
|
||||
* @feature_indexes: (out) (array length=feature_count) (nullable): The array of feature indexes found for the query
|
||||
*
|
||||
* Fetches a list of all features in the specified face's GSUB table
|
||||
* or GPOS table, underneath the specified script and language. The list
|
||||
@@ -949,7 +949,7 @@ hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
|
||||
* @start_offset: offset of the first feature tag to retrieve
|
||||
* @feature_count: (inout) (nullable): Input = the maximum number of feature tags to return;
|
||||
* Output = the actual number of feature tags returned (may be zero)
|
||||
* @feature_tags: (out) (array length=feature_count): The array of #hb_tag_t feature tags found for the query
|
||||
* @feature_tags: (out) (array length=feature_count) (nullable): The array of #hb_tag_t feature tags found for the query
|
||||
*
|
||||
* Fetches a list of all features in the specified face's GSUB table
|
||||
* or GPOS table, underneath the specified script and language. The list
|
||||
@@ -975,7 +975,7 @@ hb_ot_layout_language_get_feature_tags (hb_face_t *face,
|
||||
static_assert ((sizeof (unsigned int) == sizeof (hb_tag_t)), "");
|
||||
unsigned int ret = l.get_feature_indexes (start_offset, feature_count, (unsigned int *) feature_tags);
|
||||
|
||||
if (feature_tags) {
|
||||
if (feature_count && feature_tags) {
|
||||
unsigned int count = *feature_count;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
feature_tags[i] = g.get_feature_tag ((unsigned int) feature_tags[i]);
|
||||
@@ -1037,7 +1037,7 @@ hb_ot_layout_language_find_feature (hb_face_t *face,
|
||||
* @start_offset: offset of the first lookup to retrieve
|
||||
* @lookup_count: (inout) (nullable): Input = the maximum number of lookups to return;
|
||||
* Output = the actual number of lookups returned (may be zero)
|
||||
* @lookup_indexes: (out) (array length=lookup_count): The array of lookup indexes found for the query
|
||||
* @lookup_indexes: (out) (array length=lookup_count) (nullable): The array of lookup indexes found for the query
|
||||
*
|
||||
* Fetches a list of all lookups enumerated for the specified feature, in
|
||||
* the specified face's GSUB table or GPOS table. The list returned will
|
||||
@@ -1475,7 +1475,7 @@ hb_ot_layout_table_find_feature_variations (hb_face_t *face,
|
||||
* @start_offset: offset of the first lookup to retrieve
|
||||
* @lookup_count: (inout) (nullable): Input = the maximum number of lookups to return;
|
||||
* Output = the actual number of lookups returned (may be zero)
|
||||
* @lookup_indexes: (out) (array length=lookup_count): The array of lookups found for the query
|
||||
* @lookup_indexes: (out) (array length=lookup_count) (nullable): The array of lookups found for the query
|
||||
*
|
||||
* Fetches a list of all lookups enumerated for the specified feature, in
|
||||
* the specified face's GSUB table or GPOS table, enabled at the specified
|
||||
@@ -1854,7 +1854,7 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face,
|
||||
* @start_offset: offset of the first character to retrieve
|
||||
* @char_count: (inout) (nullable): Input = the maximum number of characters to return;
|
||||
* Output = the actual number of characters returned (may be zero)
|
||||
* @characters: (out caller-allocates) (array length=char_count): A buffer pointer.
|
||||
* @characters: (out caller-allocates) (array length=char_count) (nullable): A buffer pointer.
|
||||
* The Unicode codepoints of the characters for which this feature provides
|
||||
* glyph variants.
|
||||
*
|
||||
@@ -2288,7 +2288,7 @@ hb_ot_layout_get_horizontal_baseline_tag_for_script (hb_script_t script)
|
||||
* @language_tag: language tag, currently unused.
|
||||
* @coord: (out) (nullable): baseline value if found.
|
||||
*
|
||||
* Fetches a baseline value from the face.
|
||||
* Fetches a baseline value from the font.
|
||||
*
|
||||
* Return value: `true` if found baseline value in the font.
|
||||
*
|
||||
@@ -2314,7 +2314,7 @@ hb_ot_layout_get_baseline (hb_font_t *font,
|
||||
* @language: (nullable): language, currently unused.
|
||||
* @coord: (out) (nullable): baseline value if found.
|
||||
*
|
||||
* Fetches a baseline value from the face.
|
||||
* Fetches a baseline value from the font.
|
||||
*
|
||||
* This function is like hb_ot_layout_get_baseline() but takes
|
||||
* #hb_script_t and #hb_language_t instead of OpenType #hb_tag_t.
|
||||
@@ -2350,7 +2350,7 @@ hb_ot_layout_get_baseline2 (hb_font_t *font,
|
||||
* @language_tag: language tag, currently unused.
|
||||
* @coord: (out): baseline value if found.
|
||||
*
|
||||
* Fetches a baseline value from the face, and synthesizes
|
||||
* Fetches a baseline value from the font, and synthesizes
|
||||
* it if the font does not have it.
|
||||
*
|
||||
* Since: 4.0.0
|
||||
@@ -2572,7 +2572,7 @@ hb_ot_layout_get_baseline_with_fallback (hb_font_t *font,
|
||||
* @language: (nullable): language, currently unused.
|
||||
* @coord: (out): baseline value if found.
|
||||
*
|
||||
* Fetches a baseline value from the face, and synthesizes
|
||||
* Fetches a baseline value from the font, and synthesizes
|
||||
* it if the font does not have it.
|
||||
*
|
||||
* This function is like hb_ot_layout_get_baseline_with_fallback() but takes
|
||||
@@ -2629,7 +2629,7 @@ struct hb_get_glyph_alternates_dispatch_t :
|
||||
* @start_offset: starting offset.
|
||||
* @alternate_count: (inout) (nullable): Input = the maximum number of alternate glyphs to return;
|
||||
* Output = the actual number of alternate glyphs returned (may be zero).
|
||||
* @alternate_glyphs: (out caller-allocates) (array length=alternate_count): A glyphs buffer.
|
||||
* @alternate_glyphs: (out caller-allocates) (array length=alternate_count) (nullable): A glyphs buffer.
|
||||
* Alternate glyphs associated with the glyph id.
|
||||
*
|
||||
* Fetches alternates of a glyph from a given GSUB lookup index. Note that for one-to-one GSUB
|
||||
|
||||
@@ -373,7 +373,7 @@ struct MathKern
|
||||
const MathValueRecord* kernValue = mathValueRecordsZ.arrayZ + heightCount;
|
||||
const unsigned int entriesCount = heightCount + 1;
|
||||
|
||||
if (entries_count)
|
||||
if (entries_count && kern_entries)
|
||||
{
|
||||
unsigned int start = hb_min (start_offset, entriesCount);
|
||||
unsigned int end = hb_min (start + *entries_count, entriesCount);
|
||||
@@ -783,7 +783,7 @@ struct MathGlyphAssembly
|
||||
hb_ot_math_glyph_part_t *parts /* OUT */,
|
||||
hb_position_t *italics_correction /* OUT */) const
|
||||
{
|
||||
if (parts_count)
|
||||
if (parts_count && parts)
|
||||
{
|
||||
int64_t mult = font->dir_mult (direction);
|
||||
for (auto _ : hb_zip (partRecords.as_array ().sub_array (start_offset, parts_count),
|
||||
@@ -858,7 +858,7 @@ struct MathGlyphConstruction
|
||||
unsigned int *variants_count, /* IN/OUT */
|
||||
hb_ot_math_glyph_variant_t *variants /* OUT */) const
|
||||
{
|
||||
if (variants_count)
|
||||
if (variants_count && variants)
|
||||
{
|
||||
int64_t mult = font->dir_mult (direction);
|
||||
for (auto _ : hb_zip (mathGlyphVariantRecord.as_array ().sub_array (start_offset, variants_count),
|
||||
@@ -980,7 +980,7 @@ struct MathVariants
|
||||
bool subset (hb_subset_context_t *c) const
|
||||
{
|
||||
TRACE_SUBSET (this);
|
||||
const hb_set_t &glyphset = c->plan->_glyphset_mathed;
|
||||
const hb_set_t &glyphset = c->plan->_glyphset_cmaped;
|
||||
const hb_map_t &glyph_map = *c->plan->glyph_map;
|
||||
|
||||
auto *out = c->serializer->start_embed (*this);
|
||||
|
||||
+3
-3
@@ -206,7 +206,7 @@ hb_ot_math_get_glyph_kerning (hb_font_t *font,
|
||||
* @start_offset: offset of the first kern entry to retrieve
|
||||
* @entries_count: (inout) (optional): Input = the maximum number of kern entries to return;
|
||||
* Output = the actual number of kern entries returned
|
||||
* @kern_entries: (out caller-allocates) (array length=entries_count): array of kern entries returned
|
||||
* @kern_entries: (out caller-allocates) (array length=entries_count) (nullable): array of kern entries returned
|
||||
*
|
||||
* Fetches the raw MathKern (cut-in) data for the specified font, glyph index,
|
||||
* and @kern. The corresponding list of kern values and correction heights is
|
||||
@@ -251,7 +251,7 @@ hb_ot_math_get_glyph_kernings (hb_font_t *font,
|
||||
* @start_offset: offset of the first variant to retrieve
|
||||
* @variants_count: (inout): Input = the maximum number of variants to return;
|
||||
* Output = the actual number of variants returned
|
||||
* @variants: (out) (array length=variants_count): array of variants returned
|
||||
* @variants: (out) (array length=variants_count) (nullable): array of variants returned
|
||||
*
|
||||
* Fetches the MathGlyphConstruction for the specified font, glyph index, and
|
||||
* direction. The corresponding list of size variants is returned as a list of
|
||||
@@ -313,7 +313,7 @@ hb_ot_math_get_min_connector_overlap (hb_font_t *font,
|
||||
* @start_offset: offset of the first glyph part to retrieve
|
||||
* @parts_count: (inout): Input = maximum number of glyph parts to return;
|
||||
* Output = actual number of parts returned
|
||||
* @parts: (out) (array length=parts_count): the glyph parts returned
|
||||
* @parts: (out) (array length=parts_count) (nullable): the glyph parts returned
|
||||
* @italics_correction: (out): italics correction of the glyph assembly
|
||||
*
|
||||
* Fetches the GlyphAssembly for the specified font, glyph index, and direction.
|
||||
|
||||
@@ -83,7 +83,7 @@ struct meta
|
||||
unsigned int *count,
|
||||
hb_ot_meta_tag_t *entries) const
|
||||
{
|
||||
if (count)
|
||||
if (count && entries)
|
||||
{
|
||||
+ table->dataMaps.as_array ().sub_array (start_offset, count)
|
||||
| hb_map (&DataMap::get_tag)
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
* @face: a face object
|
||||
* @start_offset: iteration's start offset
|
||||
* @entries_count:(inout) (optional): buffer size as input, filled size as output
|
||||
* @entries: (out caller-allocates) (array length=entries_count): entries tags buffer
|
||||
* @entries: (out caller-allocates) (array length=entries_count) (nullable): entries tags buffer
|
||||
*
|
||||
* Fetches all available feature types.
|
||||
*
|
||||
|
||||
@@ -188,7 +188,7 @@ struct post
|
||||
|
||||
if (unlikely (!gids))
|
||||
{
|
||||
gids = (uint16_t *) hb_malloc (count * sizeof (gids[0]));
|
||||
gids = (uint16_t *) hb_malloc2 (count, sizeof (gids[0]));
|
||||
if (unlikely (!gids))
|
||||
return false; /* Anything better?! */
|
||||
|
||||
|
||||
@@ -67,14 +67,23 @@ static void
|
||||
override_features_hangul (hb_ot_shape_planner_t *plan)
|
||||
{
|
||||
/* Uniscribe does not apply 'calt' for Hangul, and certain fonts
|
||||
* (Noto Sans CJK, Source Sans Han, etc) apply all of jamo lookups
|
||||
* in calt, which is not desirable. */
|
||||
plan->map.disable_feature (HB_TAG('c','a','l','t'));
|
||||
* (Noto Sans CJK, Source Han Sans, etc) apply all of jamo lookups
|
||||
* in calt, which is not desirable.
|
||||
*
|
||||
* Rather than disabling 'calt' for the entire run, which also turns
|
||||
* it off for any other characters in the run, allocate a mask for it
|
||||
* and clear that mask on jamo only (in setup_masks_hangul). That
|
||||
* keeps jamo out of reach of such lookups while letting the rest of
|
||||
* the run shape with 'calt' as usual.
|
||||
*
|
||||
* https://github.com/harfbuzz/harfbuzz/discussions/4853 */
|
||||
plan->map.add_feature (HB_TAG('c','a','l','t'));
|
||||
}
|
||||
|
||||
struct hangul_shape_plan_t
|
||||
{
|
||||
hb_mask_t mask_array[HANGUL_FEATURE_COUNT];
|
||||
hb_mask_t calt_mask;
|
||||
};
|
||||
|
||||
static void *
|
||||
@@ -87,6 +96,8 @@ data_create_hangul (const hb_ot_shape_plan_t *plan)
|
||||
for (unsigned int i = 0; i < HANGUL_FEATURE_COUNT; i++)
|
||||
hangul_plan->mask_array[i] = plan->map.get_1_mask (hangul_features[i]);
|
||||
|
||||
hangul_plan->calt_mask = plan->map.get_1_mask (HB_TAG('c','a','l','t'));
|
||||
|
||||
return hangul_plan;
|
||||
}
|
||||
|
||||
@@ -405,7 +416,14 @@ setup_masks_hangul (const hb_ot_shape_plan_t *plan,
|
||||
unsigned int count = buffer->len;
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
for (unsigned int i = 0; i < count; i++, info++)
|
||||
{
|
||||
info->mask |= hangul_plan->mask_array[info->hangul_shaping_feature()];
|
||||
|
||||
/* Keep 'calt' away from jamo; see override_features_hangul(). */
|
||||
hb_codepoint_t u = info->codepoint;
|
||||
if (isL (u) || isV (u) || isT (u))
|
||||
info->mask &= ~hangul_plan->calt_mask;
|
||||
}
|
||||
}
|
||||
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, hangul_shaping_feature);
|
||||
|
||||
Loaded 100 of 238 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user