From f70c5d6f0da2cca2c2df4765ba45dbe5fee0cc79 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 24 Dec 2022 10:56:06 -0700 Subject: [PATCH] [paint] Continue returning bool from paint_image() https://github.com/harfbuzz/harfbuzz/commit/6ccbfabd4fcc5d4cca99be10552c270205fd7792#commitcomment-94127307 --- src/hb-ft.cc | 17 ++++++++++------- src/hb-ot-color-cbdt-table.hh | 14 +++++++------- src/hb-ot-color-sbix-table.hh | 14 +++++++------- src/hb-paint.hh | 8 ++++---- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index ee6d648f4..ad224966c 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -882,13 +882,16 @@ hb_ft_paint_glyph (hb_font_t *font, if (!hb_font_get_glyph_extents (font, gid, &extents)) goto out; - paint_funcs->image (paint_data, - blob, - bitmap.width, - bitmap.rows, - HB_PAINT_IMAGE_FORMAT_BGRA, - font->slant_xy, - &extents); + if (!paint_funcs->image (paint_data, + blob, + bitmap.width, + bitmap.rows, + HB_PAINT_IMAGE_FORMAT_BGRA, + font->slant_xy, + &extents)) + { + /* TODO Try a forced outline load and paint? */ + } out: hb_blob_destroy (blob); diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh index c326770a8..875d3fec6 100644 --- a/src/hb-ot-color-cbdt-table.hh +++ b/src/hb-ot-color-cbdt-table.hh @@ -961,17 +961,17 @@ struct CBDT extents.x_bearing + extents.width, extents.y_bearing + extents.height); - funcs->image (data, - blob, - pixel_extents.width, -pixel_extents.height, - HB_PAINT_IMAGE_FORMAT_PNG, - font->slant_xy, - &extents); + bool ret = funcs->image (data, + blob, + pixel_extents.width, -pixel_extents.height, + HB_PAINT_IMAGE_FORMAT_PNG, + font->slant_xy, + &extents); funcs->pop_clip (data); hb_blob_destroy (blob); - return true; + return ret; } private: diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index 10d4b3a85..ecccc83e3 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -253,15 +253,15 @@ struct sbix if (unlikely (!get_extents (font, glyph, &pixel_extents, false))) return false; - funcs->image (data, - blob, - pixel_extents.width, -pixel_extents.height, - HB_PAINT_IMAGE_FORMAT_PNG, - font->slant_xy, - &extents); + bool ret = funcs->image (data, + blob, + pixel_extents.width, -pixel_extents.height, + HB_PAINT_IMAGE_FORMAT_PNG, + font->slant_xy, + &extents); hb_blob_destroy (blob); - return true; + return ret; } private: diff --git a/src/hb-paint.hh b/src/hb-paint.hh index 89be4cb3d..6b47a844f 100644 --- a/src/hb-paint.hh +++ b/src/hb-paint.hh @@ -97,15 +97,15 @@ struct hb_paint_funcs_t { func.color (this, paint_data, is_foreground, color, !user_data ? nullptr : user_data->color); } - void image (void *paint_data, + bool image (void *paint_data, hb_blob_t *image, unsigned width, unsigned height, hb_tag_t format, float slant, hb_glyph_extents_t *extents) - { func.image (this, paint_data, - image, width, height, format, slant, extents, - !user_data ? nullptr : user_data->image); } + { return func.image (this, paint_data, + image, width, height, format, slant, extents, + !user_data ? nullptr : user_data->image); } void linear_gradient (void *paint_data, hb_color_line_t *color_line, float x0, float y0,