[api] Return hb_bool_t from hb_raster_draw_glyph and hb_gpu_draw_glyph

Both were declared void, diverging from their sibling APIs
(hb_vector_{draw,paint}_glyph, hb_raster_paint_glyph) which all
return hb_bool_t, and from the font-level hb_font_draw_glyph_or_fail()
pattern.

Switch both to return hb_bool_t and route the internal call
through hb_font_draw_glyph_or_fail() instead of hb_font_draw_glyph().
Returns false when the font has no outlines for the given glyph;
true otherwise.

Libraries are new/experimental; the ABI break is acceptable.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Behdad Esfahbod committed 2026-04-13 01:59:18 -06:00
1 parent 8cd50a7b77
commit 3e411b58d6
4 files changed
+15 -7

No files matched your search

+6 -3
View File
@@ -1044,9 +1044,12 @@ hb_gpu_draw_get_scale (const hb_gpu_draw_t *draw,
* encoder using hb_font_draw_glyph(). Also sets the font scale
* on the encoder.
*
* Return value: `true` if the glyph was drawn, `false` if the font
* has no outlines for @codepoint.
*
* Since: 14.0.0
**/
void
hb_bool_t
hb_gpu_draw_glyph (hb_gpu_draw_t *draw,
hb_font_t *font,
hb_codepoint_t codepoint)
@@ -1055,8 +1058,8 @@ hb_gpu_draw_glyph (hb_gpu_draw_t *draw,
hb_font_get_scale (font, &x_scale, &y_scale);
hb_gpu_draw_set_scale (draw, x_scale, y_scale);
hb_font_draw_glyph (font, codepoint,
hb_gpu_draw_get_funcs (),
return hb_font_draw_glyph_or_fail (font, codepoint,
hb_gpu_draw_get_funcs (),
draw);
}
+1 -1
View File
@@ -106,7 +106,7 @@ hb_gpu_draw_get_scale (const hb_gpu_draw_t *draw,
HB_EXTERN hb_draw_funcs_t *
hb_gpu_draw_get_funcs (void);
HB_EXTERN void
HB_EXTERN hb_bool_t
hb_gpu_draw_glyph (hb_gpu_draw_t *draw,
hb_font_t *font,
hb_codepoint_t codepoint);
+7 -2
View File
@@ -963,9 +963,12 @@ hb_raster_draw_get_funcs (void)
* rasterizer's current transform. The pen coordinates are applied before
* minification and are transformed by the current affine transform.
*
* Return value: `true` if the glyph was drawn, `false` if the font has
* no outlines for @glyph.
*
* Since: 13.0.0
**/
void
hb_bool_t
hb_raster_draw_glyph (hb_raster_draw_t *draw,
hb_font_t *font,
hb_codepoint_t glyph,
@@ -983,8 +986,10 @@ hb_raster_draw_glyph (hb_raster_draw_t *draw,
xx, yx, xy, yy,
dx + xx * pen_x + xy * pen_y,
dy + yx * pen_x + yy * pen_y);
hb_font_draw_glyph (font, glyph, hb_raster_draw_get_funcs (), draw);
hb_bool_t ret = hb_font_draw_glyph_or_fail (font, glyph,
hb_raster_draw_get_funcs (), draw);
hb_raster_draw_set_transform (draw, xx, yx, xy, yy, dx, dy);
return ret;
}
+1 -1
View File
@@ -195,7 +195,7 @@ hb_raster_draw_set_glyph_extents (hb_raster_draw_t *draw,
HB_EXTERN hb_draw_funcs_t *
hb_raster_draw_get_funcs (void);
HB_EXTERN void
HB_EXTERN hb_bool_t
hb_raster_draw_glyph (hb_raster_draw_t *draw,
hb_font_t *font,
hb_codepoint_t glyph,