[pango/pango2-windows: 95/130] Drop pango_font_description_better_match




commit 550ecef84f38c75f4f6a650264403aefad79ac71
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 17:30:53 2022 -0400

    Drop pango_font_description_better_match
    
    It is a bit dubious, and we are not using it.

 pango/pango-font-description.c | 40 ----------------------------------------
 pango/pango-font-description.h |  6 ------
 tests/test-font.c              | 21 ---------------------
 3 files changed, 67 deletions(-)
---
diff --git a/pango/pango-font-description.c b/pango/pango-font-description.c
index 178d53b48..e46f4ad3e 100644
--- a/pango/pango-font-description.c
+++ b/pango/pango-font-description.c
@@ -765,46 +765,6 @@ pango_font_description_compute_distance (const PangoFontDescription *a,
     return G_MAXINT;
 }
 
-/**
- * pango_font_description_better_match:
- * @desc: a `PangoFontDescription`
- * @old_match: (nullable): a `PangoFontDescription`, or %NULL
- * @new_match: a `PangoFontDescription`
- *
- * Determines if the style attributes of @new_match are a closer match
- * for @desc than those of @old_match are, or if @old_match is %NULL,
- * determines if @new_match is a match at all.
- *
- * Approximate matching is done for weight, stretch and style; other style
- * attributes must match exactly. Style attributes are all attributes other
- * than family and size-related attributes. Approximate matching for style
- * considers %PANGO_STYLE_OBLIQUE and %PANGO_STYLE_ITALIC as matches, but
- * not as good a match as when the styles are equal.
- *
- * Note that @old_match must match @desc.
- *
- * Return value: %TRUE if @new_match is a better match
- */
-gboolean
-pango_font_description_better_match (const PangoFontDescription *desc,
-                                     const PangoFontDescription *old_match,
-                                     const PangoFontDescription *new_match)
-{
-  g_return_val_if_fail (desc != NULL, G_MAXINT);
-  g_return_val_if_fail (new_match != NULL, G_MAXINT);
-
-  if (pango_font_description_is_similar (new_match, desc))
-    {
-      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;
-    }
-
-  return FALSE;
-}
-
 /**
  * pango_font_description_copy:
  * @desc: (nullable): a `PangoFontDescription`, may be %NULL
diff --git a/pango/pango-font-description.h b/pango/pango-font-description.h
index de86bee57..7cad766c3 100644
--- a/pango/pango-font-description.h
+++ b/pango/pango-font-description.h
@@ -313,12 +313,6 @@ void                    pango_font_description_merge_static      (PangoFontDescr
                                                                   const PangoFontDescription *desc_to_merge,
                                                                   gboolean                    
replace_existing);
 
-PANGO_AVAILABLE_IN_ALL
-gboolean                pango_font_description_better_match      (const PangoFontDescription *desc,
-                                                                  const PangoFontDescription *old_match,
-                                                                  const PangoFontDescription *new_match) 
G_GNUC_PURE;
-
-
 PANGO_AVAILABLE_IN_ALL
 PangoFontDescription *  pango_font_description_from_string       (const char                  *str);
 PANGO_AVAILABLE_IN_ALL
diff --git a/tests/test-font.c b/tests/test-font.c
index a17133200..72809f57c 100644
--- a/tests/test-font.c
+++ b/tests/test-font.c
@@ -515,26 +515,6 @@ test_set_gravity (void)
   pango_font_description_free (desc);
 }
 
-static void
-test_match (void)
-{
-  PangoFontDescription *desc;
-  PangoFontDescription *desc1;
-  PangoFontDescription *desc2;
-
-  desc = pango_font_description_from_string ("Futura Medium Italic 14");
-  desc1 = pango_font_description_from_string ("Futura Bold 16");
-  pango_font_description_set_style (desc1, PANGO_STYLE_OBLIQUE);
-  desc2 = pango_font_description_from_string ("Futura Medium 16");
-  pango_font_description_set_style (desc2, PANGO_STYLE_ITALIC);
-
-  g_assert_true (pango_font_description_better_match (desc, desc1, desc2));
-
-  pango_font_description_free (desc);
-  pango_font_description_free (desc1);
-  pango_font_description_free (desc2);
-}
-
 static void
 test_faceid (void)
 {
@@ -582,7 +562,6 @@ main (int argc, char *argv[])
   g_test_add_func ("/pango/fontdescription/variations", test_variations);
   g_test_add_func ("/pango/fontdescription/empty-variations", test_empty_variations);
   g_test_add_func ("/pango/fontdescription/set-gravity", test_set_gravity);
-  g_test_add_func ("/pango/fontdescription/match", test_match);
   g_test_add_func ("/pango/fontdescription/faceid", test_faceid);
   g_test_add_func ("/pango/font/extents", test_extents);
   g_test_add_func ("/pango/font/enumerate", test_enumerate);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]