[pango/pango2: 5/5] Redo the cairo font code




commit fa78d33f6b4228760676eb4ffcb9423e7d16773c
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jun 27 07:20:13 2022 -0400

    Redo the cairo font code
    
    It turns out that the harfbuzz code that gives us
    native font objects is questionable, so instead
    use cairo-ft on all platforms.
    
    We still use native font enumeration APIs and
    the harfbuzz support for creating hb objects from
    native font objects.

 meson.build                       |  8 +-----
 pango2/meson.build                | 12 ---------
 pango2/pangocairo-coretext-font.c | 51 ---------------------------------------
 pango2/pangocairo-dwrite-font.cpp | 51 ---------------------------------------
 pango2/pangocairo-font.c          | 22 +----------------
 pango2/pangocairo-private.h       | 12 ---------
 6 files changed, 2 insertions(+), 154 deletions(-)
---
diff --git a/meson.build b/meson.build
index 24a220b6e..217f5ae8a 100644
--- a/meson.build
+++ b/meson.build
@@ -297,8 +297,6 @@ else
   fontconfig_dep = disabler()
 endif
 
-cairo_pkg = 'cairo-ft'
-
 if host_system == 'darwin'
   if not cc.links('''#include <CoreText/CoreText.h>
                               int main (void) {
@@ -313,8 +311,6 @@ if host_system == 'darwin'
   pango_conf.set('HAVE_CORE_TEXT', 1)
 
   pango_deps += dependency('appleframeworks', modules: [ 'CoreFoundation', 'ApplicationServices' ])
-
-  cairo_pkg = 'cairo-quartz-font'
 endif
 
 if host_system == 'windows'
@@ -324,8 +320,6 @@ if host_system == 'windows'
     cc.find_library('gdi32'),
     cc.find_library('dwrite'),
   ]
-
-  cairo_pkg = 'cairo-win32-dwrite-font'
 endif
 
 if get_option('cairo').disabled()
@@ -333,7 +327,7 @@ if get_option('cairo').disabled()
   cairo_xlib_dep = disabler()
   cairo_ft_dep = disabler()
 else
-  cairo_dep = dependency(cairo_pkg, version: cairo_req_version,
+  cairo_dep = dependency('cairo-ft', version: cairo_req_version,
                          fallback: ['cairo', 'libcairo_dep'], required: get_option('cairo'))
   cairo_xlib_dep = dependency('cairo-xlib', required: false)
   cairo_ft_dep = dependency('cairo-ft', required: false)
diff --git a/pango2/meson.build b/pango2/meson.build
index 0a3e8d323..fd49884e6 100644
--- a/pango2/meson.build
+++ b/pango2/meson.build
@@ -154,12 +154,6 @@ if host_system == 'darwin'
     'pangocoretext-fontmap.c',
   ]
 
-  if cairo_dep.found()
-    pango_sources += [
-      'pangocairo-coretext-font.c',
-    ]
-  endif
-
   pango_features_conf.set('PANGO2_HAS_CORE_TEXT_FONTMAP', 1)
 endif
 
@@ -172,12 +166,6 @@ if host_system == 'windows'
     'pangodwrite-fontmap.cpp',
   ]
 
-  if cairo_dep.found()
-    pango_sources += [
-      'pangocairo-dwrite-font.cpp',
-    ]
-  endif
-
   pango_features_conf.set('PANGO2_HAS_DIRECT_WRITE_FONTMAP', 1)
 endif
 
diff --git a/pango2/pangocairo-font.c b/pango2/pangocairo-font.c
index b9103d977..156df3f13 100644
--- a/pango2/pangocairo-font.c
+++ b/pango2/pangocairo-font.c
@@ -66,30 +66,10 @@ _pango2_cairo_font_private_scaled_font_data_destroy (Pango2CairoFontPrivateScale
 static cairo_font_face_t *
 create_cairo_font_face (Pango2Font *font)
 {
-  cairo_font_face_t *cairo_face;
-
   if (PANGO2_IS_USER_FONT (font))
     return create_cairo_user_font_face (font);
 
-#ifdef HAVE_CORE_TEXT
-  cairo_face = create_cairo_core_text_font_face (font);
-  if (cairo_face)
-    return cairo_face;
-#endif
-
-#ifdef HAVE_DIRECT_WRITE
-  cairo_face = create_cairo_dwrite_font_face (font);
-  if (cairo_face)
-    return cairo_face;
-#endif
-
-#ifdef CAIRO_HAS_FT_FONT
-  cairo_face = create_cairo_ft_font_face (font);
-  if (cairo_face)
-    return cairo_face;
-#endif
-
-  return NULL;
+  return create_cairo_ft_font_face (font);
 }
 
 static cairo_scaled_font_t *
diff --git a/pango2/pangocairo-private.h b/pango2/pangocairo-private.h
index be9fa8cf9..b8339c245 100644
--- a/pango2/pangocairo-private.h
+++ b/pango2/pangocairo-private.h
@@ -69,19 +69,7 @@ const cairo_font_options_t *
 cairo_font_face_t *
 create_cairo_user_font_face (Pango2Font *font);
 
-#ifdef CAIRO_HAS_FT_FONT
 cairo_font_face_t *
 create_cairo_ft_font_face (Pango2Font *font);
-#endif
-
-#ifdef HAVE_CORE_TEXT
-cairo_font_face_t *
-create_cairo_core_text_font_face (Pango2Font *font);
-#endif
-
-#ifdef HAVE_DIRECT_WRITE
-cairo_font_face_t *
-create_cairo_dwrite_font_face (Pango2Font *font);
-#endif
 
 G_END_DECLS


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