Move windows font databases into QtGui
Requires adapting a few config checks since cmake currently does not detect directwrite. Task-number: QTBUG-83255 Task-number: QTBUG-83931 Change-Id: I521f1924f701260b41dccbcecf87b19f08df5ccc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
84f2792597
commit
b3e0732740
@ -306,6 +306,15 @@ qt_extend_target(Gui CONDITION WIN32
|
||||
platform/windows/qwindowsguieventdispatcher.cpp platform/windows/qwindowsguieventdispatcher_p.h
|
||||
rhi/qrhid3d11.cpp rhi/qrhid3d11_p.h
|
||||
rhi/qrhid3d11_p_p.h
|
||||
text/windows/qwindowsfontdatabase.cpp text/windows/qwindowsfontdatabase_p.h
|
||||
text/windows/qwindowsfontdatabasebase.cpp text/windows/qwindowsfontdatabasebase_p.h
|
||||
text/windows/qwindowsfontengine.cpp text/windows/qwindowsfontengine_p.h
|
||||
text/windows/qwindowsnativeimage.cpp text/windows/qwindowsnativeimage_p.h
|
||||
LIBRARIES
|
||||
advapi32
|
||||
gdi32
|
||||
ole32
|
||||
user32
|
||||
PUBLIC_LIBRARIES
|
||||
d3d11
|
||||
dxgi
|
||||
@ -551,6 +560,52 @@ qt_extend_target(Gui CONDITION APPLE AND QT_FEATURE_freetype
|
||||
WrapFreetype::WrapFreetype
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_freetype AND WIN32
|
||||
SOURCES
|
||||
text/windows/qwindowsfontdatabase_ft.cpp text/windows/qwindowsfontdatabase_ft_p.h
|
||||
LIBRARIES
|
||||
WrapFreetype::WrapFreetype
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32
|
||||
SOURCES
|
||||
text/windows/qwindowsfontenginedirectwrite.cpp text/windows/qwindowsfontenginedirectwrite_p.h
|
||||
LIBRARIES
|
||||
d2d1
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32
|
||||
SOURCES
|
||||
text/windows/qwindowsdirectwritefontdatabase.cpp text/windows/qwindowsdirectwritefontdatabase_p.h
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
QT_USE_DIRECTWRITE3
|
||||
LIBRARIES
|
||||
dwrite_3
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
LIBRARIES
|
||||
dwrite_2
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3
|
||||
LIBRARIES
|
||||
dwrite
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION WIN32 AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite)
|
||||
DEFINES
|
||||
QT_NO_DIRECTWRITE
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION MINGW AND WIN32
|
||||
LIBRARIES
|
||||
uuid
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION UNIX AND NOT ANDROID AND NOT INTEGRITY AND NOT (TEST_architecture_arch STREQUAL "arm64") AND NOT UIKIT
|
||||
DEFINES
|
||||
ENABLE_PIXMAN_DRAWHELPERS
|
||||
@ -616,7 +671,7 @@ qt_extend_target(Gui CONDITION QT_FEATURE_vulkan
|
||||
Vulkan::Vulkan_nolink
|
||||
)
|
||||
|
||||
#### Keys ignored in scope 89:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vkgen:
|
||||
#### Keys ignored in scope 99:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vkgen:
|
||||
# QMAKE_EXTRA_COMPILERS = "qvkgen_h" "qvkgen_ph" "qvkgen_pimpl"
|
||||
# QMAKE_QVKGEN_INPUT = "vulkan/vk.xml"
|
||||
# QMAKE_QVKGEN_LICENSE_HEADER = "$$QT_SOURCE_TREE/header.LGPL"
|
||||
@ -632,10 +687,10 @@ qt_extend_target(Gui CONDITION QT_FEATURE_vulkan
|
||||
# qvkgen_pimpl.input = "QMAKE_QVKGEN_INPUT"
|
||||
# qvkgen_pimpl.output = "$$OUT_PWD/vulkan/qvulkanfunctions_p.cpp"
|
||||
|
||||
#### Keys ignored in scope 90:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan:
|
||||
#### Keys ignored in scope 100:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan:
|
||||
# qvkgen_h.variable_out = "HEADERS"
|
||||
|
||||
#### Keys ignored in scope 91:.:vulkan:vulkan/vulkan.pri:else:
|
||||
#### Keys ignored in scope 101:.:vulkan:vulkan/vulkan.pri:else:
|
||||
# qvkgen_h.CONFIG = "target_predeps" "no_link"
|
||||
|
||||
qt_extend_target(Gui CONDITION WASM
|
||||
|
@ -395,6 +395,15 @@ qt_extend_target(Gui CONDITION WIN32
|
||||
platform/windows/qwindowsguieventdispatcher.cpp platform/windows/qwindowsguieventdispatcher_p.h
|
||||
rhi/qrhid3d11.cpp rhi/qrhid3d11_p.h
|
||||
rhi/qrhid3d11_p_p.h
|
||||
text/windows/qwindowsfontdatabase.cpp text/windows/qwindowsfontdatabase_p.h
|
||||
text/windows/qwindowsfontdatabasebase.cpp text/windows/qwindowsfontdatabasebase_p.h
|
||||
text/windows/qwindowsfontengine.cpp text/windows/qwindowsfontengine_p.h
|
||||
text/windows/qwindowsnativeimage.cpp text/windows/qwindowsnativeimage_p.h
|
||||
LIBRARIES
|
||||
advapi32
|
||||
gdi32
|
||||
ole32
|
||||
user32
|
||||
PUBLIC_LIBRARIES
|
||||
d3d11
|
||||
dxgi
|
||||
@ -659,6 +668,52 @@ qt_extend_target(Gui CONDITION APPLE AND QT_FEATURE_freetype
|
||||
WrapFreetype::WrapFreetype
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_freetype AND WIN32
|
||||
SOURCES
|
||||
text/windows/qwindowsfontdatabase_ft.cpp text/windows/qwindowsfontdatabase_ft_p.h
|
||||
LIBRARIES
|
||||
WrapFreetype::WrapFreetype
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32
|
||||
SOURCES
|
||||
text/windows/qwindowsfontenginedirectwrite.cpp text/windows/qwindowsfontenginedirectwrite_p.h
|
||||
LIBRARIES
|
||||
d2d1
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32
|
||||
SOURCES
|
||||
text/windows/qwindowsdirectwritefontdatabase.cpp text/windows/qwindowsdirectwritefontdatabase_p.h
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
QT_USE_DIRECTWRITE3
|
||||
LIBRARIES
|
||||
dwrite_3
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
LIBRARIES
|
||||
dwrite_2
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3
|
||||
LIBRARIES
|
||||
dwrite
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION WIN32 AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite)
|
||||
DEFINES
|
||||
QT_NO_DIRECTWRITE
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION MINGW AND WIN32
|
||||
LIBRARIES
|
||||
uuid
|
||||
)
|
||||
|
||||
qt_extend_target(Gui CONDITION UNIX AND NOT ANDROID AND NOT INTEGRITY AND NOT (TEST_architecture_arch STREQUAL "arm64") AND NOT UIKIT
|
||||
DEFINES
|
||||
ENABLE_PIXMAN_DRAWHELPERS
|
||||
@ -724,7 +779,7 @@ qt_extend_target(Gui CONDITION QT_FEATURE_vulkan
|
||||
Vulkan::Vulkan_nolink
|
||||
)
|
||||
|
||||
#### Keys ignored in scope 89:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vkgen:
|
||||
#### Keys ignored in scope 99:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vkgen:
|
||||
# special case begin
|
||||
# We must always generate syncqt-injected header files,
|
||||
# because we added a custom command earlier for those for framework builds.
|
||||
@ -780,10 +835,10 @@ add_custom_command(
|
||||
# qvkgen_pimpl.input = "QMAKE_QVKGEN_INPUT"
|
||||
# qvkgen_pimpl.output = "$$OUT_PWD/vulkan/qvulkanfunctions_p.cpp"
|
||||
|
||||
#### Keys ignored in scope 90:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan:
|
||||
#### Keys ignored in scope 100:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan:
|
||||
# qvkgen_h.variable_out = "HEADERS"
|
||||
|
||||
#### Keys ignored in scope 91:.:vulkan:vulkan/vulkan.pri:else:
|
||||
#### Keys ignored in scope 101:.:vulkan:vulkan/vulkan.pri:else:
|
||||
# qvkgen_h.CONFIG = "target_predeps" "no_link"
|
||||
|
||||
qt_extend_target(Gui CONDITION WASM
|
||||
|
@ -131,3 +131,8 @@ qtConfig(freetype) {
|
||||
darwin {
|
||||
include($$PWD/coretext/coretext.pri)
|
||||
}
|
||||
|
||||
win32 {
|
||||
include($$PWD/windows/windows.pri)
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifdef QT_USE_DIRECTWRITE3
|
||||
|
||||
class QWindowsDirectWriteFontDatabase : public QWindowsFontDatabaseBase
|
||||
class Q_GUI_EXPORT QWindowsDirectWriteFontDatabase : public QWindowsFontDatabaseBase
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(QWindowsDirectWriteFontDatabase)
|
||||
public:
|
@ -174,13 +174,18 @@ QDebug operator<<(QDebug d, const QFontDef &def)
|
||||
return d;
|
||||
}
|
||||
|
||||
void QWindowsFontDatabase::debugFormat(QDebug &d, const LOGFONT &lf)
|
||||
{
|
||||
d << "LOGFONT(\"" << QString::fromWCharArray(lf.lfFaceName)
|
||||
<< "\", lfWidth=" << lf.lfWidth << ", lfHeight=" << lf.lfHeight << ')';
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug d, const LOGFONT &lf)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d.noquote();
|
||||
d << "LOGFONT(\"" << QString::fromWCharArray(lf.lfFaceName)
|
||||
<< "\", lfWidth=" << lf.lfWidth << ", lfHeight=" << lf.lfHeight << ')';
|
||||
QWindowsFontDatabase::debugFormat(d, lf);
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
@ -815,13 +820,12 @@ QT_WARNING_POP
|
||||
static_cast<QWindowsFontEngine *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
|
||||
fontEngine->fontDef.family = actualFontName;
|
||||
break;
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
case QFontEngine::DirectWrite:
|
||||
static_cast<QWindowsFontEngineDirectWrite *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
|
||||
fontEngine->fontDef.family = actualFontName;
|
||||
break;
|
||||
#endif // !QT_NO_DIRECTWRITE
|
||||
#endif // directwrite && direct2d
|
||||
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Unhandled font engine.");
|
||||
@ -841,11 +845,11 @@ QT_WARNING_POP
|
||||
if (fontEngine != nullptr)
|
||||
font.updateFromOS2Table(fontEngine);
|
||||
}
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
else {
|
||||
fontEngine = QWindowsFontDatabaseBase::fontEngine(fontData, pixelSize, hintingPreference);
|
||||
}
|
||||
#endif
|
||||
#endif // directwrite && direct2d
|
||||
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fontEngine;
|
||||
return fontEngine;
|
||||
@ -1145,7 +1149,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q
|
||||
DeleteObject(hfont);
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
if (data->directWriteFactory != nullptr) {
|
||||
const QString fam = QString::fromWCharArray(lf.lfFaceName);
|
||||
const QString nameSubstitute = QWindowsFontEngineDirectWrite::fontNameSubstitute(fam);
|
||||
@ -1169,7 +1173,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q
|
||||
HRESULT hr = data->directWriteGdiInterop->CreateFontFaceFromHdc(data->hdc, &directWriteFontFace);
|
||||
if (SUCCEEDED(hr)) {
|
||||
bool isColorFont = false;
|
||||
#if defined(QT_USE_DIRECTWRITE2)
|
||||
#if QT_CONFIG(direct2d)
|
||||
IDWriteFontFace2 *directWriteFontFace2 = nullptr;
|
||||
if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2),
|
||||
reinterpret_cast<void **>(&directWriteFontFace2)))) {
|
||||
@ -1178,7 +1182,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q
|
||||
|
||||
directWriteFontFace2->Release();
|
||||
}
|
||||
#endif
|
||||
#endif // direct2d
|
||||
useDw = useDw || useDirectWrite(hintingPreference, fam, isColorFont);
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << request.family << request.pointSize
|
||||
<< "pt" << "hintingPreference=" << hintingPreference << "color=" << isColorFont
|
||||
@ -1210,7 +1214,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q
|
||||
DeleteObject(hfont);
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_DIRECTWRITE
|
||||
#endif // directwrite direct2d
|
||||
|
||||
if (!fe) {
|
||||
QWindowsFontEngine *few = new QWindowsFontEngine(request.family, lf, data);
|
@ -57,7 +57,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindowsFontDatabaseFT : public QFreeTypeFontDatabase
|
||||
class Q_GUI_EXPORT QWindowsFontDatabaseFT : public QFreeTypeFontDatabase
|
||||
{
|
||||
public:
|
||||
void populateFontDatabase() override;
|
@ -61,7 +61,9 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindowsFontDatabase : public QWindowsFontDatabaseBase
|
||||
class QDebug;
|
||||
|
||||
class Q_GUI_EXPORT QWindowsFontDatabase : public QWindowsFontDatabaseBase
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(QWindowsFontDatabase)
|
||||
public:
|
||||
@ -100,6 +102,10 @@ public:
|
||||
static void setFontOptions(unsigned options);
|
||||
static unsigned fontOptions();
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
static void debugFormat(QDebug &d, const LOGFONT &lf);
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
private:
|
||||
void removeApplicationFonts();
|
||||
void addDefaultEUDCFont();
|
@ -303,7 +303,7 @@ QString QWindowsFontDatabaseBase::EmbeddedFont::changeFamilyName(const QString &
|
||||
return oldFamilyName;
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
|
||||
namespace {
|
||||
class DirectWriteFontFileStream: public IDWriteFontFileStream
|
||||
@ -522,7 +522,7 @@ namespace {
|
||||
};
|
||||
} // Anonymous namespace
|
||||
|
||||
#endif // !defined(QT_NO_DIRECTWRITE)
|
||||
#endif // directwrite && direct2d
|
||||
|
||||
|
||||
QWindowsFontEngineData::~QWindowsFontEngineData()
|
||||
@ -530,7 +530,7 @@ QWindowsFontEngineData::~QWindowsFontEngineData()
|
||||
if (hdc)
|
||||
DeleteDC(hdc);
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
if (directWriteGdiInterop)
|
||||
directWriteGdiInterop->Release();
|
||||
if (directWriteFactory)
|
||||
@ -564,7 +564,7 @@ QSharedPointer<QWindowsFontEngineData> QWindowsFontDatabaseBase::data()
|
||||
|
||||
bool QWindowsFontDatabaseBase::init(QSharedPointer<QWindowsFontEngineData> d)
|
||||
{
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
if (!d->directWriteFactory) {
|
||||
createDirectWriteFactory(&d->directWriteFactory);
|
||||
if (!d->directWriteFactory)
|
||||
@ -577,11 +577,11 @@ bool QWindowsFontDatabaseBase::init(QSharedPointer<QWindowsFontEngineData> d)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // directwrite && direct2d
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
// ### Qt 6: Link directly to dwrite instead
|
||||
typedef HRESULT (WINAPI *DWriteCreateFactoryType)(DWRITE_FACTORY_TYPE, const IID &, IUnknown **);
|
||||
static inline DWriteCreateFactoryType resolveDWriteCreateFactory()
|
||||
@ -622,7 +622,7 @@ void QWindowsFontDatabaseBase::createDirectWriteFactory(IDWriteFactory **factory
|
||||
|
||||
*factory = static_cast<IDWriteFactory *>(result);
|
||||
}
|
||||
#endif // !defined(QT_NO_DIRECTWRITE)
|
||||
#endif // directwrite && direct2d
|
||||
|
||||
static int s_defaultVerticalDPI = 96; // Native Pixels
|
||||
|
||||
@ -757,30 +757,16 @@ HFONT QWindowsFontDatabaseBase::systemFont()
|
||||
|
||||
QFont QWindowsFontDatabaseBase::systemDefaultFont()
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
// Qt 6: Obtain default GUI font (typically "Segoe UI, 9pt", see QTBUG-58610)
|
||||
NONCLIENTMETRICS ncm;
|
||||
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0);
|
||||
const QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont);
|
||||
#else
|
||||
LOGFONT lf;
|
||||
GetObject(systemFont(), sizeof(lf), &lf);
|
||||
QFont systemFont = LOGFONT_to_QFont(lf);
|
||||
// "MS Shell Dlg 2" is the correct system font >= Win2k
|
||||
if (systemFont.family() == QLatin1String("MS Shell Dlg"))
|
||||
systemFont.setFamily(QStringLiteral("MS Shell Dlg 2"));
|
||||
// Qt 5 by (Qt 4) legacy uses GetStockObject(DEFAULT_GUI_FONT) to
|
||||
// obtain the default GUI font (typically "MS Shell Dlg 2, 8pt"). This has been
|
||||
// long deprecated; the message font of the NONCLIENTMETRICS structure obtained by
|
||||
// SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be used instead (see
|
||||
// QWindowsTheme::refreshFonts(), typically "Segoe UI, 9pt"), which is larger.
|
||||
#endif // Qt 5
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
|
||||
return systemFont;
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
IDWriteFontFace *QWindowsFontDatabaseBase::createDirectWriteFace(const QByteArray &fontData) const
|
||||
{
|
||||
QSharedPointer<QWindowsFontEngineData> fontEngineData = data();
|
||||
@ -831,13 +817,13 @@ IDWriteFontFace *QWindowsFontDatabaseBase::createDirectWriteFace(const QByteArra
|
||||
fontFile->Release();
|
||||
return directWriteFontFace;
|
||||
}
|
||||
#endif // !defined(QT_NO_DIRECTWRITE)
|
||||
#endif // directwrite && direct2d
|
||||
|
||||
QFontEngine *QWindowsFontDatabaseBase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
|
||||
{
|
||||
QFontEngine *fontEngine = nullptr;
|
||||
|
||||
#if !defined(QT_NO_DIRECTWRITE)
|
||||
#if QT_CONFIG(directwrite) && QT_CONFIG(direct2d)
|
||||
QSharedPointer<QWindowsFontEngineData> fontEngineData = data();
|
||||
if (fontEngineData->directWriteFactory == nullptr)
|
||||
return nullptr;
|
||||
@ -854,7 +840,7 @@ QFontEngine *QWindowsFontDatabaseBase::fontEngine(const QByteArray &fontData, qr
|
||||
fontEngine->fontDef.hintingPreference = hintingPreference;
|
||||
|
||||
directWriteFontFace->Release();
|
||||
#else // !defined(QT_NO_DIRECTWRITE)
|
||||
#else // directwrite && direct2d
|
||||
Q_UNUSED(fontData);
|
||||
Q_UNUSED(pixelSize);
|
||||
Q_UNUSED(hintingPreference);
|
@ -84,7 +84,7 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
class QWindowsFontDatabaseBase : public QPlatformFontDatabase
|
||||
class Q_GUI_EXPORT QWindowsFontDatabaseBase : public QPlatformFontDatabase
|
||||
{
|
||||
public:
|
||||
QWindowsFontDatabaseBase();
|
@ -57,7 +57,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindowsNativeImage
|
||||
class Q_GUI_EXPORT QWindowsNativeImage
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(QWindowsNativeImage)
|
||||
public:
|
41
src/gui/text/windows/windows.pri
Normal file
41
src/gui/text/windows/windows.pri
Normal file
@ -0,0 +1,41 @@
|
||||
SOURCES += \
|
||||
text/windows/qwindowsfontdatabase.cpp \
|
||||
text/windows/qwindowsfontdatabasebase.cpp \
|
||||
text/windows/qwindowsfontengine.cpp \
|
||||
text/windows/qwindowsnativeimage.cpp
|
||||
|
||||
HEADERS += \
|
||||
text/windows/qwindowsfontdatabase_p.h \
|
||||
text/windows/qwindowsfontdatabasebase_p.h \
|
||||
text/windows/qwindowsfontengine_p.h \
|
||||
text/windows/qwindowsnativeimage_p.h
|
||||
|
||||
qtConfig(freetype) {
|
||||
SOURCES += text/windows/qwindowsfontdatabase_ft.cpp
|
||||
HEADERS += text/windows/qwindowsfontdatabase_ft_p.h
|
||||
QMAKE_USE_PRIVATE += freetype
|
||||
}
|
||||
|
||||
qtConfig(directwrite):qtConfig(direct2d) {
|
||||
qtConfig(directwrite3) {
|
||||
QMAKE_USE_PRIVATE += dwrite_3
|
||||
DEFINES *= QT_USE_DIRECTWRITE3 QT_USE_DIRECTWRITE2
|
||||
|
||||
SOURCES += text/windows/qwindowsdirectwritefontdatabase.cpp
|
||||
HEADERS += text/windows/qwindowsdirectwritefontdatabase_p.h
|
||||
} else: qtConfig(directwrite2) {
|
||||
QMAKE_USE_PRIVATE += dwrite_2
|
||||
DEFINES *= QT_USE_DIRECTWRITE2
|
||||
} else {
|
||||
QMAKE_USE_PRIVATE += dwrite
|
||||
}
|
||||
QMAKE_USE_PRIVATE += d2d1
|
||||
|
||||
SOURCES += text/windows/qwindowsfontenginedirectwrite.cpp
|
||||
HEADERS += text/windows/qwindowsfontenginedirectwrite_p.h
|
||||
} else {
|
||||
DEFINES *= QT_NO_DIRECTWRITE
|
||||
}
|
||||
|
||||
QMAKE_USE_PRIVATE += advapi32 ole32 user32 gdi32
|
||||
mingw: QMAKE_USE_PRIVATE += uuid
|
@ -34,64 +34,3 @@ qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_fontconfig
|
||||
LIBRARIES
|
||||
Fontconfig::Fontconfig
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION WIN32
|
||||
SOURCES
|
||||
windows/qwindowsfontdatabase.cpp windows/qwindowsfontdatabase_p.h
|
||||
windows/qwindowsfontdatabasebase.cpp windows/qwindowsfontdatabasebase_p.h
|
||||
windows/qwindowsfontengine.cpp windows/qwindowsfontengine_p.h
|
||||
windows/qwindowsnativeimage.cpp windows/qwindowsnativeimage_p.h
|
||||
LIBRARIES
|
||||
advapi32
|
||||
gdi32
|
||||
ole32
|
||||
user32
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::GuiPrivate
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_freetype AND WIN32
|
||||
SOURCES
|
||||
windows/qwindowsfontdatabase_ft.cpp windows/qwindowsfontdatabase_ft_p.h
|
||||
LIBRARIES
|
||||
WrapFreetype::WrapFreetype
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32
|
||||
SOURCES
|
||||
windows/qwindowsfontenginedirectwrite.cpp windows/qwindowsfontenginedirectwrite_p.h
|
||||
LIBRARIES
|
||||
d2d1
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32
|
||||
SOURCES
|
||||
windows/qwindowsdirectwritefontdatabase.cpp windows/qwindowsdirectwritefontdatabase_p.h
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
QT_USE_DIRECTWRITE3
|
||||
LIBRARIES
|
||||
dwrite_3
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
LIBRARIES
|
||||
dwrite_2
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3
|
||||
LIBRARIES
|
||||
dwrite
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite)
|
||||
DEFINES
|
||||
QT_NO_DIRECTWRITE
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION MINGW AND WIN32
|
||||
LIBRARIES
|
||||
uuid
|
||||
)
|
||||
|
@ -46,64 +46,3 @@ if(TARGET WrapFreetype::WrapFreetype)
|
||||
)
|
||||
endif()
|
||||
# special case end
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION WIN32
|
||||
SOURCES
|
||||
windows/qwindowsfontdatabase.cpp windows/qwindowsfontdatabase_p.h
|
||||
windows/qwindowsfontdatabasebase.cpp windows/qwindowsfontdatabasebase_p.h
|
||||
windows/qwindowsfontengine.cpp windows/qwindowsfontengine_p.h
|
||||
windows/qwindowsnativeimage.cpp windows/qwindowsnativeimage_p.h
|
||||
LIBRARIES
|
||||
advapi32
|
||||
gdi32
|
||||
ole32
|
||||
user32
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::GuiPrivate
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_freetype AND WIN32
|
||||
SOURCES
|
||||
windows/qwindowsfontdatabase_ft.cpp windows/qwindowsfontdatabase_ft_p.h
|
||||
LIBRARIES
|
||||
WrapFreetype::WrapFreetype
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32
|
||||
SOURCES
|
||||
windows/qwindowsfontenginedirectwrite.cpp windows/qwindowsfontenginedirectwrite_p.h
|
||||
LIBRARIES
|
||||
d2d1
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32
|
||||
SOURCES
|
||||
windows/qwindowsdirectwritefontdatabase.cpp windows/qwindowsdirectwritefontdatabase_p.h
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
QT_USE_DIRECTWRITE3
|
||||
LIBRARIES
|
||||
dwrite_3
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3
|
||||
DEFINES
|
||||
QT_USE_DIRECTWRITE2
|
||||
LIBRARIES
|
||||
dwrite_2
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite2 AND NOT QT_FEATURE_directwrite3
|
||||
LIBRARIES
|
||||
dwrite
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION WIN32 AND (NOT QT_FEATURE_direct2d OR NOT QT_FEATURE_directwrite)
|
||||
DEFINES
|
||||
QT_NO_DIRECTWRITE
|
||||
)
|
||||
|
||||
qt_extend_target(FontDatabaseSupport CONDITION MINGW AND WIN32
|
||||
LIBRARIES
|
||||
uuid
|
||||
)
|
||||
|
@ -15,8 +15,4 @@ qtConfig(fontconfig) {
|
||||
include($$PWD/fontconfig/fontconfig.pri)
|
||||
}
|
||||
|
||||
win32 {
|
||||
include($$PWD/windows/windows.pri)
|
||||
}
|
||||
|
||||
load(qt_module)
|
||||
|
@ -1,43 +0,0 @@
|
||||
QT *= gui-private
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qwindowsfontdatabase.cpp \
|
||||
$$PWD/qwindowsfontdatabasebase.cpp \
|
||||
$$PWD/qwindowsfontengine.cpp \
|
||||
$$PWD/qwindowsnativeimage.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/qwindowsfontdatabase_p.h \
|
||||
$$PWD/qwindowsfontdatabasebase_p.h \
|
||||
$$PWD/qwindowsfontengine_p.h \
|
||||
$$PWD/qwindowsnativeimage_p.h
|
||||
|
||||
qtConfig(freetype) {
|
||||
SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp
|
||||
HEADERS += $$PWD/qwindowsfontdatabase_ft_p.h
|
||||
QMAKE_USE_PRIVATE += freetype
|
||||
}
|
||||
|
||||
qtConfig(directwrite):qtConfig(direct2d) {
|
||||
qtConfig(directwrite3) {
|
||||
QMAKE_USE_PRIVATE += dwrite_3
|
||||
DEFINES *= QT_USE_DIRECTWRITE3 QT_USE_DIRECTWRITE2
|
||||
|
||||
SOURCES += $$PWD/qwindowsdirectwritefontdatabase.cpp
|
||||
HEADERS += $$PWD/qwindowsdirectwritefontdatabase_p.h
|
||||
} else: qtConfig(directwrite2) {
|
||||
QMAKE_USE_PRIVATE += dwrite_2
|
||||
DEFINES *= QT_USE_DIRECTWRITE2
|
||||
} else {
|
||||
QMAKE_USE_PRIVATE += dwrite
|
||||
}
|
||||
QMAKE_USE_PRIVATE += d2d1
|
||||
|
||||
SOURCES += $$PWD/qwindowsfontenginedirectwrite.cpp
|
||||
HEADERS += $$PWD/qwindowsfontenginedirectwrite_p.h
|
||||
} else {
|
||||
DEFINES *= QT_NO_DIRECTWRITE
|
||||
}
|
||||
|
||||
QMAKE_USE_PRIVATE += advapi32 ole32 user32 gdi32
|
||||
mingw: QMAKE_USE_PRIVATE += uuid
|
@ -1,8 +1,7 @@
|
||||
TARGET = qdirect2d
|
||||
|
||||
QT += \
|
||||
core-private gui-private \
|
||||
fontdatabase_support-private
|
||||
core-private gui-private
|
||||
|
||||
LIBS += -ldwmapi -lversion -ld3d11 -ldxgi -ldxguid
|
||||
QMAKE_USE_PRIVATE += gdi32 dwrite_1 d2d1_1
|
||||
|
@ -45,8 +45,7 @@
|
||||
#include "qwindowsdirect2dbitmap.h"
|
||||
#include "qwindowsdirect2ddevicecontext.h"
|
||||
|
||||
#include <QtFontDatabaseSupport/private/qwindowsfontdatabase_p.h>
|
||||
#include <QtFontDatabaseSupport/private/qwindowsfontengine_p.h>
|
||||
#include <QtGui/private/qwindowsfontdatabase_p.h>
|
||||
#include "qwindowsintegration.h"
|
||||
|
||||
#include <QtCore/qmath.h>
|
||||
|
@ -26,7 +26,7 @@ qt_internal_add_plugin(QMinimalIntegrationPlugin
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_extend_target(QMinimalIntegrationPlugin CONDITION NOT APPLE
|
||||
qt_extend_target(QMinimalIntegrationPlugin CONDITION UNIX AND NOT APPLE
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::FontDatabaseSupportPrivate
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ qt_internal_add_plugin(QMinimalIntegrationPlugin
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_extend_target(QMinimalIntegrationPlugin CONDITION NOT APPLE
|
||||
qt_extend_target(QMinimalIntegrationPlugin CONDITION UNIX AND NOT APPLE
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::FontDatabaseSupportPrivate
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ TARGET = qminimal
|
||||
QT += \
|
||||
core-private gui-private
|
||||
|
||||
!darwin: QT += fontdatabase_support-private
|
||||
!darwin:!win32: QT += fontdatabase_support-private
|
||||
|
||||
DEFINES += QT_NO_FOREACH
|
||||
|
||||
|
@ -47,9 +47,9 @@
|
||||
|
||||
#include <QtGui/private/qfreetypefontdatabase_p.h>
|
||||
#if defined(Q_OS_WIN)
|
||||
# include <QtFontDatabaseSupport/private/qwindowsfontdatabase_p.h>
|
||||
# include <QtGui/private/qwindowsfontdatabase_p.h>
|
||||
# if QT_CONFIG(freetype)
|
||||
# include <QtFontDatabaseSupport/private/qwindowsfontdatabase_ft_p.h>
|
||||
# include <QtGui/private/qwindowsfontdatabase_ft_p.h>
|
||||
# endif
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
# include <QtGui/private/qcoretextfontdatabase_p.h>
|
||||
|
@ -27,7 +27,7 @@ qt_internal_add_plugin(QOffscreenIntegrationPlugin
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_extend_target(QOffscreenIntegrationPlugin CONDITION NOT APPLE
|
||||
qt_extend_target(QOffscreenIntegrationPlugin CONDITION UNIX AND NOT APPLE
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::FontDatabaseSupportPrivate
|
||||
)
|
||||
|
@ -28,7 +28,7 @@ qt_internal_add_plugin(QOffscreenIntegrationPlugin
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_extend_target(QOffscreenIntegrationPlugin CONDITION NOT APPLE
|
||||
qt_extend_target(QOffscreenIntegrationPlugin CONDITION UNIX AND NOT APPLE
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::FontDatabaseSupportPrivate
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ TARGET = qoffscreen
|
||||
QT += \
|
||||
core-private gui-private
|
||||
|
||||
!darwin: QT += fontdatabase_support-private
|
||||
!darwin:!win32: QT += fontdatabase_support-private
|
||||
|
||||
DEFINES += QT_NO_FOREACH
|
||||
|
||||
|
@ -50,7 +50,6 @@ qt_internal_add_plugin(QWindowsIntegrationPlugin
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::Core
|
||||
Qt::CorePrivate
|
||||
Qt::FontDatabaseSupportPrivate
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
dwmapi
|
||||
|
@ -51,7 +51,6 @@ qt_internal_add_plugin(QWindowsIntegrationPlugin
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::Core
|
||||
Qt::CorePrivate
|
||||
Qt::FontDatabaseSupportPrivate
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
dwmapi
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#include <QtGui/qwindow.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtFontDatabaseSupport/private/qwindowsnativeimage_p.h>
|
||||
#include <QtGui/private/qwindowsnativeimage_p.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
#include <private/qimage_p.h>
|
||||
|
||||
|
@ -49,11 +49,12 @@
|
||||
#include "qwindowstheme.h"
|
||||
#include "qwindowsservices.h"
|
||||
#ifdef QT_USE_DIRECTWRITE3
|
||||
#include <QtFontDatabaseSupport/private/qwindowsdirectwritefontdatabase_p.h>
|
||||
#include <QtGui/private/qwindowsdirectwritefontdatabase_p.h>
|
||||
#endif
|
||||
#ifndef QT_NO_FREETYPE
|
||||
# include <QtFontDatabaseSupport/private/qwindowsfontdatabase_ft_p.h>
|
||||
# include <QtGui/private/qwindowsfontdatabase_ft_p.h>
|
||||
#endif
|
||||
#include <QtGui/private/qwindowsfontdatabase_p.h>
|
||||
#if QT_CONFIG(clipboard)
|
||||
# include "qwindowsclipboard.h"
|
||||
# if QT_CONFIG(draganddrop)
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
#include <QtFontDatabaseSupport/private/qwindowsfontdatabase_p.h>
|
||||
#include <QtGui/private/qwindowsfontdatabase_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <QtGui/qopenglcontext.h>
|
||||
#include <QtGui/qscreen.h>
|
||||
#include <qpa/qplatformscreen.h>
|
||||
#include <QtFontDatabaseSupport/private/qwindowsfontdatabase_p.h>
|
||||
#include <QtGui/private/qwindowsfontdatabase_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
||||
#include <QtGui/qpixmapcache.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <QtGui/private/qabstractfileiconengine_p.h>
|
||||
#include <QtFontDatabaseSupport/private/qwindowsfontdatabase_p.h>
|
||||
#include <QtGui/private/qwindowsfontdatabase_p.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
#include <private/qsystemlibrary_p.h>
|
||||
#include <private/qwinregistry_p.h>
|
||||
@ -566,18 +566,23 @@ void QWindowsTheme::refresh()
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const LOGFONT &lf); // in platformsupport
|
||||
|
||||
QDebug operator<<(QDebug d, const NONCLIENTMETRICS &m)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d.noquote();
|
||||
d << "NONCLIENTMETRICS(iMenu=" << m.iMenuWidth << 'x' << m.iMenuHeight
|
||||
<< ", lfCaptionFont=" << m.lfCaptionFont << ", lfSmCaptionFont="
|
||||
<< m.lfSmCaptionFont << ", lfMenuFont=" << m.lfMenuFont
|
||||
<< ", lfMessageFont=" << m.lfMessageFont << ", lfStatusFont="
|
||||
<< m.lfStatusFont << ')';
|
||||
<< ", lfCaptionFont=";
|
||||
QWindowsFontDatabase::debugFormat(d, m.lfCaptionFont);
|
||||
d << ", lfSmCaptionFont=";
|
||||
QWindowsFontDatabase::debugFormat(d, m.lfSmCaptionFont);
|
||||
d << ", lfMenuFont=";
|
||||
QWindowsFontDatabase::debugFormat(d, m.lfMenuFont);
|
||||
d << ", lfMessageFont=";
|
||||
QWindowsFontDatabase::debugFormat(d, m.lfMessageFont);
|
||||
d <<", lfStatusFont=";
|
||||
QWindowsFontDatabase::debugFormat(d, m.lfStatusFont);
|
||||
d << ')';
|
||||
return d;
|
||||
}
|
||||
#endif // QT_NO_DEBUG_STREAM
|
||||
|
@ -1,8 +1,7 @@
|
||||
TARGET = qwindows
|
||||
|
||||
QT += \
|
||||
core-private gui-private \
|
||||
fontdatabase_support-private
|
||||
core-private gui-private
|
||||
|
||||
qtConfig(opengl): QT += opengl-private
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user