[pango/pango2: 44/112] Drop non-hb fontconfig support




commit 99b905a885d1ec301d20fbbac39b3e03ed915eef
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 10 20:41:03 2022 -0400

    Drop non-hb fontconfig support
    
    We will just use PangoHbFont, going forward.

 pango/meson.build               |   15 -
 pango/pangocairo-fc-private.h   |   45 -
 pango/pangocairo-fc.h           |   51 -
 pango/pangocairo-fcfont.c       |  279 ----
 pango/pangocairo-fcfontmap.c    |  208 ---
 pango/pangocairo-font.c         |    1 -
 pango/pangocairo-fontmap.c      |    9 -
 pango/pangofc-decoder.c         |   90 --
 pango/pangofc-decoder.h         |  122 --
 pango/pangofc-font-private.h    |  112 --
 pango/pangofc-font.c            | 1048 -------------
 pango/pangofc-font.h            |   69 -
 pango/pangofc-fontmap-private.h |  200 ---
 pango/pangofc-fontmap.c         | 3307 ---------------------------------------
 pango/pangofc-fontmap.h         |  233 ---
 pango/pangofc-private.h         |   86 -
 tests/test-fonts.c              |   23 +-
 tests/test-layout.c             |    1 -
 utils/pango-list.c              |   26 -
 19 files changed, 6 insertions(+), 5919 deletions(-)
---
diff --git a/pango/meson.build b/pango/meson.build
index 7d9ef3460..14802eeae 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -115,13 +115,6 @@ if cairo_dep.found()
     'pangocairo-render.c',
   ]
 
-  if pango_font_backends.contains('freetype')
-    pango_sources += [
-      'pangocairo-fcfont.c',
-      'pangocairo-fcfontmap.c',
-    ]
-  endif
-
   if pango_font_backends.contains('win32')
     pango_sources += [
       'pangocairo-win32font.c',
@@ -145,24 +138,16 @@ endif
 
 if build_pangoft2
   pango_headers += [
-    'pangofc-font.h',
-    'pangofc-fontmap.h',
-    'pangofc-decoder.h',
     'pangofc-hbfontmap.h',
   ]
 
   pango_sources += [
-    'pangofc-font.c',
-    'pangofc-fontmap.c',
-    'pangofc-decoder.c',
-    'pango-trace.c',
     'pangofc-hbfontmap.c',
     'pangofc-language-set.c',
   ]
 
   pango_gir_includes += [
     'fontconfig-2.0',
-    'freetype2-2.0',
   ]
 endif
 
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 021c9d626..9e113e6d7 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -33,7 +33,6 @@
 #include "pango-hbface-private.h"
 #include "pango-userfont-private.h"
 #include "pango-userface-private.h"
-#include "pangocairo-fc.h"
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wundef"
diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c
index ce214ca90..10de5e73d 100644
--- a/pango/pangocairo-fontmap.c
+++ b/pango/pangocairo-fontmap.c
@@ -32,7 +32,6 @@
 #  include "pangocairo-win32.h"
 #endif
 #if defined (HAVE_CAIRO_FREETYPE)
-#  include "pangocairo-fc.h"
 #  include "pangofc-hbfontmap.h"
 #endif
 
@@ -89,9 +88,6 @@ pango_cairo_font_map_new (void)
 #if defined(HAVE_CAIRO_FREETYPE)
   if (!backend || 0 == strcmp (backend, "fc")
                || 0 == strcmp (backend, "fontconfig"))
-    return g_object_new (PANGO_TYPE_CAIRO_FC_FONT_MAP, NULL);
-  else if (0 == strcmp (backend, "fc2") ||
-           0 == strcmp (backend, "fontconfig2"))
     return (PangoFontMap *) pango_fc_hb_font_map_new ();
 #endif
   {
@@ -104,7 +100,6 @@ pango_cairo_font_map_new (void)
 #endif
 #if defined(HAVE_CAIRO_FREETYPE)
       " fontconfig"
-      " fontconfig2"
 #endif
       ;
     g_critical ("Unknown PANGOCAIRO_BACKEND value.\nAvailable backends are:%s", backends);
@@ -141,10 +136,6 @@ pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype)
 #if defined(HAVE_CAIRO_WIN32)
     case CAIRO_FONT_TYPE_WIN32:
       return g_object_new (PANGO_TYPE_CAIRO_WIN32_FONT_MAP, NULL);
-#endif
-#if defined(HAVE_CAIRO_FREETYPE)
-    case CAIRO_FONT_TYPE_FT:
-      return g_object_new (PANGO_TYPE_CAIRO_FC_FONT_MAP, NULL);
 #endif
     default:
       return NULL;
diff --git a/tests/test-fonts.c b/tests/test-fonts.c
index 2ecdc545d..98435abf6 100644
--- a/tests/test-fonts.c
+++ b/tests/test-fonts.c
@@ -2,21 +2,19 @@
 #include <locale.h>
 
 #include <pango/pango.h>
-#include <pango/pangocairo-fc.h>
-#include <pango/pangofc-fontmap.h>
+#include <pango/pangofc-hbfontmap.h>
 #include "test-common.h"
 
+static PangoFontMap *map = NULL;
+
 static void
 install_fonts (const char *dir)
 {
   FcConfig *config;
-  PangoFontMap *map;
   char *path;
   gsize len;
   char *conf;
 
-  map = g_object_new (PANGO_TYPE_CAIRO_FC_FONT_MAP, NULL);
-
   config = FcConfigCreate ();
 
   path = g_build_filename (dir, "fonts.conf", NULL);
@@ -29,12 +27,9 @@ install_fonts (const char *dir)
   g_free (path);
 
   FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
-  pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (map), config);
+  map = PANGO_FONT_MAP (pango_fc_hb_font_map_new ());
+  pango_fc_hb_font_map_set_config (PANGO_FC_HB_FONT_MAP (map), config);
   FcConfigDestroy (config);
-
-  pango_cairo_font_map_set_default (PANGO_CAIRO_FONT_MAP (map));
-
-  g_object_unref (map);
 }
 
 static gboolean
