sbix: Implement paint_glyph

This commit is contained in:
Matthias Clasen 2022-12-17 01:04:23 -05:00 committed by Behdad Esfahbod
parent 7996ae4c3d
commit 23c60fd9b2
1 changed files with 19 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include "hb-open-type.hh"
#include "hb-ot-layout-common.hh"
#include "hb-paint.hh"
/*
* sbix -- Standard Bitmap Graphics
@ -231,6 +232,24 @@ struct sbix
num_glyphs, available_ppem);
}
bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const
{
if (!has_data ())
return false;
int x_offset = 0, y_offset = 0;
unsigned int strike_ppem = 0;
hb_blob_t *blob = reference_png (font, glyph, &x_offset, &y_offset, &strike_ppem);
if (blob == hb_blob_get_empty ())
return false;
funcs->image (data, glyph);
hb_blob_destroy (blob);
return true;
}
private:
const SBIXStrike &choose_strike (hb_font_t *font) const