|
|
|
@ -29,9 +29,20 @@ |
|
|
|
|
|
|
|
|
|
#ifdef HB_HAS_FREETYPE |
|
|
|
|
#include <hb-ft.h> |
|
|
|
|
|
|
|
|
|
#if (FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) >= 21101 |
|
|
|
|
#define HAVE_FT_COLRv1 |
|
|
|
|
#include FT_COLOR_H |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
static inline hb_bool_t |
|
|
|
|
have_ft_colrv1 (void) |
|
|
|
|
{ |
|
|
|
|
#if (FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) >= 21101 |
|
|
|
|
// https://github.com/harfbuzz/harfbuzz/issues/4013
|
|
|
|
|
return sizeof (FT_ColorStop) == 8; |
|
|
|
|
#endif |
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* Unit tests for hb-paint.h */ |
|
|
|
@ -366,7 +377,7 @@ test_hb_paint (gconstpointer d, |
|
|
|
|
|
|
|
|
|
hb_font_set_synthetic_slant (font, test->slant); |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_FT_COLRv1 |
|
|
|
|
#ifdef HB_HAS_FREETYPE |
|
|
|
|
if (use_ft) |
|
|
|
|
hb_ft_font_set_funcs (font); |
|
|
|
|
#endif |
|
|
|
@ -479,7 +490,7 @@ test_compare_ot_ft (const char *file, hb_codepoint_t glyph) |
|
|
|
|
|
|
|
|
|
ot_str = data.string; |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_FT_COLRv1 |
|
|
|
|
#ifdef HB_HAS_FREETYPE |
|
|
|
|
hb_ft_font_set_funcs (font); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
@ -508,31 +519,28 @@ test_hb_paint_ot (gconstpointer data) |
|
|
|
|
static void |
|
|
|
|
test_hb_paint_ft (gconstpointer data) |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_FT_COLRv1 |
|
|
|
|
test_hb_paint (data, 1); |
|
|
|
|
#else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
#endif |
|
|
|
|
if (have_ft_colrv1 ()) |
|
|
|
|
test_hb_paint (data, 1); |
|
|
|
|
else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_compare_ot_ft_novf (gconstpointer d) |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_FT_COLRv1 |
|
|
|
|
test_compare_ot_ft (TEST_GLYPHS, GPOINTER_TO_UINT (d)); |
|
|
|
|
#else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
#endif |
|
|
|
|
if (have_ft_colrv1 ()) |
|
|
|
|
test_compare_ot_ft (TEST_GLYPHS, GPOINTER_TO_UINT (d)); |
|
|
|
|
else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_compare_ot_ft_vf (gconstpointer d) |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_FT_COLRv1 |
|
|
|
|
test_compare_ot_ft (TEST_GLYPHS_VF, GPOINTER_TO_UINT (d)); |
|
|
|
|
#else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
#endif |
|
|
|
|
if (have_ft_colrv1 ()) |
|
|
|
|
test_compare_ot_ft (TEST_GLYPHS_VF, GPOINTER_TO_UINT (d)); |
|
|
|
|
else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
@ -597,7 +605,7 @@ test_color_stops (hb_bool_t use_ft) |
|
|
|
|
face = hb_test_open_font_file (NOTO_HAND); |
|
|
|
|
font = hb_font_create (face); |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_FT_COLRv1 |
|
|
|
|
#ifdef HB_HAS_FREETYPE |
|
|
|
|
if (use_ft) |
|
|
|
|
hb_ft_font_set_funcs (font); |
|
|
|
|
#endif |
|
|
|
@ -623,11 +631,10 @@ test_color_stops_ot (void) |
|
|
|
|
static void |
|
|
|
|
test_color_stops_ft (void) |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_FT_COLRv1 |
|
|
|
|
test_color_stops (1); |
|
|
|
|
#else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
#endif |
|
|
|
|
if (have_ft_colrv1 ()) |
|
|
|
|
test_color_stops (1); |
|
|
|
|
else |
|
|
|
|
g_test_skip ("FreeType COLRv1 support not present"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int |
|
|
|
|