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




commit c23b8dee0948e64c3f2ec4245c2a3ed41f8f8e9c
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 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 0541c3179..8bb547409 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,6 +152,7 @@ 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;
@@ -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]