summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEbrahim Byagowi <ebrahim@gnu.org>2018-10-20 17:50:39 +0330
committerKhaled Hosny <khaledhosny@eglug.org>2018-10-21 13:19:32 +0200
commitf487315880b38c972dbeaaaeca6576942c49d3f2 (patch)
treeebd5164bc773b48cb2191f543f20db445d8b84e3
parent7fbd85d3f43f7d4c5fafd0907570cf16815fa9f3 (diff)
downloadharfbuzz-f487315880b38c972dbeaaaeca6576942c49d3f2.tar.gz
[color] Fix alpha channel value and adjust spaces
-rw-r--r--src/dump-emoji.cc36
-rw-r--r--src/hb-buffer-serialize.cc14
-rw-r--r--src/hb-ot-color.cc10
3 files changed, 30 insertions, 30 deletions
diff --git a/src/dump-emoji.cc b/src/dump-emoji.cc
index 6fd84d4a..e28688da 100644
--- a/src/dump-emoji.cc
+++ b/src/dump-emoji.cc
@@ -131,14 +131,14 @@ colr_cpal_rendering (hb_face_t *face, cairo_font_face_t *cairo_face)
for (unsigned int pallet = 0; pallet < pallet_count; ++pallet) {
char output_path[255];
- unsigned int num_colors = hb_ot_color_get_palette_colors (face, pallet, 0, nullptr, nullptr);
- if (!num_colors)
- continue;
-
- hb_ot_color_t *colors = (hb_ot_color_t*) calloc (num_colors, sizeof (hb_ot_color_t));
- hb_ot_color_get_palette_colors (face, pallet, 0, &num_colors, colors);
- if (num_colors)
- {
+ unsigned int num_colors = hb_ot_color_get_palette_colors (face, pallet, 0, nullptr, nullptr);
+ if (!num_colors)
+ continue;
+
+ hb_ot_color_t *colors = (hb_ot_color_t*) calloc (num_colors, sizeof (hb_ot_color_t));
+ hb_ot_color_get_palette_colors (face, pallet, 0, &num_colors, colors);
+ if (num_colors)
+ {
// If we have more than one pallet, use a better namin
if (pallet_count == 1)
sprintf (output_path, "out/colr-%d.svg", gid);
@@ -153,13 +153,13 @@ colr_cpal_rendering (hb_face_t *face, cairo_font_face_t *cairo_face)
for (unsigned int layer = 0; layer < num_layers; ++layer)
{
uint32_t color = 0xFF;
- if (color_indices[layer] != 0xFFFF)
+ if (color_indices[layer] != 0xFFFF)
color = colors[color_indices[layer]];
- int alpha = hb_ot_color_get_alpha (color);
- int r = hb_ot_color_get_red (color);
- int g = hb_ot_color_get_green (color);
- int b = hb_ot_color_get_blue (color);
- cairo_set_source_rgba (cr, r / 255., g / 255., b / 255., alpha);
+ cairo_set_source_rgba (cr,
+ hb_ot_color_get_red (color) / 255.,
+ hb_ot_color_get_green (color) / 255.,
+ hb_ot_color_get_blue (color) / 255.,
+ hb_ot_color_get_alpha (color) / 255.);
cairo_glyph_t glyph;
glyph.index = layer_gids[layer];
@@ -170,8 +170,8 @@ colr_cpal_rendering (hb_face_t *face, cairo_font_face_t *cairo_face)
cairo_surface_destroy (surface);
cairo_destroy (cr);
- }
- free (colors);
+ }
+ free (colors);
}
}
@@ -281,12 +281,12 @@ main (int argc, char **argv)
FT_New_Face (library, argv[1], 0, &ftface);
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 upem = hb_face_get_upem (face);
- colr_cpal_rendering (face, cairo_face);
dump_glyphs (cairo_face, upem, num_glyphs);
-
hb_font_destroy (font);
hb_face_destroy (face);
hb_blob_destroy (blob);
diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc
index c1d82ab8..1bd603d4 100644
--- a/src/hb-buffer-serialize.cc
+++ b/src/hb-buffer-serialize.cc
@@ -58,7 +58,7 @@ hb_buffer_serialize_list_formats (void)
* @str is a valid buffer serialization format, use
* hb_buffer_serialize_list_formats() to get the list of supported formats.
*
- * Return value:
+ * Return value:
* The parsed #hb_buffer_serialize_format_t.
*
* Since: 0.9.7
@@ -319,7 +319,7 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
* ## json
* TODO.
*
- * Return value:
+ * Return value:
* The number of serialized items.
*
* Since: 0.9.7
@@ -425,14 +425,14 @@ parse_int (const char *pp, const char *end, int32_t *pv)
* hb_buffer_deserialize_glyphs:
* @buffer: an #hb_buffer_t buffer.
* @buf: (array length=buf_len):
- * @buf_len:
+ * @buf_len:
* @end_ptr: (out):
- * @font:
- * @format:
+ * @font:
+ * @format:
*
- *
*
- * Return value:
+ *
+ * Return value:
*
* Since: 0.9.7
**/
diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc
index 8a463d29..3a118e3e 100644
--- a/src/hb-ot-color.cc
+++ b/src/hb-ot-color.cc
@@ -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 returned palette name id is actually in @face's `name` table.
*
- * Since: REPLACEME
+ * Since: DONTREPLACEME
*/
unsigned int
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(),
* the result is #HB_OT_COLOR_PALETTE_FLAG_DEFAULT.
*
- * Since: REPLACEME
+ * Since: DONTREPLACEME
*/
hb_ot_color_palette_flags_t
hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette)
@@ -158,10 +158,10 @@ hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette)
*/
unsigned int
hb_ot_color_get_palette_colors (hb_face_t *face,
- unsigned int palette, /* default=0 */
+ unsigned int palette, /* default=0 */
unsigned int start_offset,
- unsigned int *count /* IN/OUT */,
- hb_ot_color_t *colors /* OUT */)
+ unsigned int *count /* IN/OUT */,
+ hb_ot_color_t *colors /* OUT */)
{
const OT::CPAL& cpal = _get_cpal(face);
if (unlikely (palette >= cpal.get_palette_count ()))