[pango/family-face-api: 8/9] Add pango_font_face_get_family
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/family-face-api: 8/9] Add pango_font_face_get_family
- Date: Thu, 31 Oct 2019 23:32:24 +0000 (UTC)
commit 0b3aa80571ef6a2b7eddf75cb3419c9cf1718104
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Aug 13 22:59:46 2019 -0400
Add pango_font_face_get_family
docs/pango-sections.txt | 1 +
pango/fonts.c | 19 +++++++++++++++++++
pango/pango-font.h | 5 ++++-
pango/pangocoretext-fontmap.c | 9 +++++++++
pango/pangofc-fontmap.c | 9 +++++++++
pango/pangowin32-fontmap.c | 15 +++++++++++++--
pango/pangowin32-private.h | 1 +
7 files changed, 56 insertions(+), 3 deletions(-)
---
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index cb165610..a409f70c 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -271,6 +271,7 @@ pango_font_face_get_face_name
pango_font_face_list_sizes
pango_font_face_describe
pango_font_face_is_synthesized
+pango_font_face_get_family
<SUBSECTION>
PangoFontMap
PangoFontMapClass
diff --git a/pango/fonts.c b/pango/fonts.c
index eaff2378..5c685f77 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2431,6 +2431,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
diff --git a/pango/pango-font.h b/pango/pango-font.h
index 1310cf25..6e0dfa9a 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_44
+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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]