Commit Graph
14128 Commits
Author SHA1 Message Date
Behdad Esfahbod 215c8de3cd [ft-colr] Fix cycle-detection accounting
Fixes https://github.com/harfbuzz/harfbuzz/issues/5073
2025-02-15 21:08:14 -07:00
Khaled Hosny cf336f17b2 [shape-plan] Rename hb_ot_shape_plan_get_features to get_feature_tags
Simplify the API by returning only feature tags. The users of this API
would be interested only in feature enabled by default and whether the
feature is globally or partially enabled wouldn’t be of much interest in
that case. For user features, the user of the API already have full
access to them.
2025-02-14 21:54:30 +02:00
Khaled Hosny a7d7715f10 [shape-plan] Add hb_ot_shape_plan_get_features
This should get the features on a shape plan after executing it.

Initially I wanted to return an array of tags, but then there can be
user features that are not enabled globally, so I thought returning
hb_feature_t with value and range would be better. There is a TODO since
I couldn’t figure out how to get the value and range from the feature
mask. But also it may be overkill and a simple boolean indicating wither
it is a global feature or not would be enough.

I wounder also what should happen to non-user features that are applied
selectively, like init or medi, does ot make sense to indicate whether
they are global or not?

This is inspired by the discussion in:
https://github.com/fontforge/fontforge/pull/5522#pullrequestreview-2574321449,
but it might be useful to other HarfBuzz users.
2025-02-14 21:54:30 +02:00
Khaled Hosny bcd5aa368d [docs/coretext] Fix hb_coretext_font_set_funcs() documentation
Remove the note that fonts created with hb_coretext_font_create() have
these font functions configured for them, which is not true.

hb_coretext_font_create() documents this correctly.
2025-02-13 17:39:50 -07:00
Behdad Esfahbod d2a88fbd7b [vector] Add alloc_exact() 2025-02-12 21:52:01 -05:00
Khaled Hosny 94584d14d3 [coretext] Use vector instead of malloc/free a C-array 2025-02-12 14:21:09 +02:00
Khaled Hosny 1bc87dfed2 [coretext] Handle allocation failures 2025-02-12 14:21:09 +02:00
Khaled Hosny c07b22335f [coretext] Fix copying of variations when creating hb-font 2025-02-12 14:21:09 +02:00
Behdad Esfahbod 778acfc606 [coretext] Don't assume that a normalized-coord 0 mins design-coords at default 2025-02-12 14:21:09 +02:00
Behdad Esfahbod 27a25f2d3d [coretext] Copy variations when creating hb-font
https://github.com/harfbuzz/harfbuzz/issues/3159#issuecomment-2652262262
2025-02-12 14:21:09 +02:00
Behdad Esfahbod a69842a839 [shape-plan] Minor check for invalid direction 2025-02-12 11:23:28 +00:00
Behdad Esfahbod e9c2d78dae [buffer] Clean up some small mess 2025-02-12 11:12:51 +00:00
Behdad Esfahbod 6d95c12871 [buffer] Remove unused includes 2025-02-12 11:12:40 +00:00
Behdad Esfahbod 3446465750 [set] Tweak allocation
Allocation 2-page sets as exact count as well.
Don't do the same for the page_map.
2025-02-10 18:52:23 +00:00
Behdad Esfahbod 4b54ee1148 [glyf] Change drawing algorithm to match FreeType / CoreText 2025-02-09 13:07:57 +00:00
Behdad Esfahbod f68193a00a [glyf] Use direct access to points array
Not necessary faster. Prep'ing for next change.
2025-02-09 12:38:38 +00:00
Behdad Esfahbod b13017e651 Use HB_ALWAYS_INLINE instead of bare __attribute__
The former works on MSVC too.
2025-02-09 08:00:18 +00:00
Behdad Esfahbod 922a56f43a [trak] Fix configs build 2025-02-09 04:50:17 +00:00
Behdad Esfahbod 17c11ec523 [ft/trak] Apply trak in ft-font-funcs as well
Part of https://github.com/harfbuzz/harfbuzz/issues/5049
2025-02-09 04:46:29 +00:00
Behdad Esfahbod ffae5b040d [ot-font/trak] Move trak application to ot-font instead of ot-shape
This is what CoreText does.

