summaryrefslogtreecommitdiff
path: root/pango/fonts.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/fonts.c')
-rw-r--r--pango/fonts.c75
1 files changed, 74 insertions, 1 deletions
diff --git a/pango/fonts.c b/pango/fonts.c
index 79cf1251..cd30811c 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -1688,7 +1688,13 @@ typedef struct {
hb_font_t *hb_font;
} PangoFontPrivate;
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PangoFont, pango_font, G_TYPE_OBJECT)
+#define PANGO_FONT_GET_CLASS_PRIVATE(font) ((PangoFontClassPrivate *) \
+ g_type_class_get_private ((GTypeClass *) PANGO_FONT_GET_CLASS (font), \
+ PANGO_TYPE_FONT))
+
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoFont, pango_font, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (PangoFont)
+ g_type_add_class_private (g_define_type_id, sizeof (PangoFontClassPrivate)))
static void
pango_font_finalize (GObject *object)
@@ -1701,12 +1707,39 @@ pango_font_finalize (GObject *object)
G_OBJECT_CLASS (pango_font_parent_class)->finalize (object);
}
+static PangoLanguage **
+pango_font_default_get_languages (PangoFont *font)
+{
+ return NULL;
+}
+
+static gboolean
+pango_font_default_is_hinted (PangoFont *font)
+{
+ return FALSE;
+}
+
+static void
+pango_font_default_get_scale_factors (PangoFont *font,
+ double *x_scale,
+ double *y_scale)
+{
+ *x_scale = *y_scale = 1.0;
+}
+
static void
pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
+ PangoFontClassPrivate *pclass;
object_class->finalize = pango_font_finalize;
+
+ pclass = g_type_class_get_private ((GTypeClass *) class, PANGO_TYPE_FONT);
+
+ pclass->get_languages = pango_font_default_get_languages;
+ pclass->is_hinted = pango_font_default_is_hinted;
+ pclass->get_scale_factors = pango_font_default_get_scale_factors;
}
static void
@@ -2625,3 +2658,43 @@ pango_font_get_features (PangoFont *font,
if (PANGO_FONT_GET_CLASS (font)->get_features)
PANGO_FONT_GET_CLASS (font)->get_features (font, features, len, num_features);
}
+
+/**
+ * pango_font_get_languages:
+ * @font: a `PangoFont`
+ *
+ * Returns the languages that are supported by @font.
+ *
+ * If the font backend does not provide this information,
+ * %NULL is returned. For the fontconfig backend, this
+ * corresponds to the FC_LANG member of the FcPattern.
+ *
+ * The returned array is only valid as long as the font
+ * and its fontmap are valid.
+ *
+ * Returns: (transfer none) (nullable): a %NULL-terminated
+ * array of `PangoLanguage`*
+ *
+ * Since: 1.50
+ */
+PangoLanguage **
+pango_font_get_languages (PangoFont *font)
+{
+ PangoFontClassPrivate *pclass = PANGO_FONT_GET_CLASS_PRIVATE (font);
+
+ return pclass->get_languages (font);
+}
+
+gboolean
+pango_font_is_hinted (PangoFont *font)
+{
+ return PANGO_FONT_GET_CLASS_PRIVATE (font)->is_hinted (font);
+}
+
+void
+pango_font_get_scale_factors (PangoFont *font,
+ double *x_scale,
+ double *y_scale)
+{
+ PANGO_FONT_GET_CLASS_PRIVATE (font)->get_scale_factors (font, x_scale, y_scale);
+}