[name] Add hb_ot_name_get_utf()
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 16 Oct 2018 06:32:08 +0000 (23:32 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 27 Oct 2018 04:22:26 +0000 (21:22 -0700)
src/hb-ot-name.cc

index b5143d3..22149e4 100644 (file)
@@ -29,6 +29,7 @@
 #include "hb-ot-name-table.hh"
 
 #include "hb-ot-face.hh"
+#include "hb-utf.hh"
 
 
 static inline const OT::name_accelerator_t&
@@ -50,12 +51,13 @@ hb_ot_name_get_names (hb_face_t                 *face,
 }
 
 
-hb_bool_t
-hb_ot_name_get_utf16 (hb_face_t     *face,
-                     hb_name_id_t   name_id,
-                     hb_language_t  language,
-                     unsigned int  *text_size /* IN/OUT */,
-                     uint16_t      *text      /* OUT */)
+template <typename utf_t>
+static inline hb_bool_t
+hb_ot_name_get_utf (hb_face_t     *face,
+                   hb_name_id_t   name_id,
+                   hb_language_t  language,
+                   unsigned int  *text_size /* IN/OUT */,
+                   typename utf_t::codepoint_t *text /* OUT */)
 {
   const OT::name_accelerator_t &name = _get_name (face);
   unsigned int idx = 0; //XXX
@@ -70,3 +72,13 @@ hb_ot_name_get_utf16 (hb_face_t     *face,
   /* TODO Fallback? */
   return true; //XXX
 }
+
+hb_bool_t
+hb_ot_name_get_utf16 (hb_face_t     *face,
+                     hb_name_id_t   name_id,
+                     hb_language_t  language,
+                     unsigned int  *text_size /* IN/OUT */,
+                     uint16_t      *text      /* OUT */)
+{
+  return hb_ot_name_get_utf<hb_utf16_t> (face, name_id, language, text_size, text);
+}