Fixes https://github.com/harfbuzz/harfbuzz/issues/5049
2025-02-09 04:39:32 +00:00
Behdad Esfahbod f840480fde [trak] Remove leftover 2025-02-09 04:27:20 +00:00
Behdad Esfahbod be287eab02 [trak] Don't shift glyphs
That's what CoreText does and fonts are designed for. Who are we to improve on...
2025-02-09 04:19:02 +00:00
Behdad Esfahbod 1150d4bf12 [trak] Remove support for disabling using pseudo-font-feature
Fixes https://github.com/harfbuzz/harfbuzz/issues/5052
2025-02-09 04:16:57 +00:00
Behdad Esfahbod fb22295311 [coretext-font] Support non-BMP in variation-selector callback
Fixes https://github.com/harfbuzz/harfbuzz/issues/5056
2025-02-09 03:57:47 +00:00
Behdad Esfahbod f6bf9f697e [coretext-font] Do early-return in get_nominal_glyphs()
Related to https://github.com/harfbuzz/harfbuzz/issues/5056
2025-02-09 03:57:47 +00:00
Behdad Esfahbod c5e6c885c1 [coretext-font] Support non-BMP chars in get_nominal_glyph(s)
Part of https://github.com/harfbuzz/harfbuzz/issues/5056
2025-02-09 03:57:47 +00:00
Behdad Esfahbod a70a30ddfd [trak] Interpolate between tracks
Fixes https://github.com/harfbuzz/harfbuzz/issues/5054

According to Ned, this is what CoreText does.

Should add tests some time...
2025-02-09 02:56:20 +00:00
Behdad Esfahbod 1bf0a5bc17 [trak] Streamline a bit
Also use float math.
2025-02-09 02:43:09 +00:00
Behdad Esfahbod b1677e76aa [trak] Handle "out-of-range" values better
If requested size < min-size, use the value for min-size.
If requested size > max-size, use the value for max-size.

This is the only way that makes sense. Extrapolating as we were
doing, is just wrong...

This also seems to match what CoreText does.

Adjacent to fixing https://github.com/harfbuzz/harfbuzz/issues/5054
2025-02-09 02:05:36 +00:00
Behdad Esfahbod 691cc93976 [trak] Fix build without STAT 2025-02-06 20:08:16 +00:00
Behdad Esfahbod b8327fe605 Fix compiler errors 2025-02-06 20:01:12 +00:00
Behdad Esfahbod f394206b7c [ot-shape] Only apply trak'ing if STAT table present 2025-02-06 19:56:33 +00:00
Behdad Esfahbod 6e0dd8110e [trak] Default ptem to 12
That's what CoreText does.
https://developer.apple.com/documentation/coretext/ctfontcreatewithgraphicsfont(_:_:_:_:)

Fixes https://github.com/harfbuzz/harfbuzz/issues/5048
2025-02-06 19:56:30 +00:00
Behdad Esfahbod 6a37a65276 [trak] Choose closest trak track to 0.0
Seems to be what CT does. Needs more testing to adjust better, but
for now it's better than before.
2025-02-06 17:41:36 +00:00
Behdad Esfahbod 8efd2d85c7 [coretext] Fix CGFont leak 2025-02-06 14:38:09 +00:00
Behdad Esfahbod b5327faf99 Fix leak
From recent work.
2025-02-06 14:26:37 +00:00
Behdad Esfahbod 24fe2be9c1 [subset] Fix undefined-behavior 2025-02-06 11:55:23 +00:00
Behdad Esfahbod 97db7bb2a0 [set-digest] Cosmetic 2025-02-06 11:01:59 +00:00
Behdad Esfahbod f0d6a36612 [face] Use a macro 2025-02-06 02:51:50 +00:00
Behdad Esfahbod 7bdc6c9a5a Whitespace 2025-02-06 02:47:13 +00:00
Behdad Esfahbod 6091abcc9b [buffer] Avoid a copy in collect_codepoints() 2025-02-06 02:40:24 +00:00
Behdad Esfahbod e5e3bc4080 [buffer] Merge two functions into a template 2025-02-06 02:37:10 +00:00
Behdad Esfahbod 403f12f766 [buffer] A few always-inline's 2025-02-06 02:33:41 +00:00
Behdad Esfahbod 4818ba9ece [set-digest] Yet another tuning
Saves 5% on SF Pro while regressing 2% on Roboto.
2025-02-06 01:50:12 +00:00
Behdad Esfahbod c737829449 [OT] Remove likely() from coverage check
Not that it matters, but because of the set-digest, this path
is not very likely() anymore.
2025-02-06 01:42:25 +00:00
Behdad Esfahbod 3577992a5b [gsubgpos] Simplify a destruction 2025-02-06 01:30:59 +00:00
Behdad Esfahbod d0d256bb66 [bit-page] Move a couple methods around 2025-02-06 01:26:33 +00:00
Behdad Esfahbod a4cd11dea9 [bit-page] Micro-optimize 2025-02-06 01:13:58 +00:00
Behdad Esfahbod 0a678a9233 Fix leak 2025-02-06 01:02:44 +00:00
Behdad Esfahbod cad264b2c9 Indent 2025-02-06 00:56:16 +00:00