summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-13 22:59:46 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-10-31 19:52:36 -0400
commit40a805478dfa8988315fd8b7f8515af65c3f90c7 (patch)
tree401a68e86b3a2ac189211a80f18b0f513a740947 /pango
parent044d31030af43722e79c582fc3c4d3e4ace9d9a3 (diff)
downloadpango-40a805478dfa8988315fd8b7f8515af65c3f90c7.tar.gz
Add pango_font_face_get_family
Diffstat (limited to 'pango')
-rw-r--r--pango/fonts.c19
-rw-r--r--pango/pango-font.h5
-rw-r--r--pango/pangocoretext-fontmap.c9
-rw-r--r--pango/pangofc-fontmap.c9
-rw-r--r--pango/pangowin32-fontmap.c15
-rw-r--r--pango/pangowin32-private.h1
6 files changed, 55 insertions, 3 deletions
diff --git a/pango/fonts.c b/pango/fonts.c
index eaff2378..5c685f77 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2432,6 +2432,25 @@ pango_font_face_list_sizes (PangoFontFace *face,
}
/**
+ * pango_font_face_get_family:
+ * @face: a #PangoFontFace
+ *
+ * Gets the #PangoFontFamily that @face
+ * belongs to.
+ *
+ * Returns: (transfer none): the #PangoFontFamily
+ *
+ * Since: 1.46
+ */
+PangoFontFamily *
+pango_font_face_get_family (PangoFontFace *face)
+{
+ g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL);
+
+ return PANGO_FONT_FACE_GET_CLASS (face)->get_family (face);
+}
+
+/**
* pango_font_has_char:
* @font: a #PangoFont
* @wc: a Unicode character
diff --git a/pango/pango-font.h b/pango/pango-font.h
index d84847a5..a456a75c 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -514,6 +514,7 @@ struct _PangoFontFaceClass
int **sizes,
int *n_sizes);
gboolean (*is_synthesized) (PangoFontFace *face);
+ PangoFontFamily * (*get_family) (PangoFontFace *face);
/*< private >*/
@@ -538,6 +539,9 @@ void pango_font_face_list_sizes (PangoFontFace *face,
PANGO_AVAILABLE_IN_1_18
gboolean pango_font_face_is_synthesized (PangoFontFace *face) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_1_46
+PangoFontFamily * pango_font_face_get_family (PangoFontFace *face);
+
/*
* PangoFont
@@ -654,7 +658,6 @@ void pango_font_get_features (PangoFont *font,
PANGO_AVAILABLE_IN_1_44
hb_font_t * pango_font_get_hb_font (PangoFont *font);
-
/**
* PANGO_GLYPH_EMPTY:
*
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index 038287a0..b3d9d71c 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -559,6 +559,14 @@ pango_core_text_face_is_synthesized (PangoFontFace *face)
return cface->synthetic_italic;
}
+static PangoFontFamily *
+pango_core_text_face_get_family (PangoFontFace *face)
+{
+ PangoCoreTextFace *cface = PANGO_CORE_TEXT_FACE (face);
+
+ return PANGO_FONT_FAMILY (cface->family);
+}
+
static void
pango_core_text_face_class_init (PangoCoreTextFaceClass *klass)
{
@@ -571,6 +579,7 @@ pango_core_text_face_class_init (PangoCoreTextFaceClass *klass)
pfclass->get_face_name = pango_core_text_face_get_face_name;
pfclass->list_sizes = pango_core_text_face_list_sizes;
pfclass->is_synthesized = pango_core_text_face_is_synthesized;
+ pfclass->get_family = pango_core_text_face_get_family;
}
/*
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index aa8012f8..dd066cd3 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -2527,6 +2527,14 @@ pango_fc_face_is_synthesized (PangoFontFace *face)
return fcface->fake;
}
+static PangoFontFamily *
+pango_fc_face_get_family (PangoFontFace *face)
+{
+ PangoFcFace *fcface = PANGO_FC_FACE (face);
+
+ return PANGO_FONT_FAMILY (fcface->family);
+}
+
static void
pango_fc_face_finalize (GObject *object)
{
@@ -2554,6 +2562,7 @@ pango_fc_face_class_init (PangoFcFaceClass *class)
class->get_face_name = pango_fc_face_get_face_name;
class->list_sizes = pango_fc_face_list_sizes;
class->is_synthesized = pango_fc_face_is_synthesized;
+ class->get_family = pango_fc_face_get_family;
}
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 1c0b70f2..ccdd69bd 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -690,6 +690,8 @@ create_standard_family (PangoWin32FontMap *win32fontmap,
new_face->cached_fonts = NULL;
+ new_face->family = new_family;
+
new_family->faces = g_slist_append (new_family->faces, new_face);
p = p->next;
@@ -1633,12 +1635,12 @@ pango_win32_insert_font (PangoWin32FontMap *win32fontmap,
win32face->cached_fonts = NULL;
- win32family =
+ win32face->family = win32family =
pango_win32_get_font_family (win32fontmap,
pango_font_description_get_family (win32face->description));
if ((lfp->lfPitchAndFamily & 0xF0) == FF_MODERN)
win32family->is_monospace = TRUE;
-
+
win32family->faces = g_slist_append (win32family->faces, win32face);
PING (("name=%s, length(faces)=%d",
@@ -1711,6 +1713,14 @@ pango_win32_face_is_synthesized (PangoFontFace *face)
return win32face->is_synthetic;
}
+static PangoFontFamily *
+pango_win32_face_get_family (PangoFontFace *face)
+{
+ PangoWin32Face *win32face = PANGO_WIN32_FACE (face);
+
+ return PANGO_FONT_FAMILY (win32face->family);
+}
+
G_DEFINE_TYPE (PangoWin32Face, pango_win32_face, PANGO_TYPE_FONT_FACE)
static void
@@ -1743,6 +1753,7 @@ pango_win32_face_class_init (PangoFontFaceClass *class)
class->get_face_name = pango_win32_face_get_face_name;
class->list_sizes = pango_win32_face_list_sizes;
class->is_synthesized = pango_win32_face_is_synthesized;
+ class->get_family = pango_win32_face_get_family;
}
static void
diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h
index 9d9a0a73..082470e7 100644
--- a/pango/pangowin32-private.h
+++ b/pango/pangowin32-private.h
@@ -153,6 +153,7 @@ struct _PangoWin32Face
{
PangoFontFace parent_instance;
+ gpointer family;
LOGFONTW logfontw;
PangoFontDescription *description;
PangoCoverage *coverage;