[cairo-commit] 2 commits - meson.build src/cairo-dwrite.h src/cairo-win32.h src/meson.build src/win32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 1 08:21:17 UTC 2023


 meson.build                     |    2 -
 src/cairo-dwrite.h              |   60 ++++++++++++++++++++++++++++++++++++++++
 src/cairo-win32.h               |   11 -------
 src/meson.build                 |    3 +-
 src/win32/cairo-dwrite-font.cpp |    8 +++--
 5 files changed, 68 insertions(+), 16 deletions(-)

New commits:
commit 775017ee0d1c77d407a510f04391b2fda1486acb
Merge: d71345b51 158558766
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Feb 1 08:21:12 2023 +0000

    Merge branch 'dwrite-cpp-header' into 'master'
    
    Add cairo-dwrite.h header file
    
    See merge request cairo/cairo!425

commit 15855876685f01af828c29ca2a1608eb06de2a89
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Jan 31 06:36:56 2023 +1030

    dwrite: create C++ dwrite header

diff --git a/meson.build b/meson.build
index 34679304e..12512d115 100644
--- a/meson.build
+++ b/meson.build
@@ -530,7 +530,7 @@ if host_machine.system() == 'windows'
   if d2d_dep.found() and dwrite_dep.found() and d2d_header and dwrite_header and wincodec_dep.found() and wincodec_header
     feature_conf.set('CAIRO_HAS_DWRITE_FONT', 1)
     built_features += [{
-      'name': 'cairo-win32-dwrite-font',
+      'name': 'cairo-dwrite-font',
       'description': 'Microsoft Windows DWrite font backend',
       'deps': [dwrite_dep, d2d_dep, wincodec_dep],
     }]
diff --git a/src/cairo-dwrite.h b/src/cairo-dwrite.h
new file mode 100644
index 000000000..f512c3152
--- /dev/null
+++ b/src/cairo-dwrite.h
@@ -0,0 +1,60 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2023 Adrian Johnson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * Contributor(s):
+ *	Adrian Johnson <ajohnson at redneon.com>
+ */
+
+#ifndef _CAIRO_DWRITE_H_
+#define _CAIRO_DWRITE_H_
+
+#include "cairo.h"
+
+#if CAIRO_HAS_DWRITE_FONT
+
+#ifdef __cplusplus
+
+#include <dwrite.h>
+
+CAIRO_BEGIN_DECLS
+
+cairo_public cairo_font_face_t *
+cairo_dwrite_font_face_create_for_dwrite_fontface (IDWriteFontFace *dwrite_font_face);
+
+CAIRO_END_DECLS
+
+#else  /* __cplusplus */
+#error DWrite font backend requires C++
+#endif /* __cplusplus */
+
+#else  /* CAIRO_HAS_DWRITE_FONT */
+# error Cairo was not compiled with support for DWrite font backend
+#endif /* CAIRO_HAS_DWRITE_FONT */
+
+#endif /* _CAIRO_DWRITE_H_ */
diff --git a/src/cairo-win32.h b/src/cairo-win32.h
index 078a70c7b..db4cac69f 100644
--- a/src/cairo-win32.h
+++ b/src/cairo-win32.h
@@ -107,17 +107,6 @@ cairo_win32_scaled_font_get_device_to_logical (cairo_scaled_font_t *scaled_font,
 
 #endif /* CAIRO_HAS_WIN32_FONT */
 
-#if CAIRO_HAS_DWRITE_FONT
-
-/*
- * Win32 DirectWrite font support
- */
-
-cairo_public cairo_font_face_t *
-cairo_dwrite_font_face_create_for_dwrite_fontface (void *dwrite_font_face);
-
-#endif /* CAIRO_HAS_DWRITE_FONT */
-
 CAIRO_END_DECLS
 
 #else  /* CAIRO_HAS_WIN32_SURFACE */
diff --git a/src/meson.build b/src/meson.build
index db9bf41e4..68665122b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -179,7 +179,7 @@ cairo_feature_sources = {
   'cairo-win32-font': [
     'win32/cairo-win32-font.c',
   ],
-  'cairo-win32-dwrite-font': [
+  'cairo-dwrite-font': [
     'win32/cairo-dwrite-font.cpp',
   ],
   'cairo-script': [
@@ -214,6 +214,7 @@ cairo_feature_headers = {
   'cairo-quartz': ['cairo-quartz.h'],
   'cairo-quartz-image': ['cairo-quartz-image.h'],
   'cairo-win32': ['cairo-win32.h'],
+  'cairo-dwrite-font': ['cairo-dwrite.h'],
   'cairo-gl': ['cairo-gl.h'],
   'cairo-script': ['cairo-script.h'],
   'cairo-tee': ['cairo-tee.h'],
diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp
index 478f775b8..e1f8d294a 100644
--- a/src/win32/cairo-dwrite-font.cpp
+++ b/src/win32/cairo-dwrite-font.cpp
@@ -45,6 +45,8 @@
 #include "cairo-dwrite-private.hpp"
 #include "cairo-truetype-subset-private.h"
 #include "cairo-scaled-font-subsets-private.h"
+#include "cairo-dwrite.h"
+
 #include <float.h>
 
 #include <wincodec.h>
@@ -1361,7 +1363,7 @@ _cairo_dwrite_has_color_glyphs(void *scaled_font)
  *
  * Here is an example of how this function might be used:
  * <informalexample><programlisting><![CDATA[
- * #include <cairo-win32.h>
+ * #include <cairo-dwrite.h>
  * #include <dwrite.h>
  *
  * IDWriteFactory* dWriteFactory = NULL;
@@ -1412,8 +1414,8 @@ _cairo_dwrite_has_color_glyphs(void *scaled_font)
  *
  * Since: 1.18
  **/
-cairo_font_face_t*
-cairo_dwrite_font_face_create_for_dwrite_fontface(void* dwrite_font_face)
+cairo_font_face_t *
+cairo_dwrite_font_face_create_for_dwrite_fontface (IDWriteFontFace *dwrite_font_face)
 {
     IDWriteFontFace *dwriteface = static_cast<IDWriteFontFace*>(dwrite_font_face);
     // Must do malloc and not C++ new, since Cairo frees this.


More information about the cairo-commit mailing list