Commit graph

17982 commits

Author SHA1 Message Date
Khaled Hosny
f012442f98 Annotate printf functions with gnu_printf format under MingW
Fixes https://github.com/harfbuzz/harfbuzz/issues/5080
2025-02-20 21:53:14 +02:00
Khaled Hosny
a8fd29718a [directwrite] Add hb_directwrite_font_create()/font_get_font()
Uses hb_directwrite_face_create() under the hood, but copies variations
from directwrite to hb-font.
2025-02-20 21:40:27 +02:00
Behdad Esfahbod
7cf634290f [ot-layout] Use a variable
Doesn't make a diff in the generated code I believe,
but is nice.
2025-02-20 12:23:57 -07:00
Khaled Hosny
e28bcf58b1 Typo [ci skip] 2025-02-20 20:58:50 +02:00
Behdad Esfahbod
a2ea5d28cb [benchmark-font] Report draw times in ms, not us 2025-02-18 21:43:39 -07:00
Behdad Esfahbod
2032da0117 [ot-font] Centralize painting an outline glyph 2025-02-18 20:54:56 -07:00
Behdad Esfahbod
01f02f55a1 [COLR] Optimize NoVariation codepath 2025-02-18 20:28:48 -07:00
Behdad Esfahbod
4c263ecd00
Merge pull request #5074 from harfbuzz/tortoise-hare
[decycler] Implement an efficient graph cycle detector
2025-02-18 20:08:19 -07:00
Behdad Esfahbod
f26d9514b1 [COLR] Fix HB_LEAN build 2025-02-18 20:07:25 -07:00
Behdad Esfahbod
0bb72eeed0 [decycler] Turn off compiler warning
../src/OT/Var/VARC/../../../hb-decycler.hh:108:25: warning: storing the address of local variable ‘node’ in ‘*&c_15(D)->layers_decycler.hb_decycler_t::tortoise’ [-Wdangling-pointer=]
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
c84e9b95be [decycler] Change value type from unsigned to uintptr_t
Since the node struct is gonna be 3*sizeof(void*) bytes anyway,
change value type to use the full space available.
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
1c18646dd6 [decycler] Reduce stack use, kinda
Move the bool to the decycler from the node. The value can now become
a full pointer size (next commit).
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
fb0e181a3e [decycler] Reduce stack use further
Down to three pointers. Exercise for the reader to prove this is
optimal.
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
646da80c41 [decycler] Reduce stack use
Down from 5 pointers to 4.
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
5aea89b5c4 [decycler] Don't leave a dangling pointer around
Even if it was never accessed.
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
c7fc03a33a [ft-colr] Use hb_decycler_t 2025-02-18 20:02:56 -07:00
Behdad Esfahbod
bedc8d9373 [decycler] Document algorithm 2025-02-18 20:02:56 -07:00
Behdad Esfahbod
2bdf985022 [decycler] Add alternative way of using it to tests 2025-02-18 20:02:56 -07:00
Behdad Esfahbod
3cb4971729 [decycler] Add some documentation 2025-02-18 20:02:56 -07:00
Behdad Esfahbod
0667ceae87 [VARC] Reduce stack use 2025-02-18 20:02:56 -07:00
Behdad Esfahbod
4335e49a02 [VARC] Port to hb-decycler-t
5% faster on varc-hanzi test case.
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
a0f83e783f [decycler] Reduce stack use
48bytes -> 40bytes per node.
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
d5faabe7ea [decycler] Add test 2025-02-18 20:02:56 -07:00
Behdad Esfahbod
0aa400b1d8 [decycler] Implement an efficient graph cycle detector
This is an algorithm I came up with, based on the Floyd's
Tortoise-Hare constant-memory linear-time linked-list cycle-detection
algorithm.

https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare

It is linear-time and malloc-free. It *eventually* detects cycles,
not immediately.

The main different with Floyd's algorithm is that this algorithm
detects cycles when one is traversing down a graph, not just a
linked list.

Our existing cycle-detection algorithms use a set-of-integers,
either hb_set_t, or more efficient in this case, hb_map_t. Those
include at least one malloc, and as such show up on profiles.

Port hb-ot-font COLRv1 to use the decycler instead of previous
hb_map_t usage for cycle detection.

benchmark-font paint_glyph on NotoColorEmoji-Regular.ttf:
Before: 8ms; After: 5.5ms. No cycle detection: 5.5ms.

FT COLRv1 API is so slow (174ms) it's not worth porting to this.
Other graphs (VARC, etc) to be ported.

Test and documentation to be added.
2025-02-18 20:02:56 -07:00
Behdad Esfahbod
ed76c8559e [COLR] Optimize palette access 2025-02-18 20:01:36 -07:00
Behdad Esfahbod
016e78b683 [COLR] Micro-optimize 2025-02-18 19:49:48 -07:00
Behdad Esfahbod
e6eec3cc14 [test] Silence compiler warning 2025-02-18 00:48:49 -07:00
Jim-Wang
b97ef6c702 add dep 2025-02-16 09:29:28 +02:00
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
ff3aaece6d [test/shape-plan] Add another test and some comments 2025-02-14 21:54:30 +02: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
8c561733b6 [test/coretext] Add a test for copying variations 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
Khaled Hosny
33b3177157 [ci] Stop generating test coverage data
It is failing on Linux CI after upgrading to Ubuntu 24.04, and macOS
upload to codecov was also silently failing for a while now. We don’t do
much with the coverage data anyway.
2025-02-12 13:52:39 +02:00
Khaled Hosny
d46c0ca223 [ci] Don’t use system Python on Linux
We are already installing one using actions/setup-python.
2025-02-12 13:52:39 +02:00
Khaled Hosny
467b08ba36 [ci] Update Ubuntu 20.04 images to 24.04
GitHub actions will start failing jobs using Ubuntu 20.04 images, so
switch to 24.04. Switch also on CircleCI while at it.
2025-02-12 13:52:39 +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
dependabot[bot]
8f1c31c09c Bump hendrikmuhs/ccache-action from 1.2.16 to 1.2.17
Bumps [hendrikmuhs/ccache-action](https://github.com/hendrikmuhs/ccache-action) from 1.2.16 to 1.2.17.
- [Release notes](https://github.com/hendrikmuhs/ccache-action/releases)
- [Commits](5391144220...a1209f81af)

---
updated-dependencies:
- dependency-name: hendrikmuhs/ccache-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 11:17:25 +00:00
dependabot[bot]
11b714187b Bump github/codeql-action from 3.28.8 to 3.28.9
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.8 to 3.28.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](dd746615b3...9e8d0789d4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 11:16:21 +00:00
dependabot[bot]
63cee529c2 Bump fonttools from 4.55.8 to 4.56.0 in /.ci
Bumps [fonttools](https://github.com/fonttools/fonttools) from 4.55.8 to 4.56.0.
- [Release notes](https://github.com/fonttools/fonttools/releases)
- [Changelog](https://github.com/fonttools/fonttools/blob/main/NEWS.rst)
- [Commits](https://github.com/fonttools/fonttools/compare/4.55.8...4.56.0)

---
updated-dependencies:
- dependency-name: fonttools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 10:29:02 +00:00