summaryrefslogtreecommitdiff
path: root/pango/pangofc-fontmap.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-13 00:00:10 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-07-18 12:47:53 -0700
commitceea8a00ce38fec1c0879d61a79911abc5788374 (patch)
tree0770f81e0db86f6cdcf52da0082c07e70a9e8917 /pango/pangofc-fontmap.c
parentb3c6ed417f7f6bf98f7114dd075818d20489622c (diff)
downloadpango-ceea8a00ce38fec1c0879d61a79911abc5788374.tar.gz
fc: Implement create_hb_font
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r--pango/pangofc-fontmap.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 27abb29e..9d968328 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -52,6 +52,7 @@
#include "pango-impl-utils.h"
#include "pango-enum-types.h"
#include "pango-coverage-private.h"
+#include <hb-ft.h>
/* Overview:
@@ -166,6 +167,8 @@ struct _PangoFcFontFaceData
FcPattern *pattern; /* Referenced pattern that owns filename */
PangoCoverage *coverage;
PangoFcCmapCache *cmap_cache;
+
+ hb_face_t *hb_face;
};
struct _PangoFcFace
@@ -297,6 +300,8 @@ pango_fc_font_face_data_free (PangoFcFontFaceData *data)
if (data->cmap_cache)
_pango_fc_cmap_cache_unref (data->cmap_cache);
+ hb_face_destroy (data->hb_face);
+
g_slice_free (PangoFcFontFaceData, data);
}
@@ -2728,3 +2733,23 @@ pango_fc_family_init (PangoFcFamily *fcfamily)
{
fcfamily->n_faces = -1;
}
+
+hb_face_t *
+pango_fc_font_map_get_hb_face (PangoFcFontMap *fcfontmap,
+ PangoFcFont *fcfont)
+{
+ PangoFcFontFaceData *data;
+
+ data = pango_fc_font_map_get_font_face_data (fcfontmap, fcfont->font_pattern);
+
+ if (!data->hb_face)
+ {
+ hb_blob_t *blob;
+
+ blob = hb_blob_create_from_file (data->filename);
+ data->hb_face = hb_face_create (blob, data->id);
+ hb_blob_destroy (blob);
+ }
+
+ return data->hb_face;
+}