[pango/pango2: 81/112] Drop pango_font_description_to_filename




commit 579eaba18207403a4b5cc727cfe0bd2af3bb6bc5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 10:45:22 2022 -0400

    Drop pango_font_description_to_filename
    
    Does not seem useful enough.

 pango/pango-font-description.c | 38 --------------------------------------
 pango/pango-font-description.h |  2 --
 tests/test-font.c              | 19 -------------------
 3 files changed, 59 deletions(-)
---
diff --git a/pango/pango-font-description.c b/pango/pango-font-description.c
index 485a641a1..178170dec 100644
--- a/pango/pango-font-description.c
+++ b/pango/pango-font-description.c
@@ -1538,44 +1538,6 @@ pango_font_description_to_string (const PangoFontDescription *desc)
   return g_string_free (result, FALSE);
 }
 
-/**
- * pango_font_description_to_filename:
- * @desc: a `PangoFontDescription`
- *
- * Creates a filename representation of a font description.
- *
- * The filename is identical to the result from calling
- * [method@Pango.FontDescription.to_string], but with underscores
- * instead of characters that are untypical in filenames, and in
- * lower case only.
- *
- * Return value: a new string that must be freed with g_free().
- */
-char *
-pango_font_description_to_filename (const PangoFontDescription *desc)
-{
-  char *result;
-  char *p;
-
-  g_return_val_if_fail (desc != NULL, NULL);
-
-  result = pango_font_description_to_string (desc);
-
-  p = result;
-  while (*p)
-    {
-      if (G_UNLIKELY ((guchar) *p >= 128))
-        /* skip over non-ASCII chars */;
-      else if (strchr ("-+_.", *p) == NULL && !g_ascii_isalnum (*p))
-        *p = '_';
-      else
-        *p = g_ascii_tolower (*p);
-      p++;
-    }
-
-  return result;
-}
-
 static gboolean
 parse_field (const char *what,
              const FieldMap *map,
diff --git a/pango/pango-font-description.h b/pango/pango-font-description.h
index f3615cba8..de86bee57 100644
--- a/pango/pango-font-description.h
+++ b/pango/pango-font-description.h
@@ -323,8 +323,6 @@ PANGO_AVAILABLE_IN_ALL
 PangoFontDescription *  pango_font_description_from_string       (const char                  *str);
 PANGO_AVAILABLE_IN_ALL
 char *                  pango_font_description_to_string         (const PangoFontDescription  *desc);
-PANGO_AVAILABLE_IN_ALL
-char *                  pango_font_description_to_filename       (const PangoFontDescription  *desc);
 
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontDescription, pango_font_description_free)
diff --git a/tests/test-font.c b/tests/test-font.c
index a527f3630..2aa2d334f 100644
--- a/tests/test-font.c
+++ b/tests/test-font.c
@@ -500,24 +500,6 @@ test_font_metrics (void)
   pango_font_metrics_unref (metrics);
 }
 
-static void
-test_to_filename (void)
-{
-  PangoFontDescription *desc;
-  char *str;
-
-  desc = pango_font_description_from_string ("Futura Medium Italic 14");
-  str = pango_font_description_to_filename (desc);
-
-  g_assert_nonnull (strstr (str, "futura"));
-  g_assert_nonnull (strstr (str, "medium"));
-  g_assert_nonnull (strstr (str, "italic"));
-
-  g_free (str);
-
-  pango_font_description_free (desc);
-}
-
 static void
 test_set_gravity (void)
 {
@@ -599,7 +581,6 @@ main (int argc, char *argv[])
   g_test_add_func ("/pango/fontdescription/roundtrip", test_roundtrip);
   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/to-filename", test_to_filename);
   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);


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