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




commit f9b576f3673a711065b5003d8014c0527fed79a7
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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 1fc629fb..a8d1e0f5 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"
 
+#ifndef HAVE_DIRECT_WRITE
 #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)
 {
+#ifndef HAVE_DIRECT_WRITE
   PangoHbFace *face = PANGO_HB_FACE (font->face);
   hb_blob_t *blob;
   const char *blob_data;
@@ -199,6 +202,9 @@ create_font_face_for_hb_font (PangoFont *font)
                                  ft_face, (cairo_destroy_func_t) FT_Done_Face);
 
   return cairo_face;
+#else
+  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]