From 33044b83c261c485faa0a6f367773138f9892f76 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 16 Dec 2015 15:52:28 +0100 Subject: 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 --- config.tests/win/directwrite2/directwrite2.cpp | 50 ++++++++++++++++++++++++++ config.tests/win/directwrite2/directwrite2.pro | 4 +++ 2 files changed, 54 insertions(+) create mode 100644 config.tests/win/directwrite2/directwrite2.cpp create mode 100644 config.tests/win/directwrite2/directwrite2.pro (limited to 'config.tests/win') 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 +#include + +int main(int, char**) +{ + IUnknown *factory = 0; + DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, + __uuidof(IDWriteFactory2), + &factory); + return 0; +} diff --git a/config.tests/win/directwrite2/directwrite2.pro b/config.tests/win/directwrite2/directwrite2.pro new file mode 100644 index 0000000000..ec37247017 --- /dev/null +++ b/config.tests/win/directwrite2/directwrite2.pro @@ -0,0 +1,4 @@ +SOURCES = directwrite2.cpp +LIBS += -ldwrite +CONFIG -= qt +CONFIG += console -- cgit v1.2.3