summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontengine.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index 3ac7e6c9ec..4f3df32f16 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** 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 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** 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.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -49,6 +55,7 @@
#include <QtGui/private/qpaintengine_raster_p.h>
#include <QtCore/QtEndian>
+#include <QtCore/QFile>
#include <QtCore/qmath.h>
#include <QtCore/QThreadStorage>
#include <QtCore/private/qsystemlibrary_p.h>
@@ -73,11 +80,8 @@ QT_BEGIN_NAMESPACE
#define TT_PRIM_CSPLINE 3
#endif
-#ifdef MAKE_TAG
-#undef MAKE_TAG
-#endif
// GetFontData expects the tags in little endian ;(
-#define MAKE_TAG(ch1, ch2, ch3, ch4) (\
+#define MAKE_LITTLE_ENDIAN_TAG(ch1, ch2, ch3, ch4) (\
(((quint32)(ch4)) << 24) | \
(((quint32)(ch3)) << 16) | \
(((quint32)(ch2)) << 8) | \
@@ -130,28 +134,28 @@ bool QWindowsFontEngine::hasCFFTable() const
{
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
- return GetFontData(hdc, MAKE_TAG('C', 'F', 'F', ' '), 0, 0, 0) != GDI_ERROR;
+ return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('C', 'F', 'F', ' '), 0, 0, 0) != GDI_ERROR;
}
bool QWindowsFontEngine::hasCMapTable() const
{
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
- return GetFontData(hdc, MAKE_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR;
+ return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR;
}
bool QWindowsFontEngine::hasGlyfTable() const
{
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
- return GetFontData(hdc, MAKE_TAG('g', 'l', 'y', 'f'), 0, 0, 0) != GDI_ERROR;
+ return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('g', 'l', 'y', 'f'), 0, 0, 0) != GDI_ERROR;
}
bool QWindowsFontEngine::hasEbdtTable() const
{
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
- return GetFontData(hdc, MAKE_TAG('E', 'B', 'D', 'T'), 0, 0, 0) != GDI_ERROR;
+ return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('E', 'B', 'D', 'T'), 0, 0, 0) != GDI_ERROR;
}
static inline QString stringFromOutLineTextMetric(const OUTLINETEXTMETRIC *otm, PSTR offset)
@@ -170,7 +174,7 @@ void QWindowsFontEngine::getCMap()
SelectObject(hdc, hfont);
bool symb = false;
if (ttf) {
- cmapTable = getSfntTable(qbswap<quint32>(MAKE_TAG('c', 'm', 'a', 'p')));
+ cmapTable = getSfntTable(MAKE_TAG('c', 'm', 'a', 'p'));
cmap = QFontEngine::getCMap(reinterpret_cast<const uchar *>(cmapTable.constData()),
cmapTable.size(), &symb, &cmapSize);
}
@@ -187,7 +191,7 @@ void QWindowsFontEngine::getCMap()
const QFixed unitsPerEmF(unitsPerEm);
designToDevice = unitsPerEmF / QFixed::fromReal(fontDef.pixelSize);
x_height = int(otm->otmsXHeight);
- loadKerningPairs(unitsPerEmF / int(otm->otmTextMetrics.tmHeight));
+ loadKerningPairs(designToDevice);
_faceId.filename = QFile::encodeName(stringFromOutLineTextMetric(otm, otm->otmpFullName));
lineWidth = otm->otmsUnderscoreSize;
fsType = otm->otmfsType;
@@ -944,7 +948,7 @@ int QWindowsFontEngine::synthesized() const
if(synthesized_flags == -1) {
synthesized_flags = 0;
if(ttf) {
- const DWORD HEAD = MAKE_TAG('h', 'e', 'a', 'd');
+ const DWORD HEAD = MAKE_LITTLE_ENDIAN_TAG('h', 'e', 'a', 'd');
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
uchar data[4];