Description
Functions for fetching color-font information from OpenType font faces.
HarfBuzz supports COLR
/CPAL
, sbix
, CBDT
, and SVG
color fonts.
Functions
HB_COLOR()
#define HB_COLOR(b,g,r,a) ((hb_color_t) HB_TAG ((b),(g),(r),(a)))
hb_color_get_alpha ()
uint8_t
hb_color_get_alpha (hb_color_t color
);
Returns
Alpha channel value of the given color
Since: 2.1.0
hb_color_get_blue ()
uint8_t
hb_color_get_blue (hb_color_t color
);
Returns
Blue channel value of the given color
Since: 2.1.0
hb_color_get_green ()
uint8_t
hb_color_get_green (hb_color_t color
);
Returns
Green channel value of the given color
Since: 2.1.0
hb_color_get_red ()
uint8_t
hb_color_get_red (hb_color_t color
);
Returns
Red channel value of the given color
Since: 2.1.0
hb_ot_color_glyph_get_layers ()
unsigned int
hb_ot_color_glyph_get_layers (hb_face_t *face
,
hb_codepoint_t glyph
,
unsigned int start_offset
,
unsigned int *layer_count
,
hb_ot_color_layer_t *layers
);
Fetches a list of all color layers for the specified glyph index in the specified
face. The list returned will begin at the offset provided.
Returns
Total number of layers available for the glyph index queried
Since: 2.1.0
hb_ot_color_glyph_reference_png ()
hb_blob_t *
hb_ot_color_glyph_reference_png (hb_font_t *font
,
hb_codepoint_t glyph
);
Fetches the PNG image for a glyph. This function takes a font object, not a face object,
as input. To get an optimally sized PNG blob, the UPEM value must be set on the font
object. If UPEM is unset, the blob returned will be the largest PNG available.
Returns
An hb_blob_t containing the PNG image for the glyph, if available.
[transfer full]
Since: 2.1.0
hb_ot_color_glyph_reference_svg ()
hb_blob_t *
hb_ot_color_glyph_reference_svg (hb_face_t *face
,
hb_codepoint_t glyph
);
Fetches the SVG document for a glyph. The blob may be either plain text or gzip-encoded.
Returns
An hb_blob_t containing the SVG document of the glyph, if available.
[transfer full]
Since: 2.1.0
hb_ot_color_has_layers ()
hb_bool_t
hb_ot_color_has_layers (hb_face_t *face
);
Tests whether a face includes any COLR
color layers.
Returns
true if data found, false otherwise
Since: 2.1.0
hb_ot_color_has_palettes ()
hb_bool_t
hb_ot_color_has_palettes (hb_face_t *face
);
Tests whether a face includes a CPAL
color-palette table.
Returns
true if data found, false otherwise
Since: 2.1.0
hb_ot_color_has_png ()
hb_bool_t
hb_ot_color_has_png (hb_face_t *face
);
Tests whether a face has PNG glyph images (either in CBDT
or sbix
tables).
Returns
true if data found, false otherwise
Since: 2.1.0
hb_ot_color_has_svg ()
hb_bool_t
hb_ot_color_has_svg (hb_face_t *face
);
Tests whether a face includes any SVG
glyph images.
Returns
true if data found, false otherwise.
Since: 2.1.0
hb_ot_color_palette_color_get_name_id ()
hb_ot_name_id_t
hb_ot_color_palette_color_get_name_id (hb_face_t *face
,
unsigned int color_index
);
Fetches the name
table Name ID that provides display names for
the specificed color in a face's CPAL
color palette.
Display names can be generic (e.g., "Background") or specific
(e.g., "Eye color").
Returns
the Name ID found for the color.
Since: 2.1.0
hb_ot_color_palette_get_colors ()
unsigned int
hb_ot_color_palette_get_colors (hb_face_t *face
,
unsigned int palette_index
,
unsigned int start_offset
,
unsigned int *color_count
,
hb_color_t *colors
);
Fetches a list of the colors in a color palette.
After calling this function, colors
will be filled with the palette
colors. If colors
is NULL, the function will just return the number
of total colors without storing any actual colors; this can be used
for allocating a buffer of suitable size before calling
hb_ot_color_palette_get_colors()
a second time.
Returns
the total number of colors in the palette
Since: 2.1.0
hb_ot_color_palette_get_count ()
unsigned int
hb_ot_color_palette_get_count (hb_face_t *face
);
Fetches the number of color palettes in a face.
Returns
the number of palettes found
Since: 2.1.0
hb_ot_color_palette_get_name_id ()
hb_ot_name_id_t
hb_ot_color_palette_get_name_id (hb_face_t *face
,
unsigned int palette_index
);
Fetches the name
table Name ID that provides display names for
a CPAL
color palette.
Palette display names can be generic (e.g., "Default") or provide
specific, themed names (e.g., "Spring", "Summer", "Fall", and "Winter").
Returns
the Named ID found for the palette.
If the requested palette has no name the result is HB_OT_NAME_ID_INVALID.
Since: 2.1.0