texlive[74849] Build/source/libs: harfbuzz 11.0.1
commits+kakuto at tug.org
commits+kakuto at tug.org
Sat Apr 5 01:39:11 CEST 2025
Revision: 74849
https://tug.org/svn/texlive?view=revision&revision=74849
Author: kakuto
Date: 2025-04-05 01:39:11 +0200 (Sat, 05 Apr 2025)
Log Message:
-----------
harfbuzz 11.0.1
Modified Paths:
--------------
trunk/Build/source/libs/README
trunk/Build/source/libs/harfbuzz/ChangeLog
trunk/Build/source/libs/harfbuzz/TLpatches/ChangeLog
trunk/Build/source/libs/harfbuzz/TLpatches/TL-Changes
trunk/Build/source/libs/harfbuzz/configure
trunk/Build/source/libs/harfbuzz/harfbuzz-src/NEWS
trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.md
trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.mingw.md
trunk/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md
trunk/Build/source/libs/harfbuzz/harfbuzz-src/meson.build
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat1.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat2.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Var/VARC/VARC.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/fontations/lib.rs
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.rl
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cache.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext-font.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite-shape.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-draw.h
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh
trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build
trunk/Build/source/libs/harfbuzz/version.ac
Modified: trunk/Build/source/libs/README
===================================================================
--- trunk/Build/source/libs/README 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/README 2025-04-04 23:39:11 UTC (rev 74849)
@@ -28,7 +28,7 @@
https://sourceforge.net/projects/silgraphite/files/graphite2/
(requires C++11)
-harfbuzz 11.0.0 - checked 24mar25
+harfbuzz 11.0.1 - checked 05apr25
https://github.com/harfbuzz/harfbuzz/releases/latest
icu 76.1 - checked 27oct24 (requires C++17, e.g., g++13)
Modified: trunk/Build/source/libs/harfbuzz/ChangeLog
===================================================================
--- trunk/Build/source/libs/harfbuzz/ChangeLog 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/ChangeLog 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1,3 +1,8 @@
+2025-04-05 Akira Kakuto <kakuto at jcom.zaq.ne.jp>
+
+ Import harfbuzz-11.0.1.
+ * version.ac: Adjusted.
+
2025-03-24 Akira Kakuto <kakuto at jcom.zaq.ne.jp>
Import harfbuzz-11.0.0.
Modified: trunk/Build/source/libs/harfbuzz/TLpatches/ChangeLog
===================================================================
--- trunk/Build/source/libs/harfbuzz/TLpatches/ChangeLog 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/TLpatches/ChangeLog 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1,3 +1,8 @@
+2025-04-05 Akira Kakuto <kakuto at jcom.zaq.ne.jp>
+
+ Imported harfbuzz-11.0.1 source tree from:
+ https://github.com/harfbuzz/harfbuzz/releases/download/11.0.1/
+
2025-03-24 Akira Kakuto <kakuto at jcom.zaq.ne.jp>
Imported harfbuzz-11.0.0 source tree from:
Modified: trunk/Build/source/libs/harfbuzz/TLpatches/TL-Changes
===================================================================
--- trunk/Build/source/libs/harfbuzz/TLpatches/TL-Changes 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/TLpatches/TL-Changes 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1,5 +1,5 @@
-Changes applied to the harfbuzz-11.0.0/ tree as obtained from:
- https://github.com/harfbuzz/harfbuzz/releases/download/11.0.0/
+Changes applied to the harfbuzz-11.0.1/ tree as obtained from:
+ https://github.com/harfbuzz/harfbuzz/releases/download/11.0.1/
Removed:
.clang-format
Modified: trunk/Build/source/libs/harfbuzz/configure
===================================================================
--- trunk/Build/source/libs/harfbuzz/configure 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/configure 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for harfbuzz (TeX Live) 11.0.0.
+# Generated by GNU Autoconf 2.72 for harfbuzz (TeX Live) 11.0.1.
#
# Report bugs to <tex-k at tug.org>.
#
@@ -604,8 +604,8 @@
# Identity of this package.
PACKAGE_NAME='harfbuzz (TeX Live)'
PACKAGE_TARNAME='harfbuzz--tex-live-'
-PACKAGE_VERSION='11.0.0'
-PACKAGE_STRING='harfbuzz (TeX Live) 11.0.0'
+PACKAGE_VERSION='11.0.1'
+PACKAGE_STRING='harfbuzz (TeX Live) 11.0.1'
PACKAGE_BUGREPORT='tex-k at tug.org'
PACKAGE_URL=''
@@ -1341,7 +1341,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-'configure' configures harfbuzz (TeX Live) 11.0.0 to adapt to many kinds of systems.
+'configure' configures harfbuzz (TeX Live) 11.0.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1413,7 +1413,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of harfbuzz (TeX Live) 11.0.0:";;
+ short | recursive ) echo "Configuration of harfbuzz (TeX Live) 11.0.1:";;
esac
cat <<\_ACEOF
@@ -1518,7 +1518,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-harfbuzz (TeX Live) configure 11.0.0
+harfbuzz (TeX Live) configure 11.0.1
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2075,7 +2075,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by harfbuzz (TeX Live) $as_me 11.0.0, which was
+It was created by harfbuzz (TeX Live) $as_me 11.0.1, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -5252,7 +5252,7 @@
# Define the identity of the package.
PACKAGE='harfbuzz--tex-live-'
- VERSION='11.0.0'
+ VERSION='11.0.1'
# Some tools Automake needs.
@@ -5442,8 +5442,8 @@
HB_VERSION_MAJOR=11
HB_VERSION_MINOR=0
-HB_VERSION_MICRO=0
-HB_VERSION=11.0.0
+HB_VERSION_MICRO=1
+HB_VERSION=11.0.1
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -9292,7 +9292,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by harfbuzz (TeX Live) $as_me 11.0.0, which was
+This file was extended by harfbuzz (TeX Live) $as_me 11.0.1, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -9360,7 +9360,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-harfbuzz (TeX Live) config.status 11.0.0
+harfbuzz (TeX Live) config.status 11.0.1
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/NEWS
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/NEWS 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/NEWS 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1,4 +1,35 @@
Overview of changes leading to 11.0.0
+Friday, April 4, 2025
+====================================
+- The change in version 10.3.0 to apply “trak” table tracking values to glyph
+ advances directly has been reverted as it required every font functions
+ implementation to handle it, which breaks existing custom font functions.
+ Tracking is instead back to being applied during shaping.
+- When `directwrite` integration is enabled, we now link to `dwrite.dll`
+ instead of dynamically loading it.
+- A new experimental APIs for getting raw “CFF” and “CFF2” CharStrings.
+- We now provide manpages for the various command line utilities. Building
+ manpages requires “help2man” and will be skipped if it is not present.
+- The command line utilities now set different return value for different kinds
+ of failures. Details are provided in the manpages.
+- Various fixes and improvements to `fontations` font functions.
+- All shaping operations using the `ot` shaper have become memory
+ allocation-free.
+- Glyph extents returned by `hb-ot` and `hb-ft` font functions are now rounded
+ in stead of flooring/ceiling them, which also matches what other font
+ libraries do.
+- Fix “AAT” deleted glyph marks interfering with fallback mark positioning.
+- Glyph outlines emboldening have been moved out of `hb-ot` and `hb-ft` font
+ functions to the HarfBuzz font layer, so that it works with any font
+ functions implementation.
+- Fix our fallback C++11 atomics integration, which seems to not be widely
+ used.
+- Various testing fixes and improvements.
+- Various subsetting fixes and improvements.
+- Various other fixes and improvements.
+
+
+Overview of changes leading to 11.0.0
Monday, March 24, 2025
====================================
- There are three new font-functions implementations (integrations) in this
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.md
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.md 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.md 2025-04-04 23:39:11 UTC (rev 74849)
@@ -35,14 +35,21 @@
`hb-view.exe`, `hb-shape.exe`, and all dependencies.
The canonical source tree is available on [github][4].
+Both development and user support discussion around HarfBuzz happens on
+[github][4] as well.
The API that comes with `hb.h` will not change incompatibly. Other, peripheral,
headers are more likely to go through minor modifications, but again, we do our
best to never change API in an incompatible way. We will never break the ABI.
-If you are not sure whether Pango or HarfBuzz is right for you, read [Pango vs
-HarfBuzz][5].
+The API and ABI are stable even across major version number jumps. In fact,
+current HarfBuzz is API/ABI compatible all the way back to the 0.9.x series.
+If one day we need to break the API/ABI, that would be called a new a library.
+As such, we bump the major version number only when we add major new features,
+the minor version when there is new API, and the micro version when there
+are bug fixes.
+
## Development
For build information, see [BUILD.md](BUILD.md).
@@ -51,27 +58,35 @@
For testing and profiling, see [TESTING.md](TESTING.md).
+For using with Python, see [README.python.md](README.python.md). There is also [uharfbuzz](https://github.com/harfbuzz/uharfbuzz).
+
For cross-compiling to Windows from Linux or macOS, see [README.mingw.md](README.mingw.md).
+To report bugs or submit patches please use [github][4] issues and pull-requests.
+
+### Developer documents
+
To get a better idea of where HarfBuzz stands in the text rendering stack you
may want to read [State of Text Rendering 2024][6].
Here are a few presentation slides about HarfBuzz at the
Internationalization and Unicode Conference over the years:
-* November 2014, [Unicode, OpenType, and HarfBuzz: Closing the Circle][7],
-* October 2012, [HarfBuzz, The Free and Open Text Shaping Engine][8],
-* October 2009, [HarfBuzz: the Free and Open Shaping Engine][9].
+- November 2014, [Unicode, OpenType, and HarfBuzz: Closing the Circle][7],
+- October 2012, [HarfBuzz, The Free and Open Text Shaping Engine][8],
+- October 2009, [HarfBuzz: the Free and Open Shaping Engine][9].
-Both development and user support discussion around HarfBuzz happens on the
-[github][4].
+More presentations and papers are available on [behdad][11]'s website.
+In particular, the following documents are relevant to HarfBuzz development:
-To report bugs or submit patches please use [github][4] issues and
-pull-requests.
+- 2025 — HarfBuzz Study: Caching — [Paper][12]
+- 2025 — HarfBuzz Study: `hb-decycler` — [Paper][13]
+- 2022 — HarfBuzz Study: `hb-iter` — [Paper][14]
+- 2022 — HarfBuzz Study: A C library written in C++ — [Paper][15]
+- 2022 — HarfBuzz Study: PackTab: A static integer table packer — [Paper][16]
+- 2014 — Reflections on Building the HarfBuzz Indic Shaper — [Paper][17]
+- 2012 — HarfBuzz Memory Consumption — [Paper][10]
-For a comparison of old vs new HarfBuzz memory consumption see [this][10].
-<!--See past and upcoming [HarfBuzz Hackfests](https://freedesktop.org/wiki/Software/HarfBuzz/Hackfests/)!-->
-
## Name
HarfBuzz (حرفباز) is the literal Persian translation of “[OpenType][1]”,
@@ -98,9 +113,15 @@
[2]: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6AATIntro.html
[3]: https://github.com/harfbuzz/harfbuzz/releases
[4]: https://github.com/harfbuzz/harfbuzz
-[5]: http://mces.blogspot.com/2009/11/pango-vs-harfbuzz.html
[6]: http://behdad.org/text2024
-[7]: https://goo.gl/FSIQuC
-[8]: https://goo.gl/2wSRu
+[7]: https://docs.google.com/presentation/d/1x97pfbB1gbD53Yhz6-_yBUozQMVJ_5yMqqR_D-R7b7I/preview
+[8]: https://docs.google.com/presentation/d/1ySTZaXP5XKFg0OpmHZM00v5b17GSr3ojnzJekl4U8qI/preview
[9]: http://behdad.org/download/Presentations/slippy/harfbuzz_slides.pdf
-[10]: https://goo.gl/woyty
+[10]: https://docs.google.com/document/d/12jfNpQJzeVIAxoUSpk7KziyINAa1msbGliyXqguS86M/preview
+[11]: https://behdad.org/
+[12]: https://docs.google.com/document/d/1_VgObf6Je0J8byMLsi7HCQHnKo2emGnx_ib_sHo-bt4/preview
+[13]: https://docs.google.com/document/d/1Y-u08l9YhObRVObETZt1k8f_5lQdOix9TRH3zEXaoAw/preview
+[14]: https://docs.google.com/document/d/1o-xvxCbgMe9JYFHLVnPjk01ZY_8Cj0vB9-KTI1d0nyk/preview
+[15]: https://docs.google.com/document/d/18hI56KJpvXtwWbc9QSaz9zzhJwIMnrJ-zkAaKS-W-8k/preview
+[16]: https://docs.google.com/document/d/1Xq3owVt61HVkJqbLFHl73il6pcTy6PdPJJ7bSouQiQw/preview
+[17]: https://docs.google.com/document/d/1wMPwVNBvsIriamcyBO5aNs7Cdr8lmbwLJ8GmZBAswF4/preview
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.mingw.md
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.mingw.md 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/README.mingw.md 2025-04-04 23:39:11 UTC (rev 74849)
@@ -30,6 +30,11 @@
- Ubuntu, 64bit: `apt install wine wine64`.
- Mac: `brew install wine-stable`.
+Note that to run Wine on Apple silicon systems, you need the Apple Rosetta translator.
+Follow the instructions you got from brew. This should do it:
+
+ - `softwareupdate --install-rosetta --agree-to-license`
+
2. Install the `mingw-w64` cross-compiler.
- Fedora, 32bit: `dnf install mingw32-gcc-c++`
@@ -41,7 +46,7 @@
3. Install dependencies.
First, make sure you do not have the mingw32 harfbuzz package, as that will
-override our own build:
+override our own build with older `meson`:
- Fedora, 32bit: `dnf remove mingw32-harfbuzz`
- Fedora, 64bit: `dnf remove mingw64-harfbuzz`
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/RELEASING.md 2025-04-04 23:39:11 UTC (rev 74849)
@@ -3,17 +3,17 @@
- [ ] Open gitk and review changes since last release.
- [ ] Print all public API changes:
- `git diff $(git describe | sed 's/-.*//').. src/*.h`
+ `git diff $(git describe | sed 's/-.*//').. src/*.h`
- [ ] Document them in NEWS.
- All API and API semantic changes should be clearly marked as API additions, API changes, or API deletions.
+ All API and API semantic changes should be clearly marked as API additions, API changes, or API deletions.
- [ ] Document deprecations.
- Ensure all new API / deprecations are in listed correctly in docs/harfbuzz-sections.txt.
- If release added new API, add entry for new API index at the end of docs/harfbuzz-docs.xml.
+ Ensure all new API / deprecations are listed correctly in docs/harfbuzz-sections.txt.
+ If release added new API, add entry for new API index at the end of docs/harfbuzz-docs.xml.
- If there's a backward-incompatible API change (including deletions for API used anywhere), that's a release blocker.
- Do NOT release.
+ If there's a backward-incompatible API change (including deletions for API used anywhere), that's a release blocker.
+ Do NOT release.
- [ ] Based on severity of changes, decide whether it's a minor or micro release number bump.
@@ -26,12 +26,16 @@
- [ ] Do a `meson test -Cbuild` so it both checks the tests and updates hb-version.h (use `git diff` to see if is really updated).
- [ ] Commit NEWS, meson.build, and src/hb-version.h, as well as any REPLACEME changes you made.
- The commit message is simply the release number, e. g. "1.4.7"
+ The commit message is simply the release number, e. g. "1.4.7"
- [ ] Do a `meson dist -Cbuild` that runs the tests against the latest committed changes.
- If doesn't pass, something fishy is going on, reset the repo and start over.
+ If it does not pass, something fishy is going on, reset the repo and start over.
- [ ] Tag the release and sign it: e.g. `git tag -s 1.4.7 -m 1.4.7`.
Enter your GPG password.
- [ ] Push the commit and tag out: `git push --follow-tags`.
+
+- [ ] There should be a GitHub release automatically created.
+ When it does, go to that release page and add description.
+ The description should be the NEWS file additions.
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/meson.build
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/meson.build 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/meson.build 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1,6 +1,6 @@
project('harfbuzz', ['c', 'cpp'],
meson_version: '>= 0.55.0',
- version: '11.0.0',
+ version: '11.0.1',
default_options: [
'cpp_eh=none', # Just to support msvc, we are passing -fno-exceptions also anyway
# 'cpp_rtti=false', # Do NOT enable, wraps inherit it and ICU needs RTTI
@@ -332,12 +332,16 @@
endif
endif
+directwrite_dep = []
# DirectWrite (Windows)
if host_machine.system() == 'windows' and not get_option('directwrite').disabled()
if get_option('directwrite').enabled() and not cpp.has_header('dwrite_3.h')
error('DirectWrite was enabled explicitly, but required header is missing.')
endif
- conf.set('HAVE_DIRECTWRITE', 1)
+ directwrite_dep = cpp.find_library('dwrite', required: get_option('directwrite'))
+ if directwrite_dep.found()
+ conf.set('HAVE_DIRECTWRITE', 1)
+ endif
endif
# CoreText (macOS)
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat1.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat1.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat1.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -77,7 +77,7 @@
bool intersects (const hb_set_t *glyphs) const
{
- if (glyphArray.len > glyphs->get_population () * hb_bit_storage ((unsigned) glyphArray.len) / 2)
+ if (glyphArray.len > glyphs->get_population () * hb_bit_storage ((unsigned) glyphArray.len))
{
for (auto g : *glyphs)
if (get_coverage (g) != NOT_COVERED)
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat2.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat2.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/Common/CoverageFormat2.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -120,7 +120,7 @@
bool intersects (const hb_set_t *glyphs) const
{
- if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len) / 2)
+ if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len))
{
for (auto g : *glyphs)
if (get_coverage (g) != NOT_COVERED)
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GDEF/GDEF.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -205,20 +205,19 @@
unsigned varidx = (this+deviceTable).get_variation_index ();
hb_pair_t<unsigned, int> *new_varidx_delta;
- if (!c->plan->layout_variation_idx_delta_map.has (varidx, &new_varidx_delta))
- return_trace (false);
+ if (c->plan->layout_variation_idx_delta_map.has (varidx, &new_varidx_delta)) {
+ uint32_t new_varidx = hb_first (*new_varidx_delta);
+ int delta = hb_second (*new_varidx_delta);
+ if (delta != 0)
+ {
+ if (!c->serializer->check_assign (out->coordinate, coordinate + delta, HB_SERIALIZE_ERROR_INT_OVERFLOW))
+ return_trace (false);
+ }
- uint32_t new_varidx = hb_first (*new_varidx_delta);
- int delta = hb_second (*new_varidx_delta);
- if (delta != 0)
- {
- if (!c->serializer->check_assign (out->coordinate, coordinate + delta, HB_SERIALIZE_ERROR_INT_OVERFLOW))
- return_trace (false);
+ if (new_varidx == HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
+ return_trace (c->serializer->check_assign (out->caretValueFormat, 1, HB_SERIALIZE_ERROR_INT_OVERFLOW));
}
- if (new_varidx == HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
- return_trace (c->serializer->check_assign (out->caretValueFormat, 1, HB_SERIALIZE_ERROR_INT_OVERFLOW));
-
if (!c->serializer->embed (deviceTable))
return_trace (false);
@@ -1015,7 +1014,8 @@
hb_blob_ptr_t<GDEF> table;
#ifndef HB_NO_GDEF_CACHE
hb_vector_t<hb_set_digest_t> mark_glyph_set_digests;
- mutable hb_cache_t<21, 3, 8> glyph_props_cache;
+ mutable hb_cache_t<21, 3> glyph_props_cache;
+ static_assert (sizeof (glyph_props_cache) == 512, "");
#endif
};
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -54,7 +54,7 @@
{
auto &cov = this+coverage;
- if (pairSet.len > glyphs->get_population () * hb_bit_storage ((unsigned) pairSet.len) / 4)
+ if (pairSet.len > glyphs->get_population () * hb_bit_storage ((unsigned) pairSet.len))
{
for (hb_codepoint_t g : glyphs->iter())
{
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Var/VARC/VARC.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Var/VARC/VARC.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Var/VARC/VARC.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -392,7 +392,7 @@
hb_ubytes_t record = (this+glyphRecords)[idx];
- float static_cache[sizeof (void *) * 16];
+ VarRegionList::cache_t static_cache[sizeof (void *) * 16];
VarRegionList::cache_t *cache = parent_cache ?
parent_cache :
(this+varStore).create_cache (hb_array (static_cache));
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/fontations/lib.rs
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/fontations/lib.rs 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/fontations/lib.rs 2025-04-04 23:39:11 UTC (rev 74849)
@@ -11,6 +11,9 @@
use std::sync::{Mutex, OnceLock};
use read_fonts::tables::cpal::ColorRecord;
+use read_fonts::tables::vmtx::Vmtx;
+use read_fonts::tables::vorg::Vorg;
+use read_fonts::tables::vvar::Vvar;
use read_fonts::TableProvider;
use skrifa::charmap::Charmap;
use skrifa::charmap::MapVariant::Variant;
@@ -64,6 +67,9 @@
glyph_names: GlyphNames<'a>,
glyph_from_names: OnceLock<HashMap<String, hb_codepoint_t>>,
size: Size,
+ vert_metrics: Option<Vmtx<'a>>,
+ vert_origin: Option<Vorg<'a>>,
+ vert_vars: Option<Vvar<'a>>,
// Mutex for the below
mutex: Mutex<()>,
@@ -82,7 +88,8 @@
let blob_data = hb_blob_get_data(face_blob, null_mut());
let face_data = std::slice::from_raw_parts(blob_data as *const u8, blob_length as usize);
- let font_ref = FontRef::from_index(face_data, face_index).unwrap();
+ let font_ref = FontRef::from_index(face_data, face_index)
+ .expect("FontRef::from_index should succeed on valid HarfBuzz face data");
let char_map = Charmap::new(&font_ref);
@@ -94,6 +101,10 @@
let upem = hb_face_get_upem(hb_font_get_face(font));
+ let vert_metrics = font_ref.vmtx().ok();
+ let vert_origin = font_ref.vorg().ok();
+ let vert_vars = font_ref.vvar().ok();
+
let mut data = FontationsData {
face_blob,
font,
@@ -104,6 +115,9 @@
glyph_names,
glyph_from_names: OnceLock::new(),
size: Size::new(upem as f32),
+ vert_metrics,
+ vert_origin,
+ vert_vars,
mutex: Mutex::new(()),
x_mult: 1.0,
y_mult: 1.0,
@@ -216,6 +230,7 @@
_user_data: *mut ::std::os::raw::c_void,
) -> hb_bool_t {
let data = unsafe { &*(font_data as *const FontationsData) };
+
let char_map = &data.char_map;
match char_map.map_variant(unicode, variation_selector) {
@@ -245,11 +260,145 @@
for i in 0..count {
let glyph = struct_at_offset(first_glyph, i, glyph_stride);
let glyph_id = GlyphId::new(glyph);
- let advance = (glyph_metrics.advance_width(glyph_id).unwrap_or_default() * data.x_mult)
- .round() as i32;
- *struct_at_offset_mut(first_advance, i, advance_stride) = advance as hb_position_t;
+ let advance = glyph_metrics.advance_width(glyph_id).unwrap_or_default();
+ let scaled = (advance * data.x_mult).round() as hb_position_t;
+ *struct_at_offset_mut(first_advance, i, advance_stride) = scaled;
}
}
+
+extern "C" fn _hb_fontations_get_glyph_v_advances(
+ font: *mut hb_font_t,
+ font_data: *mut ::std::os::raw::c_void,
+ count: ::std::os::raw::c_uint,
+ first_glyph: *const hb_codepoint_t,
+ glyph_stride: ::std::os::raw::c_uint,
+ first_advance: *mut hb_position_t,
+ advance_stride: ::std::os::raw::c_uint,
+ _user_data: *mut ::std::os::raw::c_void,
+) {
+ let data = unsafe { &mut *(font_data as *mut FontationsData) };
+ data.check_for_updates();
+
+ if let Some(vert_metrics) = &data.vert_metrics {
+ let vert_vars = &data.vert_vars;
+ for i in 0..count {
+ let glyph = struct_at_offset(first_glyph, i, glyph_stride);
+ let glyph_id = GlyphId::new(glyph);
+ let mut advance = vert_metrics.advance(glyph_id).unwrap_or_default() as f32;
+ if let Some(vert_vars) = vert_vars {
+ let coords = data.location.coords();
+ if !coords.is_empty() {
+ advance += vert_vars
+ .advance_height_delta(glyph_id, coords)
+ .unwrap_or_default()
+ .to_f32();
+ }
+ }
+ let scaled = -(advance * data.y_mult).round() as hb_position_t;
+ *struct_at_offset_mut(first_advance, i, advance_stride) = scaled;
+ }
+ } else {
+ let mut font_extents = unsafe { std::mem::zeroed() };
+ unsafe {
+ hb_font_get_extents_for_direction(
+ font,
+ hb_direction_t_HB_DIRECTION_LTR,
+ &mut font_extents,
+ );
+ }
+ let advance: hb_position_t = -(font_extents.ascender - font_extents.descender);
+
+ for i in 0..count {
+ *struct_at_offset_mut(first_advance, i, advance_stride) = advance;
+ }
+ }
+}
+
+extern "C" fn _hb_fontations_get_glyph_v_origin(
+ font: *mut hb_font_t,
+ font_data: *mut ::std::os::raw::c_void,
+ glyph: hb_codepoint_t,
+ x: *mut hb_position_t,
+ y: *mut hb_position_t,
+ _user_data: *mut ::std::os::raw::c_void,
+) -> hb_bool_t {
+ let data = unsafe { &mut *(font_data as *mut FontationsData) };
+ data.check_for_updates();
+
+ unsafe {
+ *x = hb_font_get_glyph_h_advance(font, glyph) / 2;
+ }
+
+ let vert_origin = &data.vert_origin;
+ if let Some(vert_origin) = vert_origin {
+ let glyph_id = GlyphId::new(glyph);
+
+ let mut y_origin = vert_origin.vertical_origin_y(glyph_id) as f32;
+ let vert_vars = &data.vert_vars;
+ if let Some(vert_vars) = vert_vars {
+ let coords = data.location.coords();
+ if !coords.is_empty() {
+ y_origin += vert_vars
+ .v_org_delta(glyph_id, coords)
+ .unwrap_or_default()
+ .to_f32();
+ }
+ }
+
+ unsafe {
+ *y = (y_origin * data.y_mult).round() as hb_position_t;
+ }
+
+ return true as hb_bool_t;
+ }
+
+ let mut extents: hb_glyph_extents_t = unsafe { std::mem::zeroed() };
+ if unsafe { hb_font_get_glyph_extents(font, glyph, &mut extents) != 0 } {
+ if let Some(vert_metrics) = &data.vert_metrics {
+ let glyph = GlyphId::new(glyph);
+ let mut tsb: f32 = vert_metrics.side_bearing(glyph).unwrap_or_default() as f32;
+ if let Some(vert_vars) = &data.vert_vars {
+ let coords = data.location.coords();
+ if !coords.is_empty() {
+ tsb += vert_vars
+ .tsb_delta(glyph, coords)
+ .unwrap_or_default()
+ .to_f32();
+ }
+ }
+ unsafe {
+ *y = extents.y_bearing + (tsb * data.y_mult).round() as hb_position_t;
+ }
+ return true as hb_bool_t;
+ }
+
+ let mut font_extents: hb_font_extents_t = unsafe { std::mem::zeroed() };
+ unsafe {
+ hb_font_get_extents_for_direction(
+ font,
+ hb_direction_t_HB_DIRECTION_LTR,
+ &mut font_extents,
+ );
+ }
+ let advance: hb_position_t = font_extents.ascender - font_extents.descender;
+ let diff: hb_position_t = advance - -extents.height;
+ unsafe {
+ *y = extents.y_bearing + (diff >> 1);
+ }
+ return true as hb_bool_t;
+ }
+
+ let mut font_extents: hb_font_extents_t = unsafe { std::mem::zeroed() };
+ unsafe {
+ hb_font_get_extents_for_direction(font, hb_direction_t_HB_DIRECTION_LTR, &mut font_extents);
+ }
+ unsafe {
+ *y = font_extents.ascender;
+ }
+
+ true as hb_bool_t
+}
+
extern "C" fn _hb_fontations_get_glyph_extents(
_font: *mut hb_font_t,
font_data: *mut ::std::os::raw::c_void,
@@ -263,8 +412,7 @@
let glyph_metrics = &data.glyph_metrics.as_ref().unwrap();
let glyph_id = GlyphId::new(glyph);
- let glyph_extents = glyph_metrics.bounds(glyph_id);
- let Some(glyph_extents) = glyph_extents else {
+ let Some(glyph_extents) = glyph_metrics.bounds(glyph_id) else {
return false as hb_bool_t;
};
@@ -389,14 +537,11 @@
let location = &data.location;
let outline_glyphs = &data.outline_glyphs;
- // Create an outline-glyph
let glyph_id = GlyphId::new(glyph);
let Some(outline_glyph) = outline_glyphs.get(glyph_id) else {
return;
};
let draw_settings = DrawSettings::unhinted(*size, location);
- // Allocate zero bytes for the draw_state_t on the stack.
- let mut draw_state: hb_draw_state_t = unsafe { std::mem::zeroed::<hb_draw_state_t>() };
let slant = unsafe { hb_font_get_synthetic_slant(font) };
let mut x_scale: i32 = 0;
@@ -409,7 +554,10 @@
} else {
0.
};
- draw_state.slant_xy = slant;
+ let mut draw_state = hb_draw_state_t {
+ slant_xy: slant,
+ ..unsafe { std::mem::zeroed() }
+ };
let mut pen = HbPen {
x_mult: data.x_mult,
@@ -428,6 +576,8 @@
paint_data: *mut c_void,
color_records: &'a [ColorRecord],
foreground: hb_color_t,
+ is_glyph_clip: u64,
+ clip_depth: u32,
}
impl HbColorPainter<'_> {
@@ -440,8 +590,7 @@
}
let c = self.color_records.get(color_index as usize);
- if c.is_some() {
- let c = c.unwrap();
+ if let Some(c) = c {
(((c.blue as u32) << 24)
| ((c.green as u32) << 16)
| ((c.red as u32) << 8)
@@ -563,9 +712,12 @@
) {
unsafe {
hb_paint_push_inverse_font_transform(self.paint_funcs, self.paint_data, self.font);
- }
- self.push_clip_glyph(glyph_id);
- unsafe {
+ hb_paint_push_clip_glyph(
+ self.paint_funcs,
+ self.paint_data,
+ glyph_id.to_u32() as hb_codepoint_t,
+ self.font,
+ );
hb_paint_push_font_transform(self.paint_funcs, self.paint_data, self.font);
}
if let Some(wrap_in_transform) = brush_transform {
@@ -576,11 +728,20 @@
self.fill(brush);
}
self.pop_transform();
- self.pop_clip();
+ unsafe {
+ hb_paint_pop_clip(self.paint_funcs, self.paint_data);
+ }
self.pop_transform();
}
fn push_clip_glyph(&mut self, glyph_id: GlyphId) {
+ if self.clip_depth < 64 {
+ self.is_glyph_clip |= 1 << self.clip_depth;
+ self.clip_depth += 1;
+ } else {
+ return;
+ }
unsafe {
+ hb_paint_push_inverse_font_transform(self.paint_funcs, self.paint_data, self.font);
hb_paint_push_clip_glyph(
self.paint_funcs,
self.paint_data,
@@ -587,9 +748,16 @@
glyph_id.to_u32() as hb_codepoint_t,
self.font,
);
+ hb_paint_push_font_transform(self.paint_funcs, self.paint_data, self.font);
}
}
fn push_clip_box(&mut self, bbox: BoundingBox) {
+ if self.clip_depth < 64 {
+ self.is_glyph_clip &= !(1 << self.clip_depth);
+ self.clip_depth += 1;
+ } else {
+ return;
+ }
unsafe {
hb_paint_push_clip_rectangle(
self.paint_funcs,
@@ -602,8 +770,19 @@
}
}
fn pop_clip(&mut self) {
+ if self.clip_depth > 0 {
+ self.clip_depth -= 1;
+ } else {
+ return;
+ }
unsafe {
+ if (self.is_glyph_clip & (1 << self.clip_depth)) != 0 {
+ hb_paint_pop_transform(self.paint_funcs, self.paint_data);
+ }
hb_paint_pop_clip(self.paint_funcs, self.paint_data);
+ if (self.is_glyph_clip & (1 << self.clip_depth)) != 0 {
+ hb_paint_pop_transform(self.paint_funcs, self.paint_data);
+ }
}
}
fn fill(&mut self, brush: Brush) {
@@ -748,7 +927,6 @@
let location = &data.location;
let color_glyphs = &data.color_glyphs;
- // Create an color-glyph
let glyph_id = GlyphId::new(glyph);
let Some(color_glyph) = color_glyphs.get(glyph_id) else {
return;
@@ -756,18 +934,18 @@
let cpal = font_ref.cpal();
let color_records = if cpal.is_err() {
- unsafe { std::slice::from_raw_parts(std::ptr::NonNull::dangling().as_ptr(), 0) }
+ &[]
} else {
let cpal = cpal.unwrap();
let num_entries = cpal.num_palette_entries().into();
let color_records = cpal.color_records_array();
- let start_index = cpal.color_record_indices().get(palette_index as usize);
- let start_index = if start_index.is_some() {
- start_index
- } else {
- // https://github.com/harfbuzz/harfbuzz/issues/5116
- cpal.color_record_indices().first()
- };
+ let start_index = cpal
+ .color_record_indices()
+ .get(palette_index as usize)
+ .or_else(|| {
+ // https://github.com/harfbuzz/harfbuzz/issues/5116
+ cpal.color_record_indices().first()
+ });
if let (Some(Ok(color_records)), Some(start_index)) = (color_records, start_index) {
let start_index: usize = start_index.get().into();
@@ -774,7 +952,7 @@
let color_records = &color_records[start_index..start_index + num_entries];
unsafe { std::slice::from_raw_parts(color_records.as_ptr(), num_entries) }
} else {
- unsafe { std::slice::from_raw_parts(std::ptr::NonNull::dangling().as_ptr(), 0) }
+ &[]
}
};
@@ -784,6 +962,8 @@
paint_data,
color_records,
foreground,
+ is_glyph_clip: 0,
+ clip_depth: 0,
};
unsafe {
hb_paint_push_font_transform(paint_funcs, paint_data, font);
@@ -801,19 +981,18 @@
) -> hb_bool_t {
let data = unsafe { &mut *(font_data as *mut FontationsData) };
- let glyph_name = data.glyph_names.get(GlyphId::new(glyph));
- match glyph_name {
- None => false as hb_bool_t,
- Some(glyph_name) => {
- let glyph_name = glyph_name.as_str();
- // Copy the glyph name into the buffer, up to size-1 bytes
- let len = glyph_name.len().min(size as usize - 1);
- unsafe {
- std::ptr::copy_nonoverlapping(glyph_name.as_ptr(), name as *mut u8, len);
- *name.add(len) = 0;
- }
- true as hb_bool_t
+ if let Some(glyph_name) = data.glyph_names.get(GlyphId::new(glyph)) {
+ let glyph_name = glyph_name.as_str();
+ // Copy the glyph name into the buffer, up to size-1 bytes
+ let len = glyph_name.len().min(size as usize - 1);
+ unsafe {
+ std::slice::from_raw_parts_mut(name as *mut u8, len)
+ .copy_from_slice(&glyph_name.as_bytes()[..len]);
+ *name.add(len) = 0;
}
+ true as hb_bool_t
+ } else {
+ false as hb_bool_t
}
}
@@ -836,16 +1015,13 @@
.map(|(gid, name)| (name.to_string(), gid.to_u32()))
.collect()
});
- let glyph_id = glyph_from_names.get(name);
-
- match glyph_id {
- None => false as hb_bool_t,
- Some(glyph_id) => {
- unsafe {
- *glyph = *glyph_id;
- }
- true as hb_bool_t
+ if let Some(glyph_id) = glyph_from_names.get(name) {
+ unsafe {
+ *glyph = *glyph_id;
}
+ true as hb_bool_t
+ } else {
+ false as hb_bool_t
}
}
@@ -880,6 +1056,18 @@
null_mut(),
None,
);
+ hb_font_funcs_set_glyph_v_advances_func(
+ ffuncs,
+ Some(_hb_fontations_get_glyph_v_advances),
+ null_mut(),
+ None,
+ );
+ hb_font_funcs_set_glyph_v_origin_func(
+ ffuncs,
+ Some(_hb_fontations_get_glyph_v_origin),
+ null_mut(),
+ None,
+ );
hb_font_funcs_set_glyph_extents_func(
ffuncs,
Some(_hb_fontations_get_glyph_extents),
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py 2025-04-04 23:39:11 UTC (rev 74849)
@@ -21,6 +21,10 @@
experimental_symbols = \
"""hb_shape_justify
hb_subset_input_override_name_table
+hb_subset_cff_get_charstring_data
+hb_subset_cff_get_charstrings_index
+hb_subset_cff2_get_charstring_data
+hb_subset_cff2_get_charstrings_index
""".splitlines ()
symbols = [x for x in symbols if x not in experimental_symbols]
symbols = "\n".join (symbols)
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -194,7 +194,10 @@
HB_NODISCARD bool replace_glyph (hb_codepoint_t glyph)
{
if (glyph == DELETED_GLYPH)
- return delete_glyph ();
+ {
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_AAT_HAS_DELETED;
+ _hb_glyph_info_set_aat_deleted (&buffer->cur());
+ }
if (likely (using_buffer_glyph_set))
buffer_glyph_set->add (glyph);
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -31,6 +31,7 @@
#include "hb-aat-layout-common.hh"
#include "hb-ot-layout.hh"
#include "hb-open-type.hh"
+#include "hb-ot-stat-table.hh"
/*
* trak -- Tracking
@@ -115,7 +116,7 @@
protected:
F16DOT16 track; /* Track value for this record. */
- NameID trackNameID; /* The 'name' table index for this track.
+ OT::NameID trackNameID; /* The 'name' table index for this track.
* (a short word or phrase like "loose"
* or "very tight") */
NNOffset16To<UnsizedArrayOf<FWORD>>
@@ -200,7 +201,47 @@
float ptem = font->ptem > 0.f ? font->ptem : HB_CORETEXT_DEFAULT_FONT_SIZE;
return font->em_scalef_y ((this+vertData).get_tracking (this, ptem, track));
}
+ hb_position_t get_tracking (hb_font_t *font, hb_direction_t dir, float track = 0.f) const
+ {
+#ifndef HB_NO_STYLE
+ if (!font->face->table.STAT->has_data ())
+ return 0;
+ return HB_DIRECTION_IS_HORIZONTAL (dir) ?
+ get_h_tracking (font, track) :
+ get_v_tracking (font, track);
+#else
+ return 0;
+#endif
+ }
+ bool apply (hb_aat_apply_context_t *c, float track = 0.f) const
+ {
+ TRACE_APPLY (this);
+
+ float ptem = c->font->ptem;
+ if (unlikely (ptem <= 0.f))
+ {
+ /* https://developer.apple.com/documentation/coretext/1508745-ctfontcreatewithgraphicsfont */
+ ptem = HB_CORETEXT_DEFAULT_FONT_SIZE;
+ }
+
+ hb_buffer_t *buffer = c->buffer;
+ if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
+ {
+ hb_position_t advance_to_add = get_h_tracking (c->font, track);
+ foreach_grapheme (buffer, start, end)
+ buffer->pos[start].x_advance += advance_to_add;
+ }
+ else
+ {
+ hb_position_t advance_to_add = get_v_tracking (c->font, track);
+ foreach_grapheme (buffer, start, end)
+ buffer->pos[start].y_advance += advance_to_add;
+ }
+
+ return_trace (true);
+ }
+
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -34,7 +34,7 @@
#include "hb-aat-layout-just-table.hh" // Just so we compile it; unused otherwise.
#include "hb-aat-layout-kerx-table.hh"
#include "hb-aat-layout-morx-table.hh"
-#include "hb-aat-layout-trak-table.hh" // Just so we compile it; unused otherwise.
+#include "hb-aat-layout-trak-table.hh"
#include "hb-aat-ltag-table.hh"
#include "hb-ot-layout-gsub-table.hh"
@@ -394,6 +394,17 @@
return face->table.trak->has_data ();
}
+void
+hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer)
+{
+ const AAT::trak& trak = *font->face->table.trak;
+
+ AAT::hb_aat_apply_context_t c (plan, font, buffer);
+ trak.apply (&c);
+}
+
/**
* hb_aat_layout_get_feature_types:
* @face: #hb_face_t to work upon
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -68,5 +68,10 @@
hb_font_t *font,
hb_buffer_t *buffer);
+HB_INTERNAL void
+hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer);
+
#endif /* HB_AAT_LAYOUT_HH */
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -84,11 +84,11 @@
#define _hb_memory_r_barrier() std::atomic_thread_fence(std::memory_order_acquire)
#define _hb_memory_w_barrier() std::atomic_thread_fence(std::memory_order_release)
-#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<std::decay<decltype (*(AI))>::type> *> (AI)->fetch_add ((V), std::memory_order_acq_rel))
-#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast<std::atomic<std::decay<decltype (*(AI))>::type> *> (AI)->store ((V), std::memory_order_relaxed))
-#define hb_atomic_int_impl_set(AI, V) (reinterpret_cast<std::atomic<std::decay<decltype (*(AI))>::type> *> (AI)->store ((V), std::memory_order_release))
-#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast<std::atomic<std::decay<decltype (*(AI))>::type> const *> (AI)->load (std::memory_order_relaxed))
-#define hb_atomic_int_impl_get(AI) (reinterpret_cast<std::atomic<std::decay<decltype (*(AI))>::type> const *> (AI)->load (std::memory_order_acquire))
+#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<typename std::decay<decltype (*(AI))>::type> *> (AI)->fetch_add ((V), std::memory_order_acq_rel))
+#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast<std::atomic<typename std::decay<decltype (*(AI))>::type> *> (AI)->store ((V), std::memory_order_relaxed))
+#define hb_atomic_int_impl_set(AI, V) (reinterpret_cast<std::atomic<typename std::decay<decltype (*(AI))>::type> *> (AI)->store ((V), std::memory_order_release))
+#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast<std::atomic<typename std::decay<decltype (*(AI))>::type> const *> (AI)->load (std::memory_order_relaxed))
+#define hb_atomic_int_impl_get(AI) (reinterpret_cast<std::atomic<typename std::decay<decltype (*(AI))>::type> const *> (AI)->load (std::memory_order_acquire))
#define hb_atomic_ptr_impl_set_relaxed(P, V) (reinterpret_cast<std::atomic<void*> *> (P)->store ((V), std::memory_order_relaxed))
#define hb_atomic_ptr_impl_get_relaxed(P) (reinterpret_cast<std::atomic<void*> const *> (P)->load (std::memory_order_relaxed))
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -274,7 +274,7 @@
static const int deserialize_text_glyphs_en_main = 25;
-#line 99 "hb-buffer-deserialize-text-glyphs.rl"
+#line 98 "hb-buffer-deserialize-text-glyphs.rl"
static hb_bool_t
@@ -325,13 +325,13 @@
switch ( _deserialize_text_glyphs_trans_actions[_trans] ) {
case 2:
-#line 51 "hb-buffer-deserialize-text-glyphs.rl"
+#line 50 "hb-buffer-deserialize-text-glyphs.rl"
{
tok = p;
}
break;
case 1:
-#line 55 "hb-buffer-deserialize-text-glyphs.rl"
+#line 54 "hb-buffer-deserialize-text-glyphs.rl"
{
/* TODO Unescape delimiters. */
if (!hb_font_glyph_from_string (font,
@@ -341,27 +341,27 @@
}
break;
case 6:
-#line 63 "hb-buffer-deserialize-text-glyphs.rl"
+#line 62 "hb-buffer-deserialize-text-glyphs.rl"
{ if (!parse_uint (tok, p, &info.cluster )) return false; }
break;
case 7:
-#line 64 "hb-buffer-deserialize-text-glyphs.rl"
+#line 63 "hb-buffer-deserialize-text-glyphs.rl"
{ if (!parse_int (tok, p, &pos.x_offset )) return false; }
break;
case 8:
-#line 65 "hb-buffer-deserialize-text-glyphs.rl"
+#line 64 "hb-buffer-deserialize-text-glyphs.rl"
{ if (!parse_int (tok, p, &pos.y_offset )) return false; }
break;
case 4:
-#line 66 "hb-buffer-deserialize-text-glyphs.rl"
+#line 65 "hb-buffer-deserialize-text-glyphs.rl"
{ if (!parse_int (tok, p, &pos.x_advance)) return false; }
break;
case 5:
-#line 67 "hb-buffer-deserialize-text-glyphs.rl"
+#line 66 "hb-buffer-deserialize-text-glyphs.rl"
{ if (!parse_int (tok, p, &pos.y_advance)) return false; }
break;
case 3:
-#line 68 "hb-buffer-deserialize-text-glyphs.rl"
+#line 67 "hb-buffer-deserialize-text-glyphs.rl"
{ if (!parse_uint (tok, p, &info.mask )) return false; }
break;
case 9:
@@ -370,7 +370,7 @@
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
-#line 51 "hb-buffer-deserialize-text-glyphs.rl"
+#line 50 "hb-buffer-deserialize-text-glyphs.rl"
{
tok = p;
}
@@ -381,11 +381,11 @@
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
-#line 51 "hb-buffer-deserialize-text-glyphs.rl"
+#line 50 "hb-buffer-deserialize-text-glyphs.rl"
{
tok = p;
}
-#line 55 "hb-buffer-deserialize-text-glyphs.rl"
+#line 54 "hb-buffer-deserialize-text-glyphs.rl"
{
/* TODO Unescape delimiters. */
if (!hb_font_glyph_from_string (font,
@@ -397,10 +397,9 @@
case 12:
#line 43 "hb-buffer-deserialize-text-glyphs.rl"
{
- buffer->add_info (info);
+ buffer->add_info_and_pos (info, pos);
if (unlikely (!buffer->successful))
return false;
- buffer->pos[buffer->len - 1] = pos;
*end_ptr = p;
}
#line 38 "hb-buffer-deserialize-text-glyphs.rl"
@@ -408,13 +407,13 @@
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
-#line 51 "hb-buffer-deserialize-text-glyphs.rl"
+#line 50 "hb-buffer-deserialize-text-glyphs.rl"
{
tok = p;
}
break;
case 14:
-#line 55 "hb-buffer-deserialize-text-glyphs.rl"
+#line 54 "hb-buffer-deserialize-text-glyphs.rl"
{
/* TODO Unescape delimiters. */
if (!hb_font_glyph_from_string (font,
@@ -427,7 +426,7 @@
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
-#line 51 "hb-buffer-deserialize-text-glyphs.rl"
+#line 50 "hb-buffer-deserialize-text-glyphs.rl"
{
tok = p;
}
@@ -435,10 +434,9 @@
case 13:
#line 43 "hb-buffer-deserialize-text-glyphs.rl"
{
- buffer->add_info (info);
+ buffer->add_info_and_pos (info, pos);
if (unlikely (!buffer->successful))
return false;
- buffer->pos[buffer->len - 1] = pos;
*end_ptr = p;
}
#line 38 "hb-buffer-deserialize-text-glyphs.rl"
@@ -446,11 +444,11 @@
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
-#line 51 "hb-buffer-deserialize-text-glyphs.rl"
+#line 50 "hb-buffer-deserialize-text-glyphs.rl"
{
tok = p;
}
-#line 55 "hb-buffer-deserialize-text-glyphs.rl"
+#line 54 "hb-buffer-deserialize-text-glyphs.rl"
{
/* TODO Unescape delimiters. */
if (!hb_font_glyph_from_string (font,
@@ -459,7 +457,7 @@
return false;
}
break;
-#line 463 "hb-buffer-deserialize-text-glyphs.hh"
+#line 461 "hb-buffer-deserialize-text-glyphs.hh"
}
_again:
@@ -474,14 +472,13 @@
case 11:
#line 43 "hb-buffer-deserialize-text-glyphs.rl"
{
- buffer->add_info (info);
+ buffer->add_info_and_pos (info, pos);
if (unlikely (!buffer->successful))
return false;
- buffer->pos[buffer->len - 1] = pos;
*end_ptr = p;
}
break;
-#line 485 "hb-buffer-deserialize-text-glyphs.hh"
+#line 482 "hb-buffer-deserialize-text-glyphs.hh"
}
}
@@ -488,7 +485,7 @@
_out: {}
}
-#line 120 "hb-buffer-deserialize-text-glyphs.rl"
+#line 119 "hb-buffer-deserialize-text-glyphs.rl"
*end_ptr = p;
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.rl
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.rl 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text-glyphs.rl 2025-04-04 23:39:11 UTC (rev 74849)
@@ -41,10 +41,9 @@
}
action add_item {
- buffer->add_info (info);
+ buffer->add_info_and_pos (info, pos);
if (unlikely (!buffer->successful))
return false;
- buffer->pos[buffer->len - 1] = pos;
*end_ptr = p;
}
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -370,8 +370,20 @@
len++;
}
+void
+hb_buffer_t::add_info_and_pos (const hb_glyph_info_t &glyph_info,
+ const hb_glyph_position_t &glyph_pos)
+{
+ if (unlikely (!ensure (len + 1))) return;
+ info[len] = glyph_info;
+ assert (have_positions);
+ pos[len] = glyph_pos;
+ len++;
+}
+
+
void
hb_buffer_t::clear_output ()
{
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -229,6 +229,8 @@
HB_INTERNAL void add (hb_codepoint_t codepoint,
unsigned int cluster);
HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info);
+ HB_INTERNAL void add_info_and_pos (const hb_glyph_info_t &glyph_info,
+ const hb_glyph_position_t &glyph_pos);
void reverse_range (unsigned start, unsigned end)
{
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cache.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cache.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cache.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -30,18 +30,31 @@
#include "hb.hh"
-/* Implements a lockfree cache for int->int functions.
+/* Implements a lockfree and thread-safe cache for int->int functions,
+ * using (optionally) _relaxed_ atomic integer operations.
*
- * The cache is a fixed-size array of 16-bit or 32-bit integers.
- * The key is split into two parts: the cache index and the rest.
+ * The cache is a fixed-size array of 16-bit or 32-bit integers,
+ * typically 256 elements.
*
- * The cache index is used to index into the array. The rest is used
- * to store the key and the value.
+ * The key is split into two parts: the cache index (high bits)
+ * and the rest (low bits).
*
+ * The cache index is used to index into the array. The array
+ * member is a 16-bit or 32-bit integer that is used *both*
+ * to store the low bits of the key, and the value.
+ *
* The value is stored in the least significant bits of the integer.
- * The key is stored in the most significant bits of the integer.
- * The key is shifted by cache_bits to the left to make room for the
- * value.
+ * The low bits of the key are stored in the most significant bits
+ * of the integer.
+ *
+ * A cache hit is detected by comparing the low bits of the key
+ * with the high bits of the integer at the array position indexed
+ * by the high bits of the key. If they match, the value is extracted
+ * from the least significant bits of the integer and returned.
+ * Otherwise, a cache miss is reported.
+ *
+ * Cache operations (storage and retrieval) involve just a few
+ * arithmetic operations and a single memory access.
*/
template <unsigned int key_bits=16,
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -146,6 +146,7 @@
#ifdef HB_NO_DRAW
#define HB_NO_OUTLINE
+#define HB_NO_PAINT
#endif
#ifdef HB_NO_GETENV
@@ -191,7 +192,6 @@
#ifdef HB_MINIMIZE_MEMORY_USAGE
#define HB_NO_GDEF_CACHE
#define HB_NO_OT_LAYOUT_LOOKUP_CACHE
-#define HB_NO_OT_FONT_ADVANCE_CACHE
#define HB_NO_OT_FONT_CMAP_CACHE
#endif
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext-font.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext-font.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext-font.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -29,6 +29,7 @@
#ifdef HAVE_CORETEXT
#include "hb-coretext.hh"
+#include "hb-aat-layout-trak-table.hh"
#include "hb-draw.hh"
#include "hb-font.hh"
@@ -209,6 +210,7 @@
CGFloat ct_font_size = CTFontGetSize (ct_font);
CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
+ hb_position_t tracking = font->face->table.trak->get_tracking (font, HB_DIRECTION_LTR, 0.f);
CGGlyph cg_glyph[MAX_GLYPHS];
CGSize advances[MAX_GLYPHS];
@@ -223,7 +225,7 @@
CTFontGetAdvancesForGlyphs (ct_font, kCTFontOrientationHorizontal, cg_glyph, advances, c);
for (unsigned j = 0; j < c; j++)
{
- *first_advance = round (advances[j].width * x_mult);
+ *first_advance = round (advances[j].width * x_mult) - tracking;
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
}
@@ -244,6 +246,7 @@
CGFloat ct_font_size = CTFontGetSize (ct_font);
CGFloat y_mult = (CGFloat) -font->y_scale / ct_font_size;
+ hb_position_t tracking = font->face->table.trak->get_tracking (font, HB_DIRECTION_TTB, 0.f);
CGGlyph cg_glyph[MAX_GLYPHS];
CGSize advances[MAX_GLYPHS];
@@ -258,7 +261,7 @@
CTFontGetAdvancesForGlyphs (ct_font, kCTFontOrientationVertical, cg_glyph, advances, c);
for (unsigned j = 0; j < c; j++)
{
- *first_advance = round (advances[j].width * y_mult);
+ *first_advance = round (advances[j].width * y_mult) - tracking;
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
}
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -199,7 +199,7 @@
if (ttc_index != 0)
{
- DEBUG_MSG (CORETEXT, blob, "TTC index %d not supported", ttc_index);
+ DEBUG_MSG (CORETEXT, blob, "TTC index %u not supported", ttc_index);
return nullptr; // CoreText does not support TTCs
}
@@ -414,7 +414,7 @@
if (ttc_index != 0)
{
- DEBUG_MSG (CORETEXT, nullptr, "TTC index %d not supported", ttc_index);
+ DEBUG_MSG (CORETEXT, nullptr, "TTC index %u not supported", ttc_index);
return nullptr; // CoreText does not support TTCs
}
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite-shape.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite-shape.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite-shape.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -107,7 +107,7 @@
void
_hb_directwrite_shaper_font_data_destroy (hb_directwrite_font_data_t *data)
{
- ((IDWriteFontFace *) data)->Release ();
+ ((IDWriteFontFace *) (const void *) data)->Release ();
}
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -188,26 +188,9 @@
{
hb_directwrite_global_t ()
{
- dwrite_dll = LoadLibraryW (L"DWrite.dll");
+ HRESULT hr = DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
+ (IUnknown**) &dwriteFactory);
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-function-type"
-#endif
-
- t_DWriteCreateFactory p_DWriteCreateFactory = (t_DWriteCreateFactory)
- GetProcAddress (dwrite_dll, "DWriteCreateFactory");
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
- if (unlikely (!p_DWriteCreateFactory))
- return;
-
- HRESULT hr = p_DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
- (IUnknown**) &dwriteFactory);
-
if (unlikely (hr != S_OK))
return;
@@ -222,12 +205,9 @@
fontFileLoader->Release ();
if (dwriteFactory)
dwriteFactory->Release ();
- if (dwrite_dll)
- FreeLibrary (dwrite_dll);
}
bool success = false;
- HMODULE dwrite_dll;
IDWriteFactory *dwriteFactory;
DWriteFontFileLoader *fontFileLoader;
};
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-draw.h
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-draw.h 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-draw.h 2025-04-04 23:39:11 UTC (rev 74849)
@@ -41,7 +41,7 @@
* @path_start_y: Y component of the start of current path
* @current_x: X component of current point
* @current_y: Y component of current point
- * @slant_xy: (Since: 11.0.0): Slanting factor for synthetic oblique
+ * @slant_xy: Slanting factor for synthetic oblique, Since: 11.0.0
*
* Current drawing state.
*
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1894,6 +1894,7 @@
font->num_coords = coords_length;
font->changed ();
+ font->serial_coords = font->serial;
}
/**
@@ -2212,6 +2213,7 @@
hb_face_destroy (old);
font->changed ();
+ font->serial_coords = font->serial;
}
/**
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -34,6 +34,7 @@
#include "hb-face.hh"
#include "hb-atomic.hh"
#include "hb-shaper.hh"
+#include "hb-outline.hh"
/*
@@ -197,10 +198,10 @@
float x2 = em_scale_x (extents->x_bearing + extents->width);
float y2 = em_scale_y (extents->y_bearing + extents->height);
- extents->x_bearing = floorf (x1);
- extents->y_bearing = floorf (y1);
- extents->width = ceilf (x2) - extents->x_bearing;
- extents->height = ceilf (y2) - extents->y_bearing;
+ extents->x_bearing = roundf (x1);
+ extents->y_bearing = roundf (y1);
+ extents->width = roundf (x2) - extents->x_bearing;
+ extents->height = roundf (y2) - extents->y_bearing;
}
void synthetic_glyph_extents (hb_glyph_extents_t *extents)
@@ -317,16 +318,34 @@
hb_position_t get_glyph_h_advance (hb_codepoint_t glyph)
{
- return klass->get.f.glyph_h_advance (this, user_data,
- glyph,
- !klass->user_data ? nullptr : klass->user_data->glyph_h_advance);
+ hb_position_t advance = klass->get.f.glyph_h_advance (this, user_data,
+ glyph,
+ !klass->user_data ? nullptr : klass->user_data->glyph_h_advance);
+
+ if (x_strength && !embolden_in_place)
+ {
+ /* Emboldening. */
+ hb_position_t strength = x_scale >= 0 ? x_strength : -x_strength;
+ advance += advance ? strength : 0;
+ }
+
+ return advance;
}
hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
{
- return klass->get.f.glyph_v_advance (this, user_data,
- glyph,
- !klass->user_data ? nullptr : klass->user_data->glyph_v_advance);
+ hb_position_t advance = klass->get.f.glyph_v_advance (this, user_data,
+ glyph,
+ !klass->user_data ? nullptr : klass->user_data->glyph_v_advance);
+
+ if (y_strength && !embolden_in_place)
+ {
+ /* Emboldening. */
+ hb_position_t strength = y_scale >= 0 ? y_strength : -y_strength;
+ advance += advance ? strength : 0;
+ }
+
+ return advance;
}
void get_glyph_h_advances (unsigned int count,
@@ -335,11 +354,22 @@
hb_position_t *first_advance,
unsigned int advance_stride)
{
- return klass->get.f.glyph_h_advances (this, user_data,
- count,
- first_glyph, glyph_stride,
- first_advance, advance_stride,
- !klass->user_data ? nullptr : klass->user_data->glyph_h_advances);
+ klass->get.f.glyph_h_advances (this, user_data,
+ count,
+ first_glyph, glyph_stride,
+ first_advance, advance_stride,
+ !klass->user_data ? nullptr : klass->user_data->glyph_h_advances);
+
+ if (x_strength && !embolden_in_place)
+ {
+ /* Emboldening. */
+ hb_position_t strength = x_scale >= 0 ? x_strength : -x_strength;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ *first_advance += *first_advance ? strength : 0;
+ first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
+ }
+ }
}
void get_glyph_v_advances (unsigned int count,
@@ -348,11 +378,22 @@
hb_position_t *first_advance,
unsigned int advance_stride)
{
- return klass->get.f.glyph_v_advances (this, user_data,
- count,
- first_glyph, glyph_stride,
- first_advance, advance_stride,
- !klass->user_data ? nullptr : klass->user_data->glyph_v_advances);
+ klass->get.f.glyph_v_advances (this, user_data,
+ count,
+ first_glyph, glyph_stride,
+ first_advance, advance_stride,
+ !klass->user_data ? nullptr : klass->user_data->glyph_v_advances);
+
+ if (y_strength && !embolden_in_place)
+ {
+ /* Emboldening. */
+ hb_position_t strength = y_scale >= 0 ? y_strength : -y_strength;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ *first_advance += *first_advance ? strength : 0;
+ first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
+ }
+ }
}
hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
@@ -445,10 +486,37 @@
void draw_glyph (hb_codepoint_t glyph,
hb_draw_funcs_t *draw_funcs, void *draw_data)
{
+#ifndef HB_NO_OUTLINE
+ bool embolden = x_strength || y_strength;
+#else
+ constexpr bool embolden = false;
+#endif
+
+ if (!embolden)
+ {
+ klass->get.f.draw_glyph (this, user_data,
+ glyph,
+ draw_funcs, draw_data,
+ !klass->user_data ? nullptr : klass->user_data->draw_glyph);
+ return;
+ }
+
+#ifndef HB_NO_OUTLINE
+ /* Emboldening. */
+ hb_outline_t outline;
klass->get.f.draw_glyph (this, user_data,
glyph,
- draw_funcs, draw_data,
+ hb_outline_recording_pen_get_funcs (), &outline,
!klass->user_data ? nullptr : klass->user_data->draw_glyph);
+
+ float x_shift = embolden_in_place ? 0 : (float) x_strength / 2;
+ float y_shift = (float) y_strength / 2;
+ if (x_scale < 0) x_shift = -x_shift;
+ if (y_scale < 0) y_shift = -y_shift;
+ outline.embolden (x_strength, y_strength, x_shift, y_shift);
+
+ outline.replay (draw_funcs, draw_data);
+#endif
}
void paint_glyph (hb_codepoint_t glyph,
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -37,11 +37,7 @@
#include "hb-draw.hh"
#include "hb-font.hh"
#include "hb-machinery.hh"
-#ifndef HB_NO_AAT
-#include "hb-aat-layout-trak-table.hh"
-#endif
#include "hb-ot-os2-table.hh"
-#include "hb-ot-stat-table.hh"
#include "hb-ot-shaper-arabic-pua.hh"
#include "hb-paint.hh"
@@ -481,7 +477,6 @@
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
_hb_ft_hb_font_check_changed (font, ft_font);
- hb_position_t *orig_first_advance = first_advance;
hb_lock_t lock (ft_font->lock);
FT_Face ft_face = ft_font->ft_face;
int load_flags = ft_font->load_flags;
@@ -522,38 +517,6 @@
first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
}
-
- if (font->x_strength && !font->embolden_in_place)
- {
- /* Emboldening. */
- hb_position_t x_strength = font->x_scale >= 0 ? font->x_strength : -font->x_strength;
- first_advance = orig_first_advance;
- for (unsigned int i = 0; i < count; i++)
- {
- *first_advance += *first_advance ? x_strength : 0;
- first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
- }
- }
-
-#ifndef HB_NO_AAT
- /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */
-#ifndef HB_NO_STYLE
- bool apply_trak = font->face->table.STAT->has_data () && font->face->table.trak->has_data ();
-#else
- bool apply_trak = false;
-#endif
- if (apply_trak)
- {
- hb_position_t tracking = font->face->table.trak->get_h_tracking (font);
- first_advance = orig_first_advance;
- for (unsigned int i = 0; i < count; i++)
- {
- *first_advance += tracking;
- first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
- first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
- }
- }
-#endif
}
#ifndef HB_NO_VERTICAL
@@ -586,26 +549,11 @@
if (unlikely (FT_Get_Advance (ft_font->ft_face, glyph, ft_font->load_flags | FT_LOAD_VERTICAL_LAYOUT, &v)))
return 0;
- v = (int) (y_mult * v);
-
/* Note: FreeType's vertical metrics grows downward while other FreeType coordinates
* have a Y growing upward. Hence the extra negation. */
+ v = ((-v + (1<<9)) >> 10);
- hb_position_t y_strength = font->y_scale >= 0 ? font->y_strength : -font->y_strength;
- v = ((-v + (1<<9)) >> 10) + (font->embolden_in_place ? 0 : y_strength);
-
-#ifndef HB_NO_AAT
- /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */
-#ifndef HB_NO_STYLE
- bool apply_trak = font->face->table.STAT->has_data () && font->face->table.trak->has_data ();
-#else
- bool apply_trak = false;
-#endif
- if (apply_trak)
- v += font->face->table.trak->get_v_tracking (font);
-#endif
-
- return v;
+ return (hb_position_t) (y_mult * v);
}
#endif
@@ -719,10 +667,10 @@
float x2 = x1 + x_mult * ft_face->glyph->metrics.width;
float y2 = y1 + y_mult * -ft_face->glyph->metrics.height;
- extents->x_bearing = floorf (x1);
- extents->y_bearing = floorf (y1);
- extents->width = ceilf (x2) - extents->x_bearing;
- extents->height = ceilf (y2) - extents->y_bearing;
+ extents->x_bearing = round (x1);
+ extents->y_bearing = round (y1);
+ extents->width = round (x2) - extents->x_bearing;
+ extents->height = round (y2) - extents->y_bearing;
return true;
}
@@ -931,38 +879,6 @@
hb_draw_session_t draw_session (draw_funcs, draw_data, font->slant_xy);
- /* Embolden */
- if (font->x_strength || font->y_strength)
- {
- FT_Outline_EmboldenXY (&ft_face->glyph->outline, font->x_strength, font->y_strength);
-
- int x_shift = 0;
- int y_shift = 0;
- if (font->embolden_in_place)
- {
- /* Undo the FreeType shift. */
- x_shift = -font->x_strength / 2;
- y_shift = 0;
- if (font->y_scale < 0) y_shift = -font->y_strength;
- }
- else
- {
- /* FreeType applied things in the wrong direction for negative scale; fix up. */
- if (font->x_scale < 0) x_shift = -font->x_strength;
- if (font->y_scale < 0) y_shift = -font->y_strength;
- }
- if (x_shift || y_shift)
- {
- auto &outline = ft_face->glyph->outline;
- for (auto &point : hb_iter (outline.points, outline.contours[outline.n_contours - 1] + 1))
- {
- point.x += x_shift;
- point.y += y_shift;
- }
- }
- }
-
-
FT_Outline_Decompose (&ft_face->glyph->outline,
&outline_funcs,
&draw_session);
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1073,7 +1073,7 @@
this->blob = sc.reference_table<cff1> (face);
- /* setup for run-time santization */
+ /* setup for run-time sanitization */
sc.init (this->blob);
sc.start_processing ();
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -405,7 +405,7 @@
this->blob = sc.reference_table<cff2> (face);
- /* setup for run-time santization */
+ /* setup for run-time sanitization */
sc.init (this->blob);
sc.start_processing ();
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -2014,7 +2014,8 @@
struct accelerator_t
{
- using cache_t = hb_cache_t<21, 16, 8, true>;
+ using cache_t = hb_cache_t<21, 19>;
+ static_assert (sizeof (cache_t) == 1024, "");
accelerator_t (hb_face_t *face)
{
@@ -2028,6 +2029,14 @@
subtable_uvs = &st->u.format14;
}
+#ifndef HB_NO_OT_FONT_CMAP_CACHE
+ cache = (cache_t *) hb_malloc (sizeof (cache_t));
+ if (cache)
+ new (cache) cache_t ();
+ else
+ return; // Such that get_glyph_funcZ remains null.
+#endif
+
this->get_glyph_data = subtable;
#ifndef HB_NO_CMAP_LEGACY_SUBTABLES
if (unlikely (symbol))
@@ -2061,48 +2070,58 @@
#endif
{
switch (subtable->u.format) {
- /* Accelerate format 4 and format 12. */
- default:
- this->get_glyph_funcZ = get_glyph_from<CmapSubtable>;
- break;
- case 12:
- this->get_glyph_funcZ = get_glyph_from<CmapSubtableFormat12>;
- break;
- case 4:
- {
- this->format4_accel.init (&subtable->u.format4);
- this->get_glyph_data = &this->format4_accel;
- this->get_glyph_funcZ = this->format4_accel.get_glyph_func;
- break;
+ /* Accelerate format 4 and format 12. */
+ default:
+ this->get_glyph_funcZ = get_glyph_from<CmapSubtable>;
+ break;
+ case 12:
+ this->get_glyph_funcZ = get_glyph_from<CmapSubtableFormat12>;
+ break;
+ case 4:
+ {
+ this->format4_accel.init (&subtable->u.format4);
+ this->get_glyph_data = &this->format4_accel;
+ this->get_glyph_funcZ = this->format4_accel.get_glyph_func;
+ break;
+ }
}
- }
}
}
- ~accelerator_t () { this->table.destroy (); }
+ ~accelerator_t ()
+ {
+#ifndef HB_NO_OT_FONT_CMAP_CACHE
+ hb_free (cache);
+#endif
+ table.destroy ();
+ }
inline bool _cached_get (hb_codepoint_t unicode,
- hb_codepoint_t *glyph,
- cache_t *cache) const
+ hb_codepoint_t *glyph) const
{
+#ifndef HB_NO_OT_FONT_CMAP_CACHE
+ // cache is always non-null if we have a get_glyph_funcZ
unsigned v;
- if (cache && cache->get (unicode, &v))
+ if (cache->get (unicode, &v))
{
*glyph = v;
return true;
}
+#endif
bool ret = this->get_glyph_funcZ (this->get_glyph_data, unicode, glyph);
- if (cache && ret)
+#ifndef HB_NO_OT_FONT_CMAP_CACHE
+ if (ret)
cache->set (unicode, *glyph);
+#endif
+
return ret;
}
bool get_nominal_glyph (hb_codepoint_t unicode,
- hb_codepoint_t *glyph,
- cache_t *cache = nullptr) const
+ hb_codepoint_t *glyph) const
{
if (unlikely (!this->get_glyph_funcZ)) return false;
- return _cached_get (unicode, glyph, cache);
+ return _cached_get (unicode, glyph);
}
unsigned int get_nominal_glyphs (unsigned int count,
@@ -2109,14 +2128,13 @@
const hb_codepoint_t *first_unicode,
unsigned int unicode_stride,
hb_codepoint_t *first_glyph,
- unsigned int glyph_stride,
- cache_t *cache = nullptr) const
+ unsigned int glyph_stride) const
{
if (unlikely (!this->get_glyph_funcZ)) return 0;
unsigned int done;
for (done = 0;
- done < count && _cached_get (*first_unicode, first_glyph, cache);
+ done < count && _cached_get (*first_unicode, first_glyph);
done++)
{
first_unicode = &StructAtOffsetUnaligned<hb_codepoint_t> (first_unicode, unicode_stride);
@@ -2127,8 +2145,7 @@
bool get_variation_glyph (hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph,
- cache_t *cache = nullptr) const
+ hb_codepoint_t *glyph) const
{
switch (this->subtable_uvs->get_glyph_variant (unicode,
variation_selector,
@@ -2139,7 +2156,7 @@
case GLYPH_VARIANT_USE_DEFAULT: break;
}
- return get_nominal_glyph (unicode, glyph, cache);
+ return get_nominal_glyph (unicode, glyph);
}
void collect_unicodes (hb_set_t *out, unsigned int num_glyphs) const
@@ -2209,11 +2226,15 @@
hb_nonnull_ptr_t<const CmapSubtable> subtable;
hb_nonnull_ptr_t<const CmapSubtableFormat14> subtable_uvs;
- hb_cmap_get_glyph_func_t get_glyph_funcZ;
- const void *get_glyph_data;
+ hb_cmap_get_glyph_func_t get_glyph_funcZ = nullptr;
+ const void *get_glyph_data = nullptr;
CmapSubtableFormat4::accelerator_t format4_accel;
+#ifndef HB_NO_OT_FONT_CMAP_CACHE
+ cache_t *cache = nullptr;
+#endif
+
public:
hb_blob_ptr_t<cmap> table;
};
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -34,11 +34,7 @@
#include "hb-font.hh"
#include "hb-machinery.hh"
#include "hb-ot-face.hh"
-#include "hb-outline.hh"
-#ifndef HB_NO_AAT
-#include "hb-aat-layout-trak-table.hh"
-#endif
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-cff2-table.hh"
@@ -65,28 +61,111 @@
* never need to call these functions directly.
**/
-using hb_ot_font_cmap_cache_t = hb_cache_t<21, 16, 8, true>;
-using hb_ot_font_advance_cache_t = hb_cache_t<24, 16, 8, true>;
+using hb_ot_font_advance_cache_t = hb_cache_t<24, 16>;
+static_assert (sizeof (hb_ot_font_advance_cache_t) == 1024, "");
-#ifndef HB_NO_OT_FONT_CMAP_CACHE
-static hb_user_data_key_t hb_ot_font_cmap_cache_user_data_key;
-#endif
-
struct hb_ot_font_t
{
const hb_ot_face_t *ot_face;
-#ifndef HB_NO_AAT
- bool apply_trak;
-#endif
+ /* h_advance caching */
+ mutable hb_atomic_t<int> cached_coords_serial;
+ struct advance_cache_t
+ {
+ mutable hb_atomic_t<hb_ot_font_advance_cache_t *> advance_cache;
+ mutable hb_atomic_t<OT::ItemVariationStore::cache_t *> varStore_cache;
-#ifndef HB_NO_OT_FONT_CMAP_CACHE
- hb_ot_font_cmap_cache_t *cmap_cache;
-#endif
+ ~advance_cache_t ()
+ {
+ clear ();
+ }
- /* h_advance caching */
- mutable hb_atomic_t<int> cached_coords_serial;
- mutable hb_atomic_t<hb_ot_font_advance_cache_t *> advance_cache;
+ hb_ot_font_advance_cache_t *acquire_advance_cache () const
+ {
+ retry:
+ auto *cache = advance_cache.get_acquire ();
+ if (!cache)
+ {
+ cache = (hb_ot_font_advance_cache_t *) hb_malloc (sizeof (hb_ot_font_advance_cache_t));
+ if (!cache)
+ return nullptr;
+ new (cache) hb_ot_font_advance_cache_t;
+ return cache;
+ }
+ if (advance_cache.cmpexch (cache, nullptr))
+ return cache;
+ else
+ goto retry;
+ }
+ void release_advance_cache (hb_ot_font_advance_cache_t *cache) const
+ {
+ if (!cache)
+ return;
+ if (!advance_cache.cmpexch (nullptr, cache))
+ hb_free (cache);
+ }
+ void clear_advance_cache () const
+ {
+ retry:
+ auto *cache = advance_cache.get_acquire ();
+ if (!cache)
+ return;
+ if (advance_cache.cmpexch (cache, nullptr))
+ hb_free (cache);
+ else
+ goto retry;
+ }
+
+ OT::ItemVariationStore::cache_t *acquire_varStore_cache (const OT::ItemVariationStore &varStore) const
+ {
+ retry:
+ auto *cache = varStore_cache.get_acquire ();
+ if (!cache)
+ return varStore.create_cache ();
+ if (varStore_cache.cmpexch (cache, nullptr))
+ return cache;
+ else
+ goto retry;
+ }
+ void release_varStore_cache (OT::ItemVariationStore::cache_t *cache) const
+ {
+ if (!cache)
+ return;
+ if (!varStore_cache.cmpexch (nullptr, cache))
+ OT::ItemVariationStore::destroy_cache (cache);
+ }
+ void clear_varStore_cache () const
+ {
+ retry:
+ auto *cache = varStore_cache.get_acquire ();
+ if (!cache)
+ return;
+ if (varStore_cache.cmpexch (cache, nullptr))
+ OT::ItemVariationStore::destroy_cache (cache);
+ else
+ goto retry;
+ }
+
+ void clear () const
+ {
+ clear_advance_cache ();
+ clear_varStore_cache ();
+ }
+
+ } h, v;
+
+ void check_serial (hb_font_t *font) const
+ {
+ int font_serial = font->serial_coords.get_acquire ();
+
+ if (cached_coords_serial.get_acquire () == font_serial)
+ return;
+
+ h.clear ();
+ v.clear ();
+
+ cached_coords_serial.set_release (font_serial);
+ }
};
static hb_ot_font_t *
@@ -98,44 +177,6 @@
ot_font->ot_face = &font->face->table;
-#ifndef HB_NO_AAT
- /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */
-#ifndef HB_NO_STYLE
- ot_font->apply_trak = font->face->table.STAT->has_data () && font->face->table.trak->has_data ();
-#else
- ot_font->apply_trak = false;
-#endif
-#endif
-
-#ifndef HB_NO_OT_FONT_CMAP_CACHE
- // retry:
- auto *cmap_cache = (hb_ot_font_cmap_cache_t *) hb_face_get_user_data (font->face,
- &hb_ot_font_cmap_cache_user_data_key);
- if (!cmap_cache)
- {
- cmap_cache = (hb_ot_font_cmap_cache_t *) hb_malloc (sizeof (hb_ot_font_cmap_cache_t));
- if (unlikely (!cmap_cache)) goto out;
- new (cmap_cache) hb_ot_font_cmap_cache_t ();
- if (unlikely (!hb_face_set_user_data (font->face,
- &hb_ot_font_cmap_cache_user_data_key,
- cmap_cache,
- hb_free,
- false)))
- {
- hb_free (cmap_cache);
- cmap_cache = nullptr;
- /* Normally we would retry here, but that would
- * infinite-loop if the face is the empty-face.
- * Just let it go and this font will be uncached if it
- * happened to collide with another thread creating the
- * cache at the same time. */
- // goto retry;
- }
- }
- out:
- ot_font->cmap_cache = cmap_cache;
-#endif
-
return ot_font;
}
@@ -144,8 +185,7 @@
{
hb_ot_font_t *ot_font = (hb_ot_font_t *) font_data;
- auto *cache = ot_font->advance_cache.get_relaxed ();
- hb_free (cache);
+ ot_font->~hb_ot_font_t ();
hb_free (ot_font);
}
@@ -159,11 +199,7 @@
{
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;
- hb_ot_font_cmap_cache_t *cmap_cache = nullptr;
-#ifndef HB_NO_OT_FONT_CMAP_CACHE
- cmap_cache = ot_font->cmap_cache;
-#endif
- return ot_face->cmap->get_nominal_glyph (unicode, glyph, cmap_cache);
+ return ot_face->cmap->get_nominal_glyph (unicode, glyph);
}
static unsigned int
@@ -178,14 +214,9 @@
{
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;
- hb_ot_font_cmap_cache_t *cmap_cache = nullptr;
-#ifndef HB_NO_OT_FONT_CMAP_CACHE
- cmap_cache = ot_font->cmap_cache;
-#endif
return ot_face->cmap->get_nominal_glyphs (count,
first_unicode, unicode_stride,
- first_glyph, glyph_stride,
- cmap_cache);
+ first_glyph, glyph_stride);
}
static hb_bool_t
@@ -198,13 +229,8 @@
{
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;
- hb_ot_font_cmap_cache_t *cmap_cache = nullptr;
-#ifndef HB_NO_OT_FONT_CMAP_CACHE
- cmap_cache = ot_font->cmap_cache;
-#endif
return ot_face->cmap->get_variation_glyph (unicode,
- variation_selector, glyph,
- cmap_cache);
+ variation_selector, glyph);
}
static void
@@ -216,47 +242,25 @@
unsigned advance_stride,
void *user_data HB_UNUSED)
{
+
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;
const OT::hmtx_accelerator_t &hmtx = *ot_face->hmtx;
- hb_position_t *orig_first_advance = first_advance;
-
-#if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
+ ot_font->check_serial (font);
const OT::HVAR &HVAR = *hmtx.var_table;
const OT::ItemVariationStore &varStore = &HVAR + HVAR.varStore;
- OT::ItemVariationStore::cache_t *varStore_cache = font->num_coords * count >= 128 ? varStore.create_cache () : nullptr;
+ OT::ItemVariationStore::cache_t *varStore_cache = ot_font->h.acquire_varStore_cache (varStore);
+ hb_ot_font_advance_cache_t *advance_cache = nullptr;
+
bool use_cache = font->num_coords;
-#else
- OT::ItemVariationStore::cache_t *varStore_cache = nullptr;
- bool use_cache = false;
-#endif
-
- hb_ot_font_advance_cache_t *cache = nullptr;
if (use_cache)
{
- retry:
- cache = ot_font->advance_cache.get_acquire ();
- if (unlikely (!cache))
- {
- cache = (hb_ot_font_advance_cache_t *) hb_malloc (sizeof (hb_ot_font_advance_cache_t));
- if (unlikely (!cache))
- {
- use_cache = false;
- goto out;
- }
- new (cache) hb_ot_font_advance_cache_t;
-
- if (unlikely (!ot_font->advance_cache.cmpexch (nullptr, cache)))
- {
- hb_free (cache);
- goto retry;
- }
- ot_font->cached_coords_serial.set_release (font->serial_coords);
- }
+ advance_cache = ot_font->h.acquire_advance_cache ();
+ if (!advance_cache)
+ use_cache = false;
}
- out:
if (!use_cache)
{
@@ -269,58 +273,26 @@
}
else
{ /* Use cache. */
- if (ot_font->cached_coords_serial.get_acquire () != (int) font->serial_coords)
- {
- ot_font->advance_cache->clear ();
- ot_font->cached_coords_serial.set_release (font->serial_coords);
- }
-
for (unsigned int i = 0; i < count; i++)
{
hb_position_t v;
unsigned cv;
- if (ot_font->advance_cache->get (*first_glyph, &cv))
+ if (advance_cache->get (*first_glyph, &cv))
v = cv;
else
{
v = hmtx.get_advance_with_var_unscaled (*first_glyph, font, varStore_cache);
- ot_font->advance_cache->set (*first_glyph, v);
+ advance_cache->set (*first_glyph, v);
}
*first_advance = font->em_scale_x (v);
first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
}
- }
-#if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
- OT::ItemVariationStore::destroy_cache (varStore_cache);
-#endif
-
- if (font->x_strength && !font->embolden_in_place)
- {
- /* Emboldening. */
- hb_position_t x_strength = font->x_scale >= 0 ? font->x_strength : -font->x_strength;
- first_advance = orig_first_advance;
- for (unsigned int i = 0; i < count; i++)
- {
- *first_advance += *first_advance ? x_strength : 0;
- first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
- }
+ ot_font->h.release_advance_cache (advance_cache);
}
-#ifndef HB_NO_AAT
- if (ot_font->apply_trak)
- {
- hb_position_t tracking = font->face->table.trak->get_h_tracking (font);
- first_advance = orig_first_advance;
- for (unsigned int i = 0; i < count; i++)
- {
- *first_advance += tracking;
- first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
- first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
- }
- }
-#endif
+ ot_font->h.release_varStore_cache (varStore_cache);
}
#ifndef HB_NO_VERTICAL
@@ -337,17 +309,13 @@
const hb_ot_face_t *ot_face = ot_font->ot_face;
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx;
- hb_position_t *orig_first_advance = first_advance;
-
if (vmtx.has_data ())
{
-#if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
+ ot_font->check_serial (font);
const OT::VVAR &VVAR = *vmtx.var_table;
const OT::ItemVariationStore &varStore = &VVAR + VVAR.varStore;
- OT::ItemVariationStore::cache_t *varStore_cache = font->num_coords ? varStore.create_cache () : nullptr;
-#else
- OT::ItemVariationStore::cache_t *varStore_cache = nullptr;
-#endif
+ OT::ItemVariationStore::cache_t *varStore_cache = ot_font->v.acquire_varStore_cache (varStore);
+ // TODO Use advance_cache.
for (unsigned int i = 0; i < count; i++)
{
@@ -356,9 +324,7 @@
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
}
-#if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
- OT::ItemVariationStore::destroy_cache (varStore_cache);
-#endif
+ ot_font->v.release_varStore_cache (varStore_cache);
}
else
{
@@ -373,32 +339,6 @@
first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
}
}
-
- if (font->y_strength && !font->embolden_in_place)
- {
- /* Emboldening. */
- hb_position_t y_strength = font->y_scale >= 0 ? font->y_strength : -font->y_strength;
- first_advance = orig_first_advance;
- for (unsigned int i = 0; i < count; i++)
- {
- *first_advance += *first_advance ? y_strength : 0;
- first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
- }
- }
-
-#ifndef HB_NO_AAT
- if (ot_font->apply_trak)
- {
- hb_position_t tracking = font->face->table.trak->get_v_tracking (font);
- first_advance = orig_first_advance;
- for (unsigned int i = 0; i < count; i++)
- {
- *first_advance += tracking;
- first_glyph = &StructAtOffsetUnaligned<hb_codepoint_t> (first_glyph, glyph_stride);
- first_advance = &StructAtOffsetUnaligned<hb_position_t> (first_advance, advance_stride);
- }
- }
-#endif
}
#endif
@@ -435,7 +375,8 @@
}
hb_glyph_extents_t extents = {0};
- if (ot_face->glyf->get_extents (font, glyph, &extents))
+
+ if (hb_font_get_glyph_extents (font, glyph, &extents))
{
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx;
int tsb = 0;
@@ -448,7 +389,7 @@
hb_font_extents_t font_extents;
font->get_h_extents_with_fallback (&font_extents);
hb_position_t advance = font_extents.ascender - font_extents.descender;
- int diff = advance - -extents.height;
+ hb_position_t diff = advance - -extents.height;
*y = extents.y_bearing + (diff >> 1);
return true;
}
@@ -564,35 +505,17 @@
hb_draw_funcs_t *draw_funcs, void *draw_data,
void *user_data)
{
- bool embolden = font->x_strength || font->y_strength;
- hb_outline_t outline;
-
- { // Need draw_session to be destructed before emboldening.
- hb_draw_session_t draw_session (embolden ? hb_outline_recording_pen_get_funcs () : draw_funcs,
- embolden ? &outline : draw_data, font->slant_xy);
+ hb_draw_session_t draw_session (draw_funcs, draw_data, font->slant_xy);
#ifndef HB_NO_VAR_COMPOSITES
- if (!font->face->table.VARC->get_path (font, glyph, draw_session))
+ if (!font->face->table.VARC->get_path (font, glyph, draw_session))
#endif
- // Keep the following in synch with VARC::get_path_at()
- if (!font->face->table.glyf->get_path (font, glyph, draw_session))
+ // Keep the following in synch with VARC::get_path_at()
+ if (!font->face->table.glyf->get_path (font, glyph, draw_session))
#ifndef HB_NO_CFF
- if (!font->face->table.cff2->get_path (font, glyph, draw_session))
- if (!font->face->table.cff1->get_path (font, glyph, draw_session))
+ if (!font->face->table.cff2->get_path (font, glyph, draw_session))
+ if (!font->face->table.cff1->get_path (font, glyph, draw_session))
#endif
- {}
- }
-
- if (embolden)
- {
- float x_shift = font->embolden_in_place ? 0 : (float) font->x_strength / 2;
- float y_shift = (float) font->y_strength / 2;
- if (font->x_scale < 0) x_shift = -x_shift;
- if (font->y_scale < 0) y_shift = -y_shift;
- outline.embolden (font->x_strength, font->y_strength,
- x_shift, y_shift);
-
- outline.replay (draw_funcs, draw_data);
- }
+ {}
}
#endif
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -359,7 +359,13 @@
return true;
}
- return _glyf_get_leading_bearing_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx, lsb);
+ // If there's no vmtx data, the phantom points from glyf table are not accurate,
+ // so we cannot take the next path.
+ bool is_vertical = T::tableTag == HB_OT_TAG_vmtx;
+ if (is_vertical && !has_data ())
+ return false;
+
+ return _glyf_get_leading_bearing_with_var_unscaled (font, glyph, is_vertical, lsb);
#else
return false;
#endif
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -1850,7 +1850,7 @@
hb_sorted_vector_t<hb_codepoint_pair_t> glyph_and_klass;
hb_set_t orig_klasses;
- if (glyph_set.get_population () * hb_bit_storage ((unsigned) rangeRecord.len) / 2
+ if (glyph_set.get_population () * hb_bit_storage ((unsigned) rangeRecord.len)
< get_population ())
{
for (hb_codepoint_t g : glyph_set)
@@ -1931,7 +1931,7 @@
bool intersects (const hb_set_t *glyphs) const
{
- if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len) / 2)
+ if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len))
{
for (auto g : *glyphs)
if (get_class (g))
@@ -2000,7 +2000,7 @@
}
unsigned count = rangeRecord.len;
- if (count > glyphs->get_population () * hb_bit_storage (count) * 8)
+ if (count > glyphs->get_population () * hb_bit_storage (count))
{
for (auto g : *glyphs)
{
@@ -2548,11 +2548,13 @@
DEFINE_SIZE_STATIC (8);
};
-#define REGION_CACHE_ITEM_CACHE_INVALID 2.f
+#define REGION_CACHE_ITEM_CACHE_INVALID INT_MIN
+#define REGION_CACHE_ITEM_MULTIPLIER (float (1 << ((sizeof (int) * 8) - 2)))
+#define REGION_CACHE_ITEM_DIVISOR (1.f / float (1 << ((sizeof (int) * 8) - 2)))
struct VarRegionList
{
- using cache_t = float;
+ using cache_t = hb_atomic_t<int>;
float evaluate (unsigned int region_index,
const int *coords, unsigned int coord_len,
@@ -2561,12 +2563,12 @@
if (unlikely (region_index >= regionCount))
return 0.;
- float *cached_value = nullptr;
+ cache_t *cached_value = nullptr;
if (cache)
{
cached_value = &(cache[region_index]);
if (*cached_value != REGION_CACHE_ITEM_CACHE_INVALID)
- return *cached_value;
+ return *cached_value * REGION_CACHE_ITEM_DIVISOR;
}
const VarRegionAxis *axes = axesZ.arrayZ + (region_index * axisCount);
@@ -2587,7 +2589,7 @@
}
if (cache)
- *cached_value = v;
+ *cached_value = v * REGION_CACHE_ITEM_MULTIPLIER;
return v;
}
@@ -2730,7 +2732,7 @@
struct SparseVarRegionList
{
- using cache_t = float;
+ using cache_t = hb_atomic_t<int>;
float evaluate (unsigned int region_index,
const int *coords, unsigned int coord_len,
@@ -2739,12 +2741,12 @@
if (unlikely (region_index >= regions.len))
return 0.;
- float *cached_value = nullptr;
+ cache_t *cached_value = nullptr;
if (cache)
{
cached_value = &(cache[region_index]);
if (*cached_value != REGION_CACHE_ITEM_CACHE_INVALID)
- return *cached_value;
+ return *cached_value * REGION_CACHE_ITEM_DIVISOR;
}
const SparseVariationRegion ®ion = this+regions[region_index];
@@ -2752,7 +2754,7 @@
float v = region.evaluate (coords, coord_len);
if (cache)
- *cached_value = v;
+ *cached_value = v * REGION_CACHE_ITEM_MULTIPLIER;
return v;
}
@@ -3187,10 +3189,10 @@
#ifdef HB_NO_VAR
return nullptr;
#endif
- auto &r = this+regions;
- unsigned count = r.regionCount;
+ unsigned count = (this+regions).regionCount;
+ if (!count) return nullptr;
- float *cache = (float *) hb_malloc (sizeof (float) * count);
+ cache_t *cache = (cache_t *) hb_malloc (sizeof (float) * count);
if (unlikely (!cache)) return nullptr;
for (unsigned i = 0; i < count; i++)
@@ -3440,7 +3442,7 @@
{
using cache_t = SparseVarRegionList::cache_t;
- cache_t *create_cache (hb_array_t<float> static_cache = hb_array_t<float> ()) const
+ cache_t *create_cache (hb_array_t<cache_t> static_cache = hb_array_t<cache_t> ()) const
{
#ifdef HB_NO_VAR
return nullptr;
@@ -3448,12 +3450,12 @@
auto &r = this+regions;
unsigned count = r.regions.len;
- float *cache;
+ cache_t *cache;
if (count <= static_cache.length)
cache = static_cache.arrayZ;
else
{
- cache = (float *) hb_malloc (sizeof (float) * count);
+ cache = (cache_t *) hb_malloc (sizeof (float) * count);
if (unlikely (!cache)) return nullptr;
}
@@ -3464,7 +3466,7 @@
}
static void destroy_cache (cache_t *cache,
- hb_array_t<float> static_cache = hb_array_t<float> ())
+ hb_array_t<cache_t> static_cache = hb_array_t<cache_t> ())
{
if (cache != static_cache.arrayZ)
hb_free (cache);
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -737,7 +737,8 @@
hb_ot_apply_context_t (unsigned int table_index_,
hb_font_t *font_,
hb_buffer_t *buffer_,
- hb_blob_t *table_blob_) :
+ hb_blob_t *table_blob_,
+ ItemVariationStore::cache_t *var_store_cache_ = nullptr) :
table_index (table_index_),
font (font_), face (font->face), buffer (buffer_),
sanitizer (table_blob_),
@@ -756,13 +757,7 @@
#endif
),
var_store (gdef.get_var_store ()),
- var_store_cache (
-#ifndef HB_NO_VAR
- table_index == 1 && font->num_coords ? var_store.create_cache () : nullptr
-#else
- nullptr
-#endif
- ),
+ var_store_cache (var_store_cache_),
direction (buffer_->props.direction),
has_glyph_classes (gdef.has_glyph_classes ())
{
@@ -770,13 +765,6 @@
buffer->collect_codepoints (digest);
}
- ~hb_ot_apply_context_t ()
- {
-#ifndef HB_NO_VAR
- ItemVariationStore::destroy_cache (var_store_cache);
-#endif
- }
-
void init_iters ()
{
iter_input.init (this, false);
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -2015,7 +2015,11 @@
{
const unsigned int table_index = proxy.table_index;
unsigned int i = 0;
- OT::hb_ot_apply_context_t c (table_index, font, buffer, proxy.accel.get_blob ());
+
+ auto *font_data = font->data.ot.get ();
+ auto *var_store_cache = font_data == HB_SHAPER_DATA_SUCCEEDED ? nullptr : (OT::ItemVariationStore::cache_t *) font_data;
+
+ OT::hb_ot_apply_context_t c (table_index, font, buffer, proxy.accel.get_blob (), var_store_cache);
c.set_recurse_func (Proxy::Lookup::template dispatch_recurse_func<OT::hb_ot_apply_context_t>);
for (unsigned int stage_index = 0; stage_index < stages[table_index].length; stage_index++)
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -431,6 +431,7 @@
{
_hb_glyph_info_set_general_category (info, HB_UNICODE_GENERAL_CATEGORY_FORMAT);
info->unicode_props() |= UPROPS_MASK_Cf_AAT_DELETED;
+ info->unicode_props() |= UPROPS_MASK_HIDDEN;
}
/* lig_props: aka lig_id / lig_comp
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -427,8 +427,13 @@
/* Find mark glyphs */
unsigned int j;
for (j = i + 1; j < end; j++)
+ {
+ if (_hb_glyph_info_is_hidden (&info[j]) ||
+ _hb_glyph_info_is_default_ignorable (&info[j]))
+ continue;
if (!_hb_glyph_info_is_unicode_mark (&info[j]))
break;
+ }
position_around_base (plan, font, buffer, i, j, adjust_offsets_when_zeroing);
@@ -455,7 +460,9 @@
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 1; i < count; i++)
- if (likely (!_hb_glyph_info_is_unicode_mark (&info[i]))) {
+ if (likely (!_hb_glyph_info_is_unicode_mark (&info[i]) &&
+ !_hb_glyph_info_is_hidden (&info[i]) &&
+ !_hb_glyph_info_is_default_ignorable (&info[i]))) {
position_cluster (plan, font, buffer, start, i, adjust_offsets_when_zeroing);
start = i;
}
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -46,6 +46,7 @@
#include "hb-set.hh"
#include "hb-aat-layout.hh"
+#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-stat-table.hh"
@@ -210,7 +211,15 @@
https://github.com/harfbuzz/harfbuzz/issues/2967. */
if (plan.apply_morx)
plan.adjust_mark_positioning_when_zeroing = false;
+
+ /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */
+#ifndef HB_NO_STYLE
+ plan.apply_trak = hb_aat_layout_has_tracking (face) && face->table.STAT->has_data ();
+#else
+ plan.apply_trak = false;
#endif
+
+#endif
}
bool
@@ -274,6 +283,11 @@
#endif
else if (this->apply_fallback_kern)
_hb_ot_shape_fallback_kern (this, font, buffer);
+
+#ifndef HB_NO_AAT_SHAPE
+ if (this->apply_trak)
+ hb_aat_layout_track (this, font, buffer);
+#endif
}
@@ -410,17 +424,26 @@
* shaper font data
*/
-struct hb_ot_font_data_t {};
+struct hb_ot_font_data_t {
+ OT::ItemVariationStore::cache_t unused; // Just for alignment
+};
hb_ot_font_data_t *
-_hb_ot_shaper_font_data_create (hb_font_t *font HB_UNUSED)
+_hb_ot_shaper_font_data_create (hb_font_t *font)
{
- return (hb_ot_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
+ if (!font->num_coords)
+ return (hb_ot_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
+
+ const OT::ItemVariationStore &var_store = font->face->table.GDEF->table->get_var_store ();
+ auto *cache = (hb_ot_font_data_t *) var_store.create_cache ();
+ return cache ? cache : (hb_ot_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
}
void
-_hb_ot_shaper_font_data_destroy (hb_ot_font_data_t *data HB_UNUSED)
+_hb_ot_shaper_font_data_destroy (hb_ot_font_data_t *data)
{
+ if (data == HB_SHAPER_DATA_SUCCEEDED) return;
+ OT::ItemVariationStore::destroy_cache ((OT::ItemVariationStore::cache_t *) data);
}
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -109,9 +109,11 @@
#ifndef HB_NO_AAT_SHAPE
bool apply_kerx : 1;
bool apply_morx : 1;
+ bool apply_trak : 1;
#else
static constexpr bool apply_kerx = false;
static constexpr bool apply_morx = false;
+ static constexpr bool apply_trak = false;
#endif
void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -590,9 +590,9 @@
/* If sanitize failed, set glyphCount to 0. */
glyphCount = table->version.to_int () ? face->get_num_glyphs () : 0;
- /* For shared tuples that only have one axis active, shared the index of
- * that axis as a cache. This will speed up caclulate_scalar() a lot
- * for fonts with lots of axes and many "monovar" tuples. */
+ /* For shared tuples that only have one or two axes active, shared the index
+ * of that axis as a cache. This will speed up caclulate_scalar() a lot
+ * for fonts with lots of axes and many "monovar" or "duovar" tuples. */
hb_array_t<const F2DOT14> shared_tuples = (table+table->sharedTuples).as_array (table->sharedTupleCount * table->axisCount);
unsigned count = table->sharedTupleCount;
if (unlikely (!shared_tuple_active_idx.resize (count, false))) return;
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -31,11 +31,10 @@
#include "hb-machinery.hh"
/*
- * The set-digests here implement various "filters" that support
- * "approximate member query". Conceptually these are like Bloom
- * Filter and Quotient Filter, however, much smaller, faster, and
- * designed to fit the requirements of our uses for glyph coverage
- * queries.
+ * The set-digests implement "filters" that support "approximate
+ * member query". Conceptually these are like Bloom Filter and
+ * Quotient Filter, however, much smaller, faster, and designed
+ * to fit the requirements of our uses for glyph coverage queries.
*
* Our filters are highly accurate if the lookup covers fairly local
* set of glyphs, but fully flooded and ineffective if coverage is
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -408,7 +408,7 @@
{
if (&var_store == &Null (OT::ItemVariationStore)) return;
unsigned subtable_count = var_store.get_sub_table_count ();
- float *store_cache = var_store.create_cache ();
+ auto *store_cache = var_store.create_cache ();
unsigned new_major = 0, new_minor = 0;
unsigned last_major = (variation_indices.get_min ()) >> 16;
@@ -1161,12 +1161,12 @@
hb_glyph_extents_t extents = {0x7FFF, -0x7FFF};
OT::hmtx_accelerator_t _hmtx (plan->source);
- float *hvar_store_cache = nullptr;
+ OT::ItemVariationStore::cache_t *hvar_store_cache = nullptr;
if (_hmtx.has_data () && _hmtx.var_table.get_length ())
hvar_store_cache = _hmtx.var_table->get_var_store ().create_cache ();
OT::vmtx_accelerator_t _vmtx (plan->source);
- float *vvar_store_cache = nullptr;
+ OT::ItemVariationStore::cache_t *vvar_store_cache = nullptr;
if (_vmtx.has_data () && _vmtx.var_table.get_length ())
vvar_store_cache = _vmtx.var_table->get_var_store ().create_cache ();
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc 2025-04-04 23:39:11 UTC (rev 74849)
@@ -708,3 +708,107 @@
end:
return success ? hb_face_reference (plan->dest) : nullptr;
}
+
+
+#ifdef HB_EXPERIMENTAL_API
+
+#include "hb-ot-cff1-table.hh"
+
+template<typename accel_t>
+static hb_blob_t* get_charstrings_data(accel_t& accel, hb_codepoint_t glyph_index) {
+ if (!accel.is_valid()) {
+ return hb_blob_get_empty ();
+ }
+
+ hb_ubytes_t bytes = (*accel.charStrings)[glyph_index];
+ if (!bytes) {
+ return hb_blob_get_empty ();
+ }
+
+ hb_blob_t* cff_blob = accel.get_blob();
+ uint32_t length;
+ const char* cff_data = hb_blob_get_data(cff_blob, &length) ;
+
+ long int offset = (const char*) bytes.arrayZ - cff_data;
+ if (offset < 0 || offset > UINT32_MAX) {
+ return hb_blob_get_empty ();
+ }
+
+ return hb_blob_create_sub_blob(cff_blob, (uint32_t) offset, bytes.length);
+}
+
+template<typename accel_t>
+static hb_blob_t* get_charstrings_index(accel_t& accel) {
+ if (!accel.is_valid()) {
+ return hb_blob_get_empty ();
+ }
+
+ const char* charstrings_start = (const char*) accel.charStrings;
+ unsigned charstrings_length = accel.charStrings->get_size();
+
+ hb_blob_t* cff_blob = accel.get_blob();
+ uint32_t length;
+ const char* cff_data = hb_blob_get_data(cff_blob, &length) ;
+
+ long int offset = charstrings_start - cff_data;
+ if (offset < 0 || offset > UINT32_MAX) {
+ return hb_blob_get_empty ();
+ }
+
+ return hb_blob_create_sub_blob(cff_blob, (uint32_t) offset, charstrings_length);
+}
+
+/**
+ * hb_subset_cff_get_charstring_data:
+ * @face: A face object
+ * @glyph_index: Glyph index to get data for.
+ *
+ * Returns the raw outline data from the CFF/CFF2 table associated with the given glyph index.
+ *
+ * XSince: EXPERIMENTAL
+ **/
+HB_EXTERN hb_blob_t*
+hb_subset_cff_get_charstring_data(hb_face_t* face, hb_codepoint_t glyph_index) {
+ return get_charstrings_data(*face->table.cff1, glyph_index);
+}
+
+/**
+ * hb_subset_cff_get_charstrings_index:
+ * @face: A face object
+ *
+ * Returns the raw CFF CharStrings INDEX from the CFF table.
+ *
+ * XSince: EXPERIMENTAL
+ **/
+HB_EXTERN hb_blob_t*
+hb_subset_cff_get_charstrings_index (hb_face_t* face) {
+ return get_charstrings_index (*face->table.cff1);
+}
+
+/**
+ * hb_subset_cff2_get_charstring_data:
+ * @face: A face object
+ * @glyph_index: Glyph index to get data for.
+ *
+ * Returns the raw outline data from the CFF/CFF2 table associated with the given glyph index.
+ *
+ * XSince: EXPERIMENTAL
+ **/
+HB_EXTERN hb_blob_t*
+hb_subset_cff2_get_charstring_data(hb_face_t* face, hb_codepoint_t glyph_index) {
+ return get_charstrings_data(*face->table.cff2, glyph_index);
+}
+
+/**
+ * hb_subset_cff2_get_charstrings_index:
+ * @face: A face object
+ *
+ * Returns the raw CFF2 CharStrings INDEX from the CFF2 table.
+ *
+ * XSince: EXPERIMENTAL
+ **/
+HB_EXTERN hb_blob_t*
+hb_subset_cff2_get_charstrings_index (hb_face_t* face) {
+ return get_charstrings_index (*face->table.cff2);
+}
+#endif
\ No newline at end of file
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h 2025-04-04 23:39:11 UTC (rev 74849)
@@ -224,6 +224,23 @@
unsigned language_id,
const char *name_str,
int str_len);
+
+
+/*
+* Raw outline data access
+*/
+
+HB_EXTERN hb_blob_t*
+hb_subset_cff_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph_index);
+
+HB_EXTERN hb_blob_t*
+hb_subset_cff_get_charstrings_index (hb_face_t* face);
+
+HB_EXTERN hb_blob_t*
+hb_subset_cff2_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph_index);
+
+HB_EXTERN hb_blob_t*
+hb_subset_cff2_get_charstrings_index (hb_face_t* face);
#endif
HB_EXTERN hb_face_t *
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh 2025-04-04 23:39:11 UTC (rev 74849)
@@ -89,6 +89,7 @@
#pragma GCC diagnostic error "-Wstring-conversion"
#pragma GCC diagnostic error "-Wswitch-enum"
#pragma GCC diagnostic error "-Wtautological-overlap-compare"
+#pragma GCC diagnostic error "-Wuninitialized"
#pragma GCC diagnostic error "-Wunneeded-internal-declaration"
#pragma GCC diagnostic error "-Wunused"
#pragma GCC diagnostic error "-Wunused-local-typedefs"
Modified: trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build
===================================================================
--- trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build 2025-04-04 23:39:11 UTC (rev 74849)
@@ -513,6 +513,7 @@
if conf.get('HAVE_DIRECTWRITE', 0) == 1
hb_sources += hb_directwrite_sources
hb_headers += hb_directwrite_headers
+ harfbuzz_deps += directwrite_dep
# hb-directwrite needs a C++ linker
libharfbuzz_link_language = 'cpp'
endif
Modified: trunk/Build/source/libs/harfbuzz/version.ac
===================================================================
--- trunk/Build/source/libs/harfbuzz/version.ac 2025-04-04 20:58:11 UTC (rev 74848)
+++ trunk/Build/source/libs/harfbuzz/version.ac 2025-04-04 23:39:11 UTC (rev 74849)
@@ -8,4 +8,4 @@
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current harfbuzz version
-m4_define([harfbuzz_version], [11.0.0])
+m4_define([harfbuzz_version], [11.0.1])
More information about the tex-live-commits
mailing list.