diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2023-02-01 08:21:12 +0000 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2023-02-01 08:21:12 +0000 |
commit | 775017ee0d1c77d407a510f04391b2fda1486acb (patch) | |
tree | bf53993cc0311d8308ab945cda32fb1daa40b0ad /src | |
parent | d71345b51d46af1e71553908a2560e0fa1eae9ca (diff) | |
parent | 15855876685f01af828c29ca2a1608eb06de2a89 (diff) | |
download | cairo-775017ee0d1c77d407a510f04391b2fda1486acb.tar.gz |
Merge branch 'dwrite-cpp-header' into 'master'
Add cairo-dwrite.h header file
See merge request cairo/cairo!425
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-dwrite.h | 60 | ||||
-rw-r--r-- | src/cairo-win32.h | 11 | ||||
-rw-r--r-- | src/meson.build | 3 | ||||
-rw-r--r-- | src/win32/cairo-dwrite-font.cpp | 8 |
4 files changed, 67 insertions, 15 deletions
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@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 ce8f9a60e..288aec1d4 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. |