Commit Graph
49 Commits
Author SHA1 Message Date
Behdad Esfahbod 15a523bd87 [CFF] Test nested outline budget charges
Exercise CFF work accounting through the public draw-budget callbacks.
Use lower bounds above each parent charstring's flat operator cost so the
CFF1 assertion covers both seac children and the CFF2 assertion covers
proportional blend work.

Keep the interpreter's local cost type consistent with the unsigned spend
interface.

Tests: meson test -C build (275/275 passed)

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-26 17:54:45 -06:00
Behdad Esfahbod a38e2831c0 [draw] Forward budgets through synthetic outlines
Synthetic slant and emboldening first render into an outline recorder.
That adapter previously hid the renderer's live budget, allowing the
underlying outline traversal to use a fresh per-glyph allowance.

Forward the destination draw data's remaining-budget pointer through
the recorder.  Add a regression test proving an exhausted synthetic
draw fails against the caller's budget.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-26 17:42:23 -06:00
Behdad Esfahbod 472c3e0fd3 [draw] Add rendering work-budget API
Expose budget policy and remaining-work callbacks on draw and paint function
objects.  The public setters clamp invalid negative caps, distinguish finite
defaults from explicit unlimited operation, and report whether a backend
participates in accounting.

Let draw sessions borrow the live counter owned by draw_data.  OpenType glyf
and CFF traversal then debit the same counter in place, while unsupported
backends retain a finite per-glyph fallback.  Forward budget access through
the parent-font draw adaptor.

Document the new API and cover nil, default, unlimited, clamped, concrete,
and live-depletion behavior.

Tests: meson test -C build (272/272 passed)

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-26 17:11:21 -06:00
Behdad Esfahbod 204cc5bcae Merge branch 'main' into HVF 2025-04-07 14:11:11 -06:00
Behdad Esfahbod b43901151f [test-draw] Make ubsan happy 2025-04-06 17:28:03 -06:00
Behdad Esfahbod 6b2563fff1 Merge branch 'main' into HVF 2025-04-06 15:05:25 -06:00
Behdad Esfahbod 155e1e633b [test/api] Use g_assert_true instead of g_assert
The latter terminates the program. The former marks the test
as failing.
2025-04-06 03:49:15 -06:00
Behdad Esfahbod 09014befab Merge branch 'main' into HVF 2025-03-12 15:41:39 -06:00
Behdad Esfahbod d247c116fb [test-draw] Test all font funcs 2025-03-11 00:15:40 -06:00
Behdad Esfahbod a0419a89d6 Merge branch 'main' into HVF 2025-03-09 05:55:10 -06:00
Behdad Esfahbod 712a403bec [font-funcs-using] Apply review feedback 2025-03-08 12:23:41 -07:00
Behdad Esfahbod 2a878b1b76 [font-funcs] Add two new API
+ hb_font_set_funcs_using()
+ hb_font_list_funcs()

Part of https://github.com/harfbuzz/harfbuzz/issues/5117
2025-03-08 11:50:53 -07:00
Khaled Hosny aecc9110a3 [fontations/test] Add to test-draw 2025-03-06 04:23:24 +02:00
Behdad Esfahbod d7b15b0e21 [font/fvar/avar] Increase axis coordinate normalization precision
Spec requires 16.16; we were doing 2.14. Fix up.
Now we do math in float, but do the 16.16 and final 2.14 rounding
as required by the spec.
2025-03-02 17:00:17 -07:00
Behdad Esfahbod 9456f6bdfa [test] Fix a few compiler warnings 2024-06-02 10:32:07 -06:00
Behdad Esfahbod e886b6b8a6 [test-draw] Use a larger scale
A scale of 20 is in the noise category for us. Using a larger
scale makes the test pass.
2023-01-09 10:31:28 -07:00
Matthias Clasen 347910fd4c Add a draw test
This test compares output between ft and ot
font funcs.
2023-01-09 10:31:28 -07:00
Behdad Esfahbod 3c972867b9 More s/hb_font_get_glyph_shape/hb_font_draw_glyph/ 2022-12-23 13:37:59 -07:00
Behdad Esfahbod d3308f4713 [font] Optimize font scaling further 2022-06-27 11:28:57 -06:00
Behdad Esfahbod 556e7078f0 [font] Optimize glyph scaling 2022-06-26 17:48:43 -06:00
Ebrahim Byagowi 6b75a30a73 [draw/test] Swap a freetype test case with a simpler one
As CI failure, apparently the my local freetype and CI one have different
result so let's switch the case with a simpler one just to test quadratic command
is emitted correctly.
2022-02-14 01:54:33 +03:30
Behdad Esfahbod ae223764a3 [test/draw] Typo 2022-02-13 15:39:14 -06:00
Ebrahim Byagowi 0429921c10 [draw/test] Add test for freetype callback
Let's have that part of the code also covered.
2022-02-14 00:18:13 +03:30
Ebrahim Byagowi d4588204e5 [draw/glyf] Emit empty contours
This makes it actually match freetype behaviour even though rasterizer
should filter such contours specially for stroking.

See https://github.com/harfbuzz/harfbuzz/pull/3411#discussion_r802283827 for the context.
2022-02-13 23:50:53 +03:30
Khaled Hosny 0e357c504c [draw] Test scaling subfont differently from parent 2022-02-13 13:21:15 -06:00
Khaled Hosny aca80a4a40 [draw] Add test for applying synthetic slant 2022-02-13 13:21:15 -06:00
Khaled Hosny 052fd2d8b9 [draw] Add test for hb_draw_move_to() etc 2022-02-13 13:21:15 -06:00
Behdad Esfahbod f1a9a9ccaf [draw-state] Pass state down to callbacks 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 9f05362d43 [test-draw] Fix compiler warning 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 1740916ede [draw] Remove check for no-op
This is unnecessary overhead. Up to rasterizers to handle this.  Plus,
this throws off point-numbers in uses that rely on it.

Disabled one test that broke with this.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 5610fa1da0 [test-draw] Re-enable two disabled tests 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 8b4f429000 [draw] Virtualize hb_font_draw_glyph() into hb_font_get_glyph_shape()
To be implemented in hb-ft.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 2bed4f46fb [draw] Fix draw signatures 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 5207ce828a [draw] Enable draw tests
Disable two failing ones.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 157caf254e [test-draw] Fix compiler warning 2022-02-13 13:21:14 -06:00
justvanrossum 1551f3d518 fixing more expected test results 2021-02-19 16:53:21 -07:00
Ebrahim Byagowi 831b090001 rebase draw test as recent roundf changes 2020-06-28 14:31:21 +04:30
Ebrahim Byagowi 755a77d660 Move outline draw API behind HB_EXPERIMENTAL_API directive 2020-03-13 08:25:53 +03:30
Ebrahim Byagowi 44169f3396 [draw] Fix invalid rendering of some glyph on Estedad-VF
Basically reverts 11f3fca so I can do the same tested and better later

Fixes #2215
2020-02-29 16:04:03 +03:30
Ebrahim Byagowi 84163c83d3 [draw] Skip commands and paths not contributing anything
They aren't contributing to rendering and making issue for stroking, let's skip them
ourselves as Skia does also https://skia-review.googlesource.com/c/skia/+/268166

They are useful for extracting extents and so which that functionality won't be effected by this change.
2020-02-26 16:09:28 +03:30
Ebrahim Byagowi 0cf050a7b1 [draw] Merge consequent move-to commands of CFF/CFF2 2020-02-23 23:23:50 +03:30
Ebrahim Byagowi 86bd5a0ba1 [draw] End CFF paths with a line-to
Issue a line-to command when start and end point of a path isn't same, matches freetype also.
2020-02-23 23:23:50 +03:30
Ebrahim Byagowi 60f8f384f9 [glyf] Switch to ttf-parser's glyf to path algorithm
It consumes each point at a time and doesn't need to know contour size before hand
2020-02-18 00:49:09 +03:30
Ebrahim Byagowi b4d3bf1d8a [draw] Add hb_draw_funcs_is_immutable and hb_draw_funcs_make_immutable 2020-02-06 11:52:32 +03:30
Ebrahim Byagowi 63b8190db8 [test] minor
Remained from previous naming.
2020-02-06 11:38:35 +03:30
Ebrahim Byagowi 3a98c7fae1 [glyf] Skip empty contours
As https://savannah.nongnu.org/bugs/index.php?57701
2020-02-06 11:35:48 +03:30
Ebrahim Byagowi d106900bfd [draw][glyf] Implement quadratic to cubic call translation 2020-01-28 15:27:27 +03:30
Ebrahim Byagowi 74fdcdcac8 [draw] Rename conic_to to quadratic_to 2020-01-28 13:45:22 +03:30
Ebrahim Byagowi ac81e94016 Rename hb_outline_decompose to hb_font_draw_glyph and hb_outline_decompose_funcs_t to hb_draw_funcs_t 2020-01-28 13:24:49 +03:30