[pango/simple-fontmap: 16/33] font: Export some functions privately
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 16/33] font: Export some functions privately
- Date: Sun, 2 Jan 2022 06:51:22 +0000 (UTC)
commit 4503335a4459b0016a0c519098929cf89a62f1f4
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Dec 29 12:32:11 2021 -0500
font: Export some functions privately
pango_font_description_better_match is not
the greatest api to sort fonts, export the
distance function for use in PangoHbFamily.
pango/fonts.c | 23 +++++++++++++++--------
pango/pango-font-private.h | 6 ++++++
2 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/pango/fonts.c b/pango/fonts.c
index 99262942..846f56af 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -745,9 +745,18 @@ pango_font_description_merge_static (PangoFontDescription *desc,
desc->mask |= new_mask;
}
-static gint
-compute_distance (const PangoFontDescription *a,
- const PangoFontDescription *b)
+gboolean
+pango_font_description_is_similar (const PangoFontDescription *a,
+ const PangoFontDescription *b)
+{
+ return a->variant == b->variant &&
+ a->stretch == b->stretch &&
+ a->gravity == b->gravity;
+}
+
+int
+pango_font_description_compute_distance (const PangoFontDescription *a,
+ const PangoFontDescription *b)
{
if (a->style == b->style)
{
@@ -792,12 +801,10 @@ pango_font_description_better_match (const PangoFontDescription *desc,
g_return_val_if_fail (desc != NULL, G_MAXINT);
g_return_val_if_fail (new_match != NULL, G_MAXINT);
- if (new_match->variant == desc->variant &&
- new_match->stretch == desc->stretch &&
- new_match->gravity == desc->gravity)
+ if (pango_font_description_is_similar (new_match, desc))
{
- int old_distance = old_match ? compute_distance (desc, old_match) : G_MAXINT;
- int new_distance = compute_distance (desc, new_match);
+ int old_distance = old_match ? pango_font_description_compute_distance (desc, old_match) : G_MAXINT;
+ int new_distance = pango_font_description_compute_distance (desc, new_match);
if (new_distance < old_distance)
return TRUE;
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 885e38c1..f378ccdc 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -63,6 +63,12 @@ static inline int pango_font_get_absolute_size (PangoFont *font)
return priv->get_absolute_size (font);
}
+gboolean pango_font_description_is_similar (const PangoFontDescription *a,
+ const PangoFontDescription *b);
+
+int pango_font_description_compute_distance (const PangoFontDescription *a,
+ const PangoFontDescription *b);
+
G_END_DECLS
#endif /* __PANGO_FONT_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]