[graphite2] Add hb_graphite2_face_get_gr_face and hb_graphite2_font_get_gr_font

Based on patch from Martin Hosken.  I believe it returns NULL if the
font doesn't have graphite tables, but have not tested.
This commit is contained in:
Behdad Esfahbod 2012-12-09 18:44:41 -05:00
parent 737ba15644
commit a5a4ab3846
2 changed files with 21 additions and 1 deletions

View File

@ -141,6 +141,13 @@ _hb_graphite2_shaper_face_data_destroy (hb_graphite2_shaper_face_data_t *data)
free (data); free (data);
} }
gr_face *
hb_graphite2_face_get_gr_face (hb_face_t *face)
{
if (unlikely (!hb_graphite2_shaper_face_data_ensure (face))) return NULL;
return HB_SHAPER_DATA_GET (face)->grface;
}
/* /*
* shaper font data * shaper font data
@ -168,6 +175,13 @@ _hb_graphite2_shaper_font_data_destroy (hb_graphite2_shaper_font_data_t *data)
gr_font_destroy (data); gr_font_destroy (data);
} }
gr_font *
hb_graphite2_font_get_gr_font (hb_font_t *font)
{
if (unlikely (!hb_graphite2_shaper_font_data_ensure (font))) return NULL;
return HB_SHAPER_DATA_GET (font);
}
/* /*
* shaper shape_plan data * shaper shape_plan data

View File

@ -33,7 +33,13 @@ HB_BEGIN_DECLS
#define HB_GRAPHITE2_TAG_SILF HB_TAG('S','i','l','f') #define HB_GRAPHITE2_TAG_SILF HB_TAG('S','i','l','f')
/* TODO add gr_font/face etc getters and other glue API */
gr_face *
hb_graphite2_face_get_gr_face (hb_face_t *face);
gr_font *
hb_graphite2_font_get_gr_font (hb_font_t *font);
HB_END_DECLS HB_END_DECLS