Add chromacheck Emoji test fonts and minor preparations (#1294)
This commit is contained in:
parent
b92b9d7e52
commit
d440c8d3fb
|
@ -26,8 +26,11 @@
|
|||
*/
|
||||
|
||||
#include "hb-open-type.hh"
|
||||
#include "hb-ot-color-cbdt-table.hh"
|
||||
#include "hb-ot-color-colr-table.hh"
|
||||
#include "hb-ot-color-cpal-table.hh"
|
||||
#include "hb-ot-color-sbix-table.hh"
|
||||
#include "hb-ot-color-svg-table.hh"
|
||||
#include "hb-ot-face.hh"
|
||||
#include "hb-ot.h"
|
||||
|
||||
|
@ -51,6 +54,29 @@ _get_cpal (hb_face_t *face)
|
|||
return *(hb_ot_face_data (face)->CPAL.get ());
|
||||
}
|
||||
|
||||
#if 0
|
||||
static inline const OT::CBDT_accelerator_t&
|
||||
_get_cbdt (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CBDT_accelerator_t);
|
||||
return *(hb_ot_face_data (face)->CBDT.get ());
|
||||
}
|
||||
|
||||
static inline const OT::sbix&
|
||||
_get_sbix (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::sbix);
|
||||
return *(hb_ot_face_data (face)->sbix.get ());
|
||||
}
|
||||
|
||||
static inline const OT::SVG&
|
||||
_get_svg (hb_face_t *face)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::SVG);
|
||||
return *(hb_ot_face_data (face)->SVG.get ());
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* hb_ot_color_has_cpal_data:
|
||||
* @face: a font face.
|
||||
|
|
|
@ -47,9 +47,6 @@
|
|||
/* OpenType shaping. */ \
|
||||
HB_OT_TABLE(OT, JSTF) \
|
||||
HB_OT_TABLE(OT, BASE) \
|
||||
/* OpenType color */ \
|
||||
HB_OT_TABLE(OT, COLR) \
|
||||
HB_OT_TABLE(OT, CPAL) \
|
||||
/* AAT shaping. */ \
|
||||
HB_OT_TABLE(AAT, morx) \
|
||||
HB_OT_TABLE(AAT, kerx) \
|
||||
|
@ -71,7 +68,12 @@
|
|||
HB_OT_ACCELERATOR(OT, post) \
|
||||
HB_OT_ACCELERATOR(OT, kern) \
|
||||
HB_OT_ACCELERATOR(OT, glyf) \
|
||||
/* OpenType color fonts. */ \
|
||||
HB_OT_TABLE(OT, COLR) \
|
||||
HB_OT_TABLE(OT, CPAL) \
|
||||
HB_OT_ACCELERATOR(OT, CBDT) \
|
||||
HB_OT_TABLE(OT, sbix) \
|
||||
HB_OT_TABLE(OT, SVG) \
|
||||
/* */
|
||||
|
||||
/* Declare tables. */
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
cmap-format12-only files created by ttx & remove all other cmap entries
|
||||
|
||||
Inconsolata-Regular.abc.widerc.ttf has the hmtx width of "c" set to 600; everything else is 500. Subsetting out c should reduce numberOfHMetrics to 1.
|
||||
|
||||
chromacheck-* fonts are from https://github.com/RoelN/ChromaCheck/tree/master/fonts and licensed under MIT by Roel Nieskens and Google.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -288,7 +288,7 @@ hb_test_open_font_file (const char *font_path)
|
|||
|
||||
hb_blob_t *blob = hb_blob_create_from_file (path);
|
||||
if (hb_blob_get_length (blob) == 0)
|
||||
g_error ("Font not found.");
|
||||
g_error ("Font %s not found.", path);
|
||||
|
||||
hb_face_t *face = hb_face_create (blob, 0);
|
||||
hb_blob_destroy (blob);
|
||||
|
|
|
@ -99,6 +99,11 @@ static hb_face_t *cpal_v0 = NULL;
|
|||
*/
|
||||
static hb_face_t *cpal_v1 = NULL;
|
||||
|
||||
static hb_face_t *cpal = NULL;
|
||||
static hb_face_t *cbdt = NULL;
|
||||
static hb_face_t *sbix = NULL;
|
||||
static hb_face_t *svg = NULL;
|
||||
|
||||
#define assert_color_rgba(colors, i, r, g, b, a) G_STMT_START { \
|
||||
const hb_color_t *_colors = (colors); \
|
||||
const size_t _i = (i); \
|
||||
|
@ -352,10 +357,18 @@ test_hb_ot_color_has_data (void)
|
|||
g_assert (hb_ot_color_has_colr_data (empty) == FALSE);
|
||||
g_assert (hb_ot_color_has_colr_data (cpal_v0) == TRUE);
|
||||
g_assert (hb_ot_color_has_colr_data (cpal_v1) == TRUE);
|
||||
g_assert (hb_ot_color_has_colr_data (cpal) == TRUE);
|
||||
g_assert (hb_ot_color_has_colr_data (cbdt) == FALSE);
|
||||
g_assert (hb_ot_color_has_colr_data (sbix) == FALSE);
|
||||
g_assert (hb_ot_color_has_colr_data (svg) == FALSE);
|
||||
|
||||
g_assert (hb_ot_color_has_cpal_data (empty) == FALSE);
|
||||
g_assert (hb_ot_color_has_cpal_data (cpal_v0) == TRUE);
|
||||
g_assert (hb_ot_color_has_cpal_data (cpal_v1) == TRUE);
|
||||
g_assert (hb_ot_color_has_cpal_data (cpal) == TRUE);
|
||||
g_assert (hb_ot_color_has_cpal_data (cbdt) == FALSE);
|
||||
g_assert (hb_ot_color_has_cpal_data (sbix) == FALSE);
|
||||
g_assert (hb_ot_color_has_cpal_data (svg) == FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -366,6 +379,10 @@ main (int argc, char **argv)
|
|||
hb_test_init (&argc, &argv);
|
||||
cpal_v0 = hb_test_open_font_file ("fonts/cpal-v0.ttf");
|
||||
cpal_v1 = hb_test_open_font_file ("fonts/cpal-v1.ttf");
|
||||
cpal = hb_test_open_font_file ("fonts/chromacheck-colr.ttf");
|
||||
cbdt = hb_test_open_font_file ("fonts/chromacheck-cbdt.ttf");
|
||||
sbix = hb_test_open_font_file ("fonts/chromacheck-sbix.ttf");
|
||||
svg = hb_test_open_font_file ("fonts/chromacheck-svg.ttf");
|
||||
hb_test_add (test_hb_ot_color_get_palette_count);
|
||||
hb_test_add (test_hb_ot_color_get_palette_name_id_empty);
|
||||
hb_test_add (test_hb_ot_color_get_palette_name_id_v0);
|
||||
|
@ -382,5 +399,9 @@ main (int argc, char **argv)
|
|||
status = hb_test_run();
|
||||
hb_face_destroy (cpal_v0);
|
||||
hb_face_destroy (cpal_v1);
|
||||
hb_face_destroy (cpal);
|
||||
hb_face_destroy (cbdt);
|
||||
hb_face_destroy (sbix);
|
||||
hb_face_destroy (svg);
|
||||
return status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue