[pango/kill-ft-face] Move pango_font_get_features where it belongs
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/kill-ft-face] Move pango_font_get_features where it belongs
- Date: Tue, 9 Jul 2019 19:55:48 +0000 (UTC)
commit b6d398aedcaa762d602857aa3eb9a053e449dae2
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jul 9 15:53:13 2019 -0400
Move pango_font_get_features where it belongs
Make this a font vfunc, and implement it
for PangoFcFont.
pango/fonts.c | 10 ++++++++++
pango/pango-font.h | 13 +++++++++----
pango/pangofc-font.c | 31 +++++++++++++++++++++++++++++++
pango/pangofc-shape.c | 28 ----------------------------
4 files changed, 50 insertions(+), 32 deletions(-)
---
diff --git a/pango/fonts.c b/pango/fonts.c
index ebf1b3d1..17ff243e 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2331,3 +2331,13 @@ pango_font_face_list_sizes (PangoFontFace *face,
*n_sizes = 0;
}
}
+
+void
+pango_font_get_features (PangoFont *font,
+ hb_feature_t *features,
+ guint len,
+ guint *num_features)
+{
+ if (PANGO_FONT_GET_CLASS (font)->get_features)
+ PANGO_FONT_GET_CLASS (font)->get_features (font, features, len, *num_features);
+}
diff --git a/pango/pango-font.h b/pango/pango-font.h
index de0a8512..49c1719e 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -588,6 +588,11 @@ PangoFontMap *pango_font_get_font_map (PangoFont *font);
PANGO_AVAILABLE_IN_1_44
hb_font_t * pango_font_get_hb_font (PangoFont *font);
+PANGO_AVAILABLE_IN_1_44
+void pango_font_get_features (PangoFont *font,
+ hb_feature_t *features,
+ guint len,
+ guint *num_features);
#ifdef PANGO_ENABLE_BACKEND
@@ -639,10 +644,10 @@ struct _PangoFontClass
PangoFontMap * (*get_font_map) (PangoFont *font);
PangoFontDescription *(*describe_absolute) (PangoFont *font);
hb_font_t * (*create_hb_font) (PangoFont *font);
- /*< private >*/
-
- /* Padding for future expansion */
- void (*_pango_reserved1) (void);
+ void (*get_features) (PangoFont *font,
+ hb_feature_t *features,
+ guint len,
+ guint *num_features);
};
/* used for very rare and miserable situtations that we cannot even
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 532d5d4f..0aaeb30f 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -87,6 +87,10 @@ static PangoFontMap * pango_fc_font_get_font_map (PangoFont *font)
static PangoFontDescription *pango_fc_font_describe (PangoFont *font);
static PangoFontDescription *pango_fc_font_describe_absolute (PangoFont *font);
static hb_font_t * pango_fc_font_create_hb_font (PangoFont *font);
+static void pango_fc_font_get_features (PangoFont *font,
+ hb_feature_t *features,
+ guint len,
+ guint *num_features);
#define PANGO_FC_FONT_LOCK_FACE(font) (PANGO_FC_FONT_GET_CLASS (font)->lock_face (font))
#define PANGO_FC_FONT_UNLOCK_FACE(font) (PANGO_FC_FONT_GET_CLASS (font)->unlock_face (font))
@@ -114,6 +118,7 @@ pango_fc_font_class_init (PangoFcFontClass *class)
font_class->get_metrics = pango_fc_font_get_metrics;
font_class->get_font_map = pango_fc_font_get_font_map;
font_class->create_hb_font = pango_fc_font_create_hb_font;
+ font_class->get_features = pango_fc_font_get_features;
g_object_class_install_property (object_class, PROP_PATTERN,
g_param_spec_pointer ("pattern",
@@ -986,3 +991,29 @@ pango_fc_font_create_hb_font (PangoFont *font)
return hb_font;
}
+
+static void
+pango_fc_font_get_features (PangoFont *font,
+ hb_feature_t *features,
+ guint len,
+ guint *num_features)
+{
+ /* Setup features from fontconfig pattern. */
+ PangoFcFont *fc_font = PANGO_FC_FONT (font);
+ if (fc_font->font_pattern)
+ {
+ char *s;
+ while (*num_features < len &&
+ FcResultMatch == FcPatternGetString (fc_font->font_pattern,
+ PANGO_FC_FONT_FEATURES,
+ *num_features,
+ (FcChar8 **) &s))
+ {
+ gboolean ret = hb_feature_from_string (s, -1, &features[*num_features]);
+ features[*num_features].start = 0;
+ features[*num_features].end = (unsigned int) -1;
+ if (ret)
+ (*num_features)++;
+ }
+ }
+}
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 6313208a..66a2488f 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -68,34 +68,6 @@ release_buffer (hb_buffer_t *buffer, gboolean free_buffer)
hb_buffer_destroy (buffer);
}
-static void
-pango_font_get_features (PangoFont *font,
- hb_feature_t *features,
- unsigned int len,
- unsigned int *num_features)
-{
- if (PANGO_IS_FC_FONT (font))
- {
- /* Setup features from fontconfig pattern. */
- PangoFcFont *fc_font = PANGO_FC_FONT (font);
- if (fc_font->font_pattern)
- {
- char *s;
- while (*num_features < len &&
- FcResultMatch == FcPatternGetString (fc_font->font_pattern,
- PANGO_FC_FONT_FEATURES,
- *num_features,
- (FcChar8 **) &s))
- {
- gboolean ret = hb_feature_from_string (s, -1, &features[*num_features]);
- features[*num_features].start = 0;
- features[*num_features].end = (unsigned int) -1;
- if (ret)
- (*num_features)++;
- }
- }
- }
-}
void
_pango_fc_shape (PangoFont *font,
const char *item_text,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]