[HarfBuzz] harfbuzz-ng: Changes to 'graphite2'
Martin Hosken
mhosken at gmail.com
Wed Aug 24 19:18:02 PDT 2011
Dear Behdad,
You mentioned that you intend to simplify the whole userdata approach for both uniscribe and graphite, which is a great idea. One thing that is worth pointing out is that graphite is somewhat unique in needing a difference between undef (not yet tried to create a gr_face) and NULL (tried and failed). Most fonts are not going to have graphite tables so we don't want to keep trying to create a gr_face for them. Instead we just want to try once and note that this isn't a graphite font. The fail is then quick.
I haven't refactored the hb-graphite2.cc to put that back since you intend to refactor that area anyway. I would suggest the following patch though:
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index df97175..dfeab9f 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -227,6 +227,7 @@ hb_graphite_shape (hb_font_t *font,
buffer->guess_properties ();
hb_gr_font_data_t *data = _hb_gr_font_get_data (font);
+ if (!data->grface) return FALSE;
unsigned int charlen;
hb_glyph_info_t *bufferi = hb_buffer_get_glyph_infos (buffer, &charlen);
otherwise you try to do feature stuff on a null font, and so on.
Yours,
Martin
More information about the HarfBuzz
mailing list