Behdad Esfahbod
fdf4c759fa
[hmtx] Simplify get-leading code
...
Can't return false. The false was being used before to mean
"table not present". Handle that instead.
2025-07-20 07:19:23 -06:00
Behdad Esfahbod
b359c83cdd
[ot-font] Rewrite h/v-advance code
...
Faster, better cached...
24% faster across the benchmarks for hmtx-only path.
Comparing before to after
Benchmark Time CPU Time Old Time New CPU Old CPU New
------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_Font/glyph_h_advances/Roboto-Regular.ttf/ot -0.2410 -0.2411 2 1 2 1
BM_Font/glyph_h_advances/RobotoFlex-Variable.ttf/ot -0.2482 -0.2484 1 1 1 1
BM_Font/glyph_h_advances/RobotoFlex-Variable.ttf/var/ot -0.0296 -0.0296 48 47 48 47
BM_Font/glyph_h_advances/SourceSansPro-Regular.otf/ot -0.2412 -0.2416 2 2 2 2
BM_Font/glyph_h_advances/SourceSansPro-Regular.otf/var/ot -0.2381 -0.2384 2 2 2 2
BM_Font/glyph_h_advances/AdobeVFPrototype.otf/ot -0.2347 -0.2349 0 0 0 0
BM_Font/glyph_h_advances/AdobeVFPrototype.otf/var/ot -0.0343 -0.0346 2 2 2 2
BM_Font/glyph_h_advances/SourceSerifVariable-Roman.ttf/ot -0.2623 -0.2621 2 1 2 1
BM_Font/glyph_h_advances/SourceSerifVariable-Roman.ttf/var/ot -0.0388 -0.0401 24 23 24 23
BM_Font/glyph_h_advances/Comfortaa-Regular-new.ttf/ot -0.2396 -0.2394 1 1 1 1
BM_Font/glyph_h_advances/NotoNastaliqUrdu-Regular.ttf/ot -0.2344 -0.2346 2 1 2 1
BM_Font/glyph_h_advances/NotoSerifMyanmar-Regular.otf/ot -0.2366 -0.2367 1 1 1 1
OVERALL_GEOMEAN -0.1945 -0.1948 0 0 0 0
2025-07-20 07:19:23 -06:00
Behdad Esfahbod
3d154bc6b2
[buffer-message] Fix potential buffer overflow...
...
...when buffer messaging is enabled and with malicious font.
Fixes https://github.com/harfbuzz/harfbuzz/security/advisories/GHSA-p965-5rr7-9mhq
2025-07-14 13:54:49 -06:00
Qunxin Liu
5dbb814164
[subset] AnchorFormat3: better check for when should downgrade to format1
2025-07-14 10:54:43 -06:00
Behdad Esfahbod
e81efe3a63
[glyf] Add TODO
2025-07-11 01:40:23 -06:00
Behdad Esfahbod
6ed598e1c0
Merge pull request #5382 from harfbuzz/lig_split
...
[repacker] Implement table splitting for LigatureSubst
2025-07-10 13:03:44 -06:00
Qunxin Liu
95dc11092f
[subset] bug fix
...
Don't downgrade to format1 when subsetting
2025-07-10 12:25:10 -06:00
Garret Rieger
38ab13c67e
[repacker] add support for splitting GSUB Ligature lookups.
2025-07-04 23:37:24 +00:00
Behdad Esfahbod
47089fe7a3
Big misc changes
...
- Make geometry types into templates taking float or double.
- Changes to paint() transform elimination.
- Add font->has_nonzero_coords and use it across.
- Extensions to avar processing for otherwise invalid mappings.
2025-06-08 13:43:27 +03:00
Behdad Esfahbod
c124252df5
[algs] Add support for little-endian int types
...
As well as 64bit-int, and float types.
Add Align type.
2025-06-08 13:43:27 +03:00
Behdad Esfahbod
e1dcc454f1
[gvar] Use cached scratch in get_extents
...
Makes it alloc-free.
15% faster on benchmark-font glyph_extents RobotoFlex var benchmark.
2025-05-21 16:01:44 -06:00
Behdad Esfahbod
c6097698c6
[ot-font/draw] Use a gvar shared-tuple scalar cache for calculate_scalar
...
Massive saving on massively variable fonts. Over 30% on a tested font.
2025-05-16 01:11:33 -07:00
Behdad Esfahbod
f50490d6dd
Add hb_scalar_cache_t
2025-05-15 18:28:44 -07:00
Behdad Esfahbod
89e28a2381
[skippy-iter] Use auto for type deduction
2025-05-10 16:30:35 -06:00
Behdad Esfahbod
5933468261
[shape] Only apply slant to shaping results if horizontal
2025-04-23 20:56:32 -06:00
Behdad Esfahbod
e71a88d318
[paint] Fix crash
2025-04-23 19:17:31 -06:00
Behdad Esfahbod
6688a03ce2
[sbix/CBDT] Fix memory leaks in error case
2025-04-23 19:06:52 -06:00
Behdad Esfahbod
17238eae3d
[ot/ft/fontations] Port to new _or_fail of draw/paint APIs
2025-04-23 18:23:51 -06:00
Behdad Esfahbod
a23021e168
[COLRv1] Simplify paint_glyph()
...
Pass a non-synthetic font to the client, so they don't have
to worry about it.
The only issue left, is that now when paint_glyph() paints
an outline glyph (not color glyph), it would be double-slanted.
I'm leaning towards removing painting of outline glyphs from
the paint API and change the paint API to return a boolean.
2025-04-23 00:43:56 -06:00
Behdad Esfahbod
01e9c77e30
[COLR] Fix clip-box
...
Was slanting it. Was wrong with new code.
2025-04-22 21:57:02 -06:00
Behdad Esfahbod
a69713b520
[color] Move slanting to font layer
...
COLRv1 is still being double-slanted. Investigating.
2025-04-22 21:02:45 -06:00
Behdad Esfahbod
0536254885
Merge pull request #5294 from harfbuzz/paint-bounds
...
[COLRv1] `paint-bounds`
2025-04-20 05:06:54 -06:00
Behdad Esfahbod
27b2e16ac0
[atomic] Make cmpexch() non-const
...
Was a mistake. Make the affected members mutable instead.
2025-04-20 04:34:40 -06:00
Behdad Esfahbod
78822b6336
Revert "[COLRv1] Move paint boundedness check to font layer"
...
This reverts commit c9a26fbf47 .
2025-04-20 04:23:35 -06:00
Behdad Esfahbod
c9a26fbf47
[COLRv1] Move paint boundedness check to font layer
...
This way it will apply to fontations and future implementations
as well.
But this slows down things apparently, specially if the font
does use clipboxes. So I'm going to revert.
2025-04-20 04:22:32 -06:00
Behdad Esfahbod
8aa88aa416
[COLRv1:ot/ft] Use paint-bounded instead of paint-extents
...
Faster. Note that this also means that if there is no clip-box,
we don't compute the bounds and emit an initial clip anymore.
That was totally unnecessary and against the COLRv1 rendering
algorithm.
This makes painting of COLRv1 fonts without clipboxes *much*
faster, as previously we were computing bounds using all subglyph
outlines. Not anymore.
Before:
BM_Font/paint_glyph/Nupuram-Color.colrv1.ttf/ot 1.78 ms
After:
BM_Font/paint_glyph/Nupuram-Color.colrv1.ttf/ot 0.155 ms
2025-04-20 04:11:07 -06:00
jfkthame
2602f7292c
Avoid unannotated-fallthrough warning in COLR.hh
2025-04-17 11:56:46 -06:00
Behdad Esfahbod
9cae040bb4
[ItemVariationStore] Make cache atomic floats
...
Doesn't work with intrinsic atomic implementations. Disabled that.
Going through the C++11 atomics path now.
Will fix in next commit.
2025-04-03 22:18:14 -06:00
Behdad Esfahbod
7f5fafec0d
[GDEF] Simplify cache declaration
2025-04-01 21:35:28 -06:00
Qunxin Liu
5ebe36e1ac
[subset] bug fix for CaretValueFormat3
...
Don't return false in case of a Hinting Device table
2025-03-27 15:12:42 -06:00
Qunxin Liu
192d264ae7
[subset] remove divisions when computing the cost of binary search
2025-03-25 15:37:14 -06:00
Behdad Esfahbod
14e5a046c8
[font] Move synthetic glyph extents into font layer
...
So it applies to all font-funcs.
2025-03-16 01:02:55 -06:00
Behdad Esfahbod
000a0ad7a6
[paint] Add push_font_transform() / push_inverse_font_transform()
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/5146
2025-03-15 18:35:32 -06:00
Behdad Esfahbod
4807a021a1
[atomic] Kill hb_atomic_ptr_t<T>
...
Use hb_atomic_t<T *> instead.
2025-03-12 18:27:27 -06:00
Behdad Esfahbod
4e5358a288
[COLRv1] Fix comments
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/5116
2025-03-07 15:18:28 -07:00
Behdad Esfahbod
575e70b063
[COLR] Use palette 0 if palette index out of range
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/5112
2025-03-07 12:51:44 -07:00
Behdad Esfahbod
6506bd7e82
Merge pull request #4498 from harfbuzz/PaintColrLayers
...
[COLRv1] Optimize PaintColrLayers instead of PaintComposite
2025-03-06 20:00:54 -07:00
Behdad Esfahbod
50fe45f43c
[COLR] Fix memory leak
2025-03-03 16:31:41 -07:00
Behdad Esfahbod
9c6b6998ef
[VARC] Fix sign of returned extents
2025-03-03 11:48:17 -07:00
Behdad Esfahbod
e9134c8ce3
[COLR] Reduce malloc pressure
...
By caching paint-extents.
2025-03-03 02:18:49 -07:00
Behdad Esfahbod
9efd17e225
[COLR] Switch to using (existing) accelerator
2025-03-03 02:17:13 -07:00
Behdad Esfahbod
17ddc84406
[VARC] Fix scratch caching
2025-03-03 01:27:32 -07:00
Behdad Esfahbod
a62058eee8
[VARC] Separate varc scratch from glyf scratch
2025-03-03 01:19:52 -07:00
Behdad Esfahbod
3199d1c1f5
[VARC] Use a context object to pass arguments around
2025-03-02 18:35:46 -07:00
Behdad Esfahbod
e0c6c98025
[VARC] Implement get_extents()
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/5007
2025-03-02 16:56:20 -07:00
Behdad Esfahbod
7e3c96582f
[VARC] Reuse parent MultiVarStore cache if coords didn't change
...
Minor optimization; applicable to the test hangul font mostly.
2025-03-01 15:09:58 -07:00
Behdad Esfahbod
64dbeaf0f4
[glyf] Mover decycler to the scratch pad
2025-02-28 01:13:25 -07:00
Behdad Esfahbod
00541f1952
Merge pull request #4970 from harfbuzz/GVAR
...
Add `GVAR` table
2025-02-26 16:22:48 -07:00
Behdad Esfahbod
a0543453de
[CBDT] Change has_data() to be more accurate
...
get_length() was returning the Null table length if table
was not present.
2025-02-26 15:36:03 -07:00
Behdad Esfahbod
7504c67fb7
[CBDT] Return immediately if no data
2025-02-26 15:24:40 -07:00