@@ -74,7 +69,7 @@ list_fonts (const char *contents)
 
   desc = pango_font_description_from_string (s);
 
-  context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+  context = pango_font_map_create_context (map);
   fonts = pango_context_load_fontset (context, desc, pango_language_get_default ());
 
   str = g_string_new (s);
@@ -103,12 +98,6 @@ test_fontset (gconstpointer d)
   char *s;
   GBytes *orig;
 
-  if (strcmp (G_OBJECT_TYPE_NAME (pango_cairo_font_map_get_default ()), "PangoFcFontMap") != 0)
-    {
-      g_test_skip ("Not an fc fontmap. Skipping...");
-      return;
-    }
-
   char *old_locale = g_strdup (setlocale (LC_ALL, NULL));
   setlocale (LC_ALL, "en_US.UTF-8");
   if (strstr (setlocale (LC_ALL, NULL), "en_US") == NULL)
diff --git a/tests/test-layout.c b/tests/test-layout.c
index b42f8f938..c91af6afa 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -29,7 +29,6 @@
 
 #include "config.h"
 #include <pango/pangocairo.h>
-#include <pango/pangocairo-fc.h>
 #include <pango/pangofc-hbfontmap.h>
 #include "test-common.h"
 
diff --git a/utils/pango-list.c b/utils/pango-list.c
index d7e52f098..ab19bddbb 100644
--- a/utils/pango-list.c
+++ b/utils/pango-list.c
@@ -23,7 +23,6 @@
 #include "config.h"
 #include <pango/pangocairo.h>
 #include <pango/pangofc-hbfontmap.h>
-#include <pango/pangofc-font.h>
 #include <pango/pango-hbface-private.h>
 #include <hb-ot.h>
 #include <glib/gstdio.h>
@@ -242,13 +241,6 @@ main (int    argc,
                   PangoHbFace *hbface = (PangoHbFace *)face;
                   instance_id = hbface->instance_id;
                 }
-              else if (PANGO_IS_FC_FONT (font))
-                {
-                  int index;
-                  FcPattern *pattern = pango_fc_font_get_pattern (PANGO_FC_FONT (font));
-                  FcPatternGetInteger (pattern, FC_INDEX, 0, (int *)&index);
-                  instance_id = (index >> 16) - 1;
-                }
 
               if (pango_font_face_is_variable (face))
                 {
@@ -288,24 +280,6 @@ main (int    argc,
                   if (hbface->file)
                     g_print ("    %d %s\n", hbface->index, hbface->file);
                 }
-              else
-                {
-                  PangoFont *font;
-
-                  font = pango_context_load_font (ctx, desc);
-                  if (PANGO_IS_FC_FONT (font))
-                    {
-                      FcPattern *pattern;
-                      const char *file;
-                      int index;
-
-                      pattern = pango_fc_font_get_pattern (PANGO_FC_FONT (font));
-                      FcPatternGetString (pattern, FC_FILE, 0, (FcChar8 **)&file);
-                      FcPatternGetInteger (pattern, FC_INDEX, 0, &index);
-                      g_print ("    %d %s\n", index, file);
-                    }
-                  g_object_unref (font);
-                }
             }
 
           g_free (desc_str);


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