[pango/kill-ft-face: 17/18] coretext: Implement create_hb_font



commit 11cc5cb548e08a9a24607b11b649bcb23965717b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jul 13 00:05:01 2019 -0400

    coretext: Implement create_hb_font
    
    This is untested.

 pango/pangocoretext.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c
index a6eaa1fc..32609a3d 100644
--- a/pango/pangocoretext.c
+++ b/pango/pangocoretext.c
@@ -32,6 +32,7 @@
 
 #include "pangocoretext.h"
 #include "pangocoretext-private.h"
+#include <harfbuzz/hb-coretext.h>
 
 struct _PangoCoreTextFontPrivate
 {
@@ -208,6 +209,26 @@ pango_core_text_font_get_font_map (PangoFont *font)
   return ctfont->priv->fontmap;
 }
 
+static hb_font_t *
+pango_core_text_font_create_hb_font (PangoFont *font)
+{
+  PangoCoreTextFont *ctfont = (PangoCoreTextFont *)font;
+
+  if (ctfont->priv->font_ref)
+    {
+      hb_font_t *hb_font;
+      int size;
+
+      size = pango_core_text_font_key_get_size (ctfont->priv->key);
+      hb_font = hb_coretext_font_create (ctfont->priv->font_ref);
+      hb_font_set_scale (hb_font, size, size);
+
+      return hb_font;
+    }
+
+  return NULL;
+}
+
 static void
 pango_core_text_font_init (PangoCoreTextFont *ctfont)
 {
@@ -227,6 +248,7 @@ pango_core_text_font_class_init (PangoCoreTextFontClass *class)
   font_class->get_coverage = pango_core_text_font_get_coverage;
   font_class->find_shaper = pango_core_text_font_find_shaper;
   font_class->get_font_map = pango_core_text_font_get_font_map;
+  font_class->create_hb_font = pango_core_text_font_create_hb_font;
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]