[color] Fix alpha channel value and adjust spaces

This commit is contained in:
Ebrahim Byagowi 2018-10-20 17:50:39 +03:30 committed by Khaled Hosny
parent 00e94ce24e
commit 687f679b80
3 changed files with 29 additions and 29 deletions

View File

@ -155,11 +155,11 @@ colr_cpal_rendering (hb_face_t *face, cairo_font_face_t *cairo_face)
uint32_t color = 0xFF; uint32_t color = 0xFF;
if (color_indices[layer] != 0xFFFF) if (color_indices[layer] != 0xFFFF)
color = colors[color_indices[layer]]; color = colors[color_indices[layer]];
int alpha = hb_ot_color_get_alpha (color); cairo_set_source_rgba (cr,
int r = hb_ot_color_get_red (color); hb_ot_color_get_red (color) / 255.,
int g = hb_ot_color_get_green (color); hb_ot_color_get_green (color) / 255.,
int b = hb_ot_color_get_blue (color); hb_ot_color_get_blue (color) / 255.,
cairo_set_source_rgba (cr, r / 255., g / 255., b / 255., alpha); hb_ot_color_get_alpha (color) / 255.);
cairo_glyph_t glyph; cairo_glyph_t glyph;
glyph.index = layer_gids[layer]; glyph.index = layer_gids[layer];
@ -281,12 +281,12 @@ main (int argc, char **argv)
FT_New_Face (library, argv[1], 0, &ftface); FT_New_Face (library, argv[1], 0, &ftface);
cairo_face = cairo_ft_font_face_create_for_ft_face (ftface, 0); cairo_face = cairo_ft_font_face_create_for_ft_face (ftface, 0);
} }
colr_cpal_rendering (face, cairo_face);
unsigned int num_glyphs = hb_face_get_glyph_count (face); unsigned int num_glyphs = hb_face_get_glyph_count (face);
unsigned int upem = hb_face_get_upem (face); unsigned int upem = hb_face_get_upem (face);
colr_cpal_rendering (face, cairo_face);
dump_glyphs (cairo_face, upem, num_glyphs); dump_glyphs (cairo_face, upem, num_glyphs);
hb_font_destroy (font); hb_font_destroy (font);
hb_face_destroy (face); hb_face_destroy (face);
hb_blob_destroy (blob); hb_blob_destroy (blob);

View File

@ -99,7 +99,7 @@ hb_ot_color_get_palette_count (hb_face_t *face)
* the result is 0xFFFF. The implementation does not check whether * the result is 0xFFFF. The implementation does not check whether
* the returned palette name id is actually in @face's `name` table. * the returned palette name id is actually in @face's `name` table.
* *
* Since: REPLACEME * Since: DONTREPLACEME
*/ */
unsigned int unsigned int
hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette) hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette)
@ -118,7 +118,7 @@ hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette)
* or if @palette is not between 0 and hb_ot_color_get_palette_count(), * or if @palette is not between 0 and hb_ot_color_get_palette_count(),
* the result is #HB_OT_COLOR_PALETTE_FLAG_DEFAULT. * the result is #HB_OT_COLOR_PALETTE_FLAG_DEFAULT.
* *
* Since: REPLACEME * Since: DONTREPLACEME
*/ */
hb_ot_color_palette_flags_t hb_ot_color_palette_flags_t
hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette) hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette)