summaryrefslogtreecommitdiffstats
path: root/config.tests/win/directwrite2/directwrite2.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-12-16 15:52:28 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2016-04-13 07:30:35 +0000
commit33044b83c261c485faa0a6f367773138f9892f76 (patch)
tree6b09d5f62d46b59516758072a7baf30cc041afc0 /config.tests/win/directwrite2/directwrite2.cpp
parent0b3e45fa0ae40e1271256a134effbcc5f3e99017 (diff)
Add color font support on Windows
Detect if DirectWrite 2 is available, and support color fonts if possible. One limitation worth mentioning is that if the color font contains regular, monochrome glyphs as well, then these will be drawn in black, and not in the pen color. Fixing this would require some elaborate rewrites in the font rendering system, since we would have to have two font caches per color font (one for mono and one for colors), or do some sort of trick where we make argb(r, g, b, 0) mean subpixel alpha instead, and detect glyphs that are not correctly premultiplied when blitting to the screen. Another limitation is that the approach does not work with distance field rendering. In principle we could support this on Windows, since the format is vector based, but it would also require substantial work and it is not possible to support for Apple/Google fonts anyway, so it would just lead to code which is not cross-platform. [ChangeLog][Windows] Added support for color fonts (color emojis) when DirectWrite 2 is available. Change-Id: I6a608dd5d2aa3a7e762a06830902bddac7c550a5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'config.tests/win/directwrite2/directwrite2.cpp')
-rw-r--r--config.tests/win/directwrite2/directwrite2.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/config.tests/win/directwrite2/directwrite2.cpp b/config.tests/win/directwrite2/directwrite2.cpp
new file mode 100644
index 0000000000..06becaff70
--- /dev/null
+++ b/config.tests/win/directwrite2/directwrite2.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <dwrite_2.h>
+#include <d2d1.h>
+
+int main(int, char**)
+{
+ IUnknown *factory = 0;
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
+ __uuidof(IDWriteFactory2),
+ &factory);
+ return 0;
+}