summaryrefslogtreecommitdiff
path: root/pango/fonts.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-29 12:32:11 -0500
committerMatthias Clasen <mclasen@redhat.com>2022-01-28 09:03:03 -0500
commit98fafa7c500a87f50d77e472153ee08806282414 (patch)
tree99394c080aaeb3386e22963b551de7afbfaf4179 /pango/fonts.c
parent0896a20eea58575a03a09ff43701684a3ba2395a (diff)
downloadpango-98fafa7c500a87f50d77e472153ee08806282414.tar.gz
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.
Diffstat (limited to 'pango/fonts.c')
-rw-r--r--pango/fonts.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/pango/fonts.c b/pango/fonts.c
index 004089fc..e502d2b3 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;