From a5a4ab3846ef06769784e6469d76eace35e68805 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 9 Dec 2012 18:44:41 -0500 Subject: [PATCH] [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. --- src/hb-graphite2.cc | 14 ++++++++++++++ src/hb-graphite2.h | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index a2ebbf7c3..4e7cfdc7d 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -141,6 +141,13 @@ _hb_graphite2_shaper_face_data_destroy (hb_graphite2_shaper_face_data_t *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 @@ -168,6 +175,13 @@ _hb_graphite2_shaper_font_data_destroy (hb_graphite2_shaper_font_data_t *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 diff --git a/src/hb-graphite2.h b/src/hb-graphite2.h index 812249554..bea68f939 100644 --- a/src/hb-graphite2.h +++ b/src/hb-graphite2.h @@ -33,7 +33,13 @@ HB_BEGIN_DECLS #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