[draw] Remove return value of hb_font_draw_glyph()

This commit is contained in:
Behdad Esfahbod 2022-02-02 16:16:57 -06:00
parent ddc36df332
commit e157b50345
3 changed files with 14 additions and 15 deletions

View File

@ -42,23 +42,22 @@
* Returns: Whether the font had the glyph and the operation completed successfully.
* Since: REPLACEME
**/
hb_bool_t
hb_font_draw_glyph (hb_font_t *font, hb_codepoint_t glyph,
void
hb_font_draw_glyph (hb_font_t *font,
hb_codepoint_t glyph,
const hb_draw_funcs_t *funcs,
void *user_data)
{
if (unlikely (funcs == &Null (hb_draw_funcs_t) ||
glyph >= font->face->get_num_glyphs ()))
return false;
return;
draw_helper_t draw_helper (funcs, user_data);
if (font->face->table.glyf->get_path (font, glyph, draw_helper)) return true;
if (font->face->table.glyf->get_path (font, glyph, draw_helper)) return;
#ifndef HB_NO_CFF
if (font->face->table.cff1->get_path (font, glyph, draw_helper)) return true;
if (font->face->table.cff2->get_path (font, glyph, draw_helper)) return true;
if (font->face->table.cff1->get_path (font, glyph, draw_helper)) return;
if (font->face->table.cff2->get_path (font, glyph, draw_helper)) return;
#endif
return false;
}
#endif

View File

@ -1056,9 +1056,11 @@ HB_EXTERN void
hb_font_set_var_named_instance (hb_font_t *font,
unsigned instance_index);
HB_EXTERN hb_bool_t
hb_font_draw_glyph (hb_font_t *font, hb_codepoint_t glyph,
const hb_draw_funcs_t *funcs, void *user_data);
HB_EXTERN void
hb_font_draw_glyph (hb_font_t *font,
hb_codepoint_t glyph,
const hb_draw_funcs_t *funcs,
void *user_data);
HB_END_DECLS

View File

@ -232,8 +232,7 @@ layered_glyph_dump (hb_font_t *font, hb_draw_funcs_t *funcs, unsigned face_index
if (hb_color_get_alpha (color) != 255)
fprintf (f, "fill-opacity=\"%.3f\"", (double) hb_color_get_alpha (color) / 255.);
fprintf (f, "d=\"");
if (!hb_font_draw_glyph (font, layers[layer].glyph, funcs, &user_data))
printf ("Failed to decompose layer %d while %d\n", layers[layer].glyph, gid);
hb_font_draw_glyph (font, layers[layer].glyph, funcs, &user_data);
fprintf (f, "\"/>\n");
}
@ -272,8 +271,7 @@ dump_glyphs (hb_font_t *font, hb_draw_funcs_t *funcs, unsigned face_index)
user_data_t user_data;
user_data.ascender = font_extents.ascender;
user_data.f = f;
if (!hb_font_draw_glyph (font, gid, funcs, &user_data))
printf ("Failed to decompose gid: %d\n", gid);
hb_font_draw_glyph (font, gid, funcs, &user_data);
fprintf (f, "\"/></svg>");
fclose (f);
}