[pango/pango2-windows] pangocairo-font.c: Support creating font face with DWrite



commit 327860e33547d8c2a4b6b4b356282a2db782a746
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jun 14 16:57:22 2022 +0800

    pangocairo-font.c: Support creating font face with DWrite
    
    Use the newly-added utility function from the previous commit to create
    the Cairo font face with a PangoFont (HarfBuzz font) that is created via
    DirectWrite.
    
    Also ifdef the portions that use FreeType, to be enabled only when
    FontConfig is being used.

 pango/pangocairo-font.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 0541c3179..f0f1ea9c5 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -35,6 +35,7 @@
 #include "pango-userface-private.h"
 #include "pango-font-private.h"
 
+#ifdef HAVE_FONTCONFIG
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wundef"
 #include <cairo-ft.h>
@@ -43,6 +44,9 @@
 #include <hb-ft.h>
 #include <freetype/ftmm.h>
 
+static FT_Library ft_library;
+#endif
+
 #define PANGO_CAIRO_FONT_PRIVATE(font)         \
   ((PangoCairoFontPrivate *)                   \
    (font == NULL ? NULL :                      \
@@ -77,8 +81,6 @@ _pango_cairo_font_private_scaled_font_data_destroy (PangoCairoFontPrivateScaledF
     }
 }
 
-static FT_Library ft_library;
-
 static cairo_user_data_key_t cairo_user_data;
 
 static cairo_status_t
@@ -150,16 +152,17 @@ create_font_face_for_user_font (PangoFont *font)
 static cairo_font_face_t *
 create_font_face_for_hb_font (PangoFont *font)
 {
+#ifdef HAVE_FONTCONFIG
   PangoHbFace *face = PANGO_HB_FACE (font->face);
   hb_blob_t *blob;
   const char *blob_data;
   unsigned int blob_length;
-  FT_Face ft_face;
   hb_font_t *hb_font;
   unsigned int num_coords;
   const int *coords;
   cairo_font_face_t *cairo_face;
   static const cairo_user_data_key_t key;
+  FT_Face ft_face;
   FT_Error error;
 
   if (g_once_init_enter (&ft_library))
@@ -199,6 +202,10 @@ create_font_face_for_hb_font (PangoFont *font)
                                  ft_face, (cairo_destroy_func_t) FT_Done_Face);
 
   return cairo_face;
+#endif
+#ifdef HAVE_DIRECT_WRITE
+  return pango_cairo_create_font_face_for_dwrite_pango_font (font);
+#endif
 }
 
 static cairo_scaled_font_t *


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