From 92f0aa24f94c07ca69a7c49e19cd3d1a0847a1b3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 14 Sep 2026 15:30:54 -0600 Subject: [PATCH] [test] Cover static VARC axes without fvar (#6260) Verify that VARC component coordinates can address axes retained in gvar when a static font has no fvar table. Tested with the full Meson test suite. Assisted-by: Codex --- test/api/fonts/varc-static-gvar.ttf | Bin 0 -> 1012 bytes test/api/test-draw-varc.c | 27 ++++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/api/fonts/varc-static-gvar.ttf diff --git a/test/api/fonts/varc-static-gvar.ttf b/test/api/fonts/varc-static-gvar.ttf new file mode 100644 index 0000000000000000000000000000000000000000..649c2961c766bfd92c2a32e17c5b9b66649ba51a GIT binary patch literal 1012 zcmah{&r4KM6#nkJ&&ipjphQ|oyu!pq8j6%c(M%T9B7zYdcX{=_-W!<7VVW6rH&E1e zaM7Ywn;>cvLH|KiNJRKIh_q;Fs}`^C{y-n4bRO^AbH00i-va?)09{BF@6BJDDlL{? z0OB^$rG-*?uJHN%5+Hljr&sE#LE8_!f2Z}hw((#q+KQ?@`UnN{+AO1{(G@Wd!PD9Qg5w`JxUO-$@*)nD+cK-* zkEUloy#l;5#O^j$AGL4?x0o;C{TOsF{5QATzwe*C`U_J2AcEa*g~jYCdM2xcr%@7p zWRT8K(A9*ZXCj#^$Am#7r=)YR0EZtOQtZ*M54yAek&WT3u9GM#EFb9>xXP@7&Mo;5 zx@rcQlNRK@sctzOhx8k|;7km{nC2|kPsM!uA zPUDo5{fwL=dcnm7a=4-^_47oAaLvgcPGH{25~J+j+V~kchY>upI1>)wt=`C>9CfPE zS~-f_HPy@@yx51V&A3A #include +#include typedef struct draw_data_t { @@ -34,6 +35,7 @@ typedef struct draw_data_t unsigned quad_to_count; unsigned cubic_to_count; unsigned close_path_count; + float first_move_x; } draw_data_t; typedef struct budget_draw_data_t @@ -107,10 +109,12 @@ test_itoa (void) static void move_to (HB_UNUSED hb_draw_funcs_t *dfuncs, void *draw_data_, HB_UNUSED hb_draw_state_t *st, - HB_UNUSED float to_x, HB_UNUSED float to_y, + float to_x, HB_UNUSED float to_y, HB_UNUSED void *user_data) { draw_data_t *draw_data = (draw_data_t *) draw_data_; + if (!draw_data->move_to_count) + draw_data->first_move_x = to_x; draw_data->move_to_count++; } @@ -280,6 +284,26 @@ test_hb_draw_varc_conditional (void) hb_font_destroy (font); } +static void +test_hb_draw_varc_static_gvar (void) +{ + hb_face_t *face = hb_test_open_font_file ("fonts/varc-static-gvar.ttf"); + g_assert_cmpuint (hb_ot_var_get_axis_count (face), ==, 0); + hb_font_t *font = hb_font_create (face); + hb_face_destroy (face); + + hb_codepoint_t gid = 0; + g_assert_true (hb_font_get_nominal_glyph (font, 'a', &gid)); + + draw_data_t draw_data = {0}; + hb_font_draw_glyph (font, gid, funcs, &draw_data); + g_assert_cmpuint (draw_data.move_to_count, ==, 1); + g_assert_cmpuint (draw_data.line_to_count, ==, 3); + g_assert_cmpfloat (draw_data.first_move_x, ==, 50.f); + + hb_font_destroy (font); +} + static void test_hb_draw_varc_budget (void) { @@ -336,6 +360,7 @@ main (int argc, char **argv) hb_test_add (test_hb_draw_varc_simple_hangul); hb_test_add (test_hb_draw_varc_simple_hanzi); hb_test_add (test_hb_draw_varc_conditional); + hb_test_add (test_hb_draw_varc_static_gvar); hb_test_add (test_hb_draw_varc_budget); #endif unsigned result = hb_test_run ();