mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 10:04:24 +01:00
[paint] Preserve void extents through transformations (#6548)
Honk paints an empty outline as one of its COLR layers. Transforming its void bounding box orders the sentinel corners into a real rectangle at (-1,-1)-(0,0), even with the identity transform. That rectangle expands the accent's ink bounds toward the origin and shifts fallback marks by hundreds of units. Keep void extents void when applying a transform. Add shaping regressions for normal and double scale and vertical layout using a default-instance Honk subset, with its OFL embedded in the name table. Current read-fonts already computes the correct COLR bounds. Removing only the empty layer also makes unpatched HarfBuzz match HarfRust, confirming the cause of harfrust#553. Update the existing vertical-origin overflow fixture to use an explicit COLR clip box. Assert that its height still clamps to INT_MIN so the original negation-overflow regression stays covered after void bounds stop producing artificial ink. Testing: meson test -C build (276 passed). Fixes: https://github.com/harfbuzz/harfrust/issues/553 Assisted-by: OpenAI Codex
This commit is contained in:
1 parent
a945625923
commit
e8a7f183fe
4 files changed
+28
-13
No files matched your search
+18
-13
@@ -219,28 +219,33 @@ test_ot_var_axis_on_zero_named_instance (void)
|
||||
static void
|
||||
test_ot_font_v_origin_extents_overflow (void)
|
||||
{
|
||||
/* A COLRv1 glyph with a clip box from y=-32768 to y=32767. At the
|
||||
* scale below, its height clamps to INT_MIN, exercising the overflow
|
||||
* guard without relying on bounds manufactured from an empty outline. */
|
||||
static const char data[] = {
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x43, 0x4f, 0x4c, 0x52, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x09,
|
||||
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
|
||||
0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x11, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0c,
|
||||
0x00, 0x00, 0x17, 0x00, 0x00, 0x02, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
(char) 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1d, 0x00,
|
||||
0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x04, 0x03, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x43, 0x4f, 0x4c, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
|
||||
0x00, 0x00, 0x00, 0x46, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
|
||||
0x02, (char) 0xff, (char) 0xff, 0x40, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, (char) 0x80, 0x00, 0x00, 0x01,
|
||||
0x7f, (char) 0xff
|
||||
};
|
||||
hb_blob_t *blob = hb_blob_create (data, sizeof (data), HB_MEMORY_MODE_READONLY,
|
||||
NULL, NULL);
|
||||
hb_face_t *face = hb_face_create (blob, 0);
|
||||
hb_face_set_upem (face, 1);
|
||||
hb_font_t *font = hb_font_create (face);
|
||||
hb_position_t x, y;
|
||||
|
||||
hb_font_set_scale (font, 12, 12);
|
||||
hb_font_set_scale (font, 65536, 65536);
|
||||
hb_glyph_extents_t extents;
|
||||
g_assert_true (hb_font_get_glyph_extents (font, 0, &extents));
|
||||
g_assert_cmpint (extents.height, ==, G_MININT);
|
||||
g_assert_true (hb_font_get_glyph_v_origin (font, 0, &x, &y));
|
||||
g_assert_cmpint (y, ==, -1073741719);
|
||||
g_assert_cmpint (y, ==, 1073709056);
|
||||
|
||||
hb_font_destroy (font);
|
||||
hb_face_destroy (face);
|
||||
|
||||
Reference in new issue
Block a user