[pango/pango2: 115/201] font: Export some functions privately
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 115/201] font: Export some functions privately
- Date: Sat, 11 Jun 2022 02:22:30 +0000 (UTC)
commit 53884ef0e3c642f2fd9410fe047db7a4858ebfa0
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/pango-font-description.c | 23 +++++++++++++++--------
pango/pango-font-private.h | 6 ++++++
2 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/pango/pango-font-description.c b/pango/pango-font-description.c
index ca99b56a..c18882ef 100644
--- a/pango/pango-font-description.c
+++ b/pango/pango-font-description.c
@@ -740,9 +740,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)
{
@@ -787,12 +796,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 77bf474d..df78beb2 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -88,6 +88,12 @@ static inline int pango_font_get_absolute_size (PangoFont *font)
return PANGO_FONT_GET_CLASS (font)->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]