Windows font databases: Enable DirectWrite for cmake

- Remove the DirectWrite1,2 features. Windows 10
  should have them, only MinGW is missing directwrite3.
  The feature directwrite now implies DirectWrite2.
- Remove the custom defines.
- Port over the configure tests from configure.json
  and add missing ones for DirectWrite(2), DirectWrite3
  and Direct2D and Direct2D 1.1, fix the conditions
  and report them in the summary.

Task-number: QTBUG-83255
Fixes: QTBUG-83931
Change-Id: I1fc68997adc715bd5c6d7ec457f58c46e1f81c6a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Friedemann Kleint 2020-05-29 11:03:49 +02:00
parent f626c73b28
commit b89d8c406b
14 changed files with 1339 additions and 117 deletions

View File

@ -590,30 +590,15 @@ qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AN
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32 qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32
SOURCES SOURCES
text/windows/qwindowsdirectwritefontdatabase.cpp text/windows/qwindowsdirectwritefontdatabase_p.h text/windows/qwindowsdirectwritefontdatabase.cpp text/windows/qwindowsdirectwritefontdatabase_p.h
DEFINES
QT_USE_DIRECTWRITE2
QT_USE_DIRECTWRITE3
LIBRARIES LIBRARIES
dwrite_3 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 qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite3
DEFINES
QT_USE_DIRECTWRITE2
LIBRARIES LIBRARIES
dwrite_2 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 qt_extend_target(Gui CONDITION MINGW AND WIN32
LIBRARIES LIBRARIES
uuid uuid
@ -684,7 +669,7 @@ qt_extend_target(Gui CONDITION QT_FEATURE_vulkan
Vulkan::Vulkan_nolink Vulkan::Vulkan_nolink
) )
#### Keys ignored in scope 102:.: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_EXTRA_COMPILERS = "qvkgen_h" "qvkgen_ph" "qvkgen_pimpl"
# QMAKE_QVKGEN_INPUT = "vulkan/vk.xml" # QMAKE_QVKGEN_INPUT = "vulkan/vk.xml"
# QMAKE_QVKGEN_LICENSE_HEADER = "$$QT_SOURCE_TREE/header.LGPL" # QMAKE_QVKGEN_LICENSE_HEADER = "$$QT_SOURCE_TREE/header.LGPL"
@ -700,10 +685,10 @@ qt_extend_target(Gui CONDITION QT_FEATURE_vulkan
# qvkgen_pimpl.input = "QMAKE_QVKGEN_INPUT" # qvkgen_pimpl.input = "QMAKE_QVKGEN_INPUT"
# qvkgen_pimpl.output = "$$OUT_PWD/vulkan/qvulkanfunctions_p.cpp" # qvkgen_pimpl.output = "$$OUT_PWD/vulkan/qvulkanfunctions_p.cpp"
#### Keys ignored in scope 103:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan: #### Keys ignored in scope 100:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan:
# qvkgen_h.variable_out = "HEADERS" # qvkgen_h.variable_out = "HEADERS"
#### Keys ignored in scope 104:.:vulkan:vulkan/vulkan.pri:else: #### Keys ignored in scope 101:.:vulkan:vulkan/vulkan.pri:else:
# qvkgen_h.CONFIG = "target_predeps" "no_link" # qvkgen_h.CONFIG = "target_predeps" "no_link"
qt_extend_target(Gui CONDITION WASM qt_extend_target(Gui CONDITION WASM

File diff suppressed because it is too large Load Diff

View File

@ -698,28 +698,13 @@ qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AN
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32 qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite3 AND WIN32
SOURCES SOURCES
text/windows/qwindowsdirectwritefontdatabase.cpp text/windows/qwindowsdirectwritefontdatabase_p.h text/windows/qwindowsdirectwritefontdatabase.cpp text/windows/qwindowsdirectwritefontdatabase_p.h
DEFINES
QT_USE_DIRECTWRITE2
QT_USE_DIRECTWRITE3
LIBRARIES LIBRARIES
dwrite_3 dwrite # special case
) )
qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT QT_FEATURE_directwrite3 qt_extend_target(Gui CONDITION QT_FEATURE_direct2d AND QT_FEATURE_directwrite AND WIN32 AND NOT QT_FEATURE_directwrite3
DEFINES
QT_USE_DIRECTWRITE2
LIBRARIES LIBRARIES
dwrite_2 dwrite # special case
)
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 qt_extend_target(Gui CONDITION MINGW AND WIN32
@ -848,10 +833,10 @@ add_custom_command(
# qvkgen_pimpl.input = "QMAKE_QVKGEN_INPUT" # qvkgen_pimpl.input = "QMAKE_QVKGEN_INPUT"
# qvkgen_pimpl.output = "$$OUT_PWD/vulkan/qvulkanfunctions_p.cpp" # qvkgen_pimpl.output = "$$OUT_PWD/vulkan/qvulkanfunctions_p.cpp"
#### Keys ignored in scope 103:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan: #### Keys ignored in scope 100:.:vulkan:vulkan/vulkan.pri:QT_FEATURE_vulkan:
# qvkgen_h.variable_out = "HEADERS" # qvkgen_h.variable_out = "HEADERS"
#### Keys ignored in scope 104:.:vulkan:vulkan/vulkan.pri:else: #### Keys ignored in scope 101:.:vulkan:vulkan/vulkan.pri:else:
# qvkgen_h.CONFIG = "target_predeps" "no_link" # qvkgen_h.CONFIG = "target_predeps" "no_link"
qt_extend_target(Gui CONDITION WASM qt_extend_target(Gui CONDITION WASM

View File

@ -532,6 +532,68 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof(nullptr, 0, 0, 0, 0,
} }
") ")
# special case begin
# directwrite (assumes DirectWrite2)
qt_config_compile_test(directwrite
LABEL "WINDOWS directwrite"
LIBRARIES
dwrite
CODE
"#include <dwrite_2.h>
int main(int, char **)
{
IUnknown *factory = nullptr;
DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory2),
&factory);
return 0;
}
")
# directwrite3 (not present in MinGW)
qt_config_compile_test(directwrite3
LABEL "WINDOWS directwrite3"
LIBRARIES
dwrite
CODE
"#include <dwrite_3.h>
int main(int, char **)
{
IUnknown *factory = nullptr;
DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory3),
&factory);
return 0;
}
")
qt_config_compile_test(d2d1
LABEL "WINDOWS Direct2D"
LIBRARIES
d2d1
CODE
"#include <d2d1.h>
int main(int, char **)
{
void *factory = nullptr;
D2D1_FACTORY_OPTIONS options{0};
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, GUID{}, &options, &factory);
return 0;
}
")
qt_config_compile_test(d2d1_1
LABEL "WINDOWS Direct2D 1.1"
LIBRARIES
d2d1
CODE
"#include <d2d1_1.h>
int main(int, char **)
{
ID2D1Factory1 *d2dFactory;
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &d2dFactory);
return 0;
}
")
# special case end
#### Features #### Features
@ -549,31 +611,21 @@ qt_feature("directfb" PRIVATE
) )
qt_feature("directwrite" PRIVATE qt_feature("directwrite" PRIVATE
LABEL "DirectWrite" LABEL "DirectWrite"
CONDITION libs.dwrite OR FIXME CONDITION TEST_directwrite # special case
EMIT_IF WIN32
)
qt_feature("directwrite1" PRIVATE
LABEL "DirectWrite 1"
CONDITION libs.dwrite_1 OR FIXME
EMIT_IF WIN32 EMIT_IF WIN32
) )
qt_feature("directwrite3" PRIVATE qt_feature("directwrite3" PRIVATE
LABEL "DirectWrite 3" LABEL "DirectWrite 3"
CONDITION QT_FEATURE_directwrite1 AND libs.dwrite_3 OR FIXME CONDITION QT_FEATURE_directwrite AND TEST_directwrite3 # special case
EMIT_IF WIN32
)
qt_feature("directwrite2" PRIVATE
LABEL "DirectWrite 2"
CONDITION QT_FEATURE_directwrite1 AND libs.dwrite_2 OR FIXME
EMIT_IF WIN32 EMIT_IF WIN32
) )
qt_feature("direct2d" PRIVATE qt_feature("direct2d" PRIVATE
LABEL "Direct 2D" LABEL "Direct 2D"
CONDITION WIN32 AND libs.d2d1 OR FIXME CONDITION WIN32 AND NOT WINRT AND TEST_d2d1 # special case
) )
qt_feature("direct2d1_1" PRIVATE qt_feature("direct2d1_1" PRIVATE
LABEL "Direct 2D 1.1" LABEL "Direct 2D 1.1"
CONDITION QT_FEATURE_direct2d AND libs.d2d1_1 OR FIXME CONDITION QT_FEATURE_direct2d AND TEST_d2d1_1 # special case
) )
qt_feature("evdev" PRIVATE qt_feature("evdev" PRIVATE
LABEL "evdev" LABEL "evdev"
@ -1219,8 +1271,9 @@ qt_configure_end_summary_section() # end of "GL integrations" section
qt_configure_end_summary_section() # end of "XCB" section qt_configure_end_summary_section() # end of "XCB" section
qt_configure_add_summary_section(NAME "Windows") qt_configure_add_summary_section(NAME "Windows")
qt_configure_add_summary_entry(ARGS "direct2d") qt_configure_add_summary_entry(ARGS "direct2d")
qt_configure_add_summary_entry(ARGS "direct2d1_1") ### special case
qt_configure_add_summary_entry(ARGS "directwrite") qt_configure_add_summary_entry(ARGS "directwrite")
qt_configure_add_summary_entry(ARGS "directwrite2") qt_configure_add_summary_entry(ARGS "directwrite3")
qt_configure_end_summary_section() # end of "Windows" section qt_configure_end_summary_section() # end of "Windows" section
qt_configure_end_summary_section() # end of "QPA backends" section qt_configure_end_summary_section() # end of "QPA backends" section
qt_configure_add_report_entry( qt_configure_add_report_entry(

View File

@ -96,27 +96,6 @@
{ "type": "pkgConfig", "args": "directfb" } { "type": "pkgConfig", "args": "directfb" }
] ]
}, },
"dwrite": {
"label": "DirectWrite",
"test": {
"main": [
"IDWriteFactory *factory = 0;",
"DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),",
" (IUnknown **)(&factory));"
]
},
"headers": "dwrite.h",
"sources": [
"-ldwrite"
]
},
"dwrite_1": {
"label": "DirectWrite 1",
"headers": "dwrite_1.h",
"sources": [
"-ldwrite"
]
},
"dwrite_2": { "dwrite_2": {
"label": "DirectWrite 2", "label": "DirectWrite 2",
"test": { "test": {
@ -1046,25 +1025,13 @@
"directwrite": { "directwrite": {
"label": "DirectWrite", "label": "DirectWrite",
"emitIf": "config.win32", "emitIf": "config.win32",
"condition": "libs.dwrite", "condition": "libs.dwrite_2",
"output": [ "privateFeature" ]
},
"directwrite1": {
"label": "DirectWrite 1",
"emitIf": "config.win32",
"condition": "libs.dwrite_1",
"output": [ "privateFeature" ] "output": [ "privateFeature" ]
}, },
"directwrite3": { "directwrite3": {
"label": "DirectWrite 3", "label": "DirectWrite 3",
"emitIf": "config.win32", "emitIf": "config.win32",
"condition": "features.directwrite1 && libs.dwrite_3", "condition": "features.directwrite && libs.dwrite_3",
"output": [ "privateFeature" ]
},
"directwrite2": {
"label": "DirectWrite 2",
"emitIf": "config.win32",
"condition": "features.directwrite1 && libs.dwrite_2",
"output": [ "privateFeature" ] "output": [ "privateFeature" ]
}, },
"direct2d": { "direct2d": {
@ -1874,7 +1841,7 @@
"section": "Windows", "section": "Windows",
"condition": "config.win32", "condition": "config.win32",
"entries": [ "entries": [
"direct2d", "directwrite", "directwrite2" "direct2d", "directwrite", "directwrite3"
] ]
} }
] ]

View File

@ -51,6 +51,7 @@
// We mean it. // We mean it.
// //
#include <QtGui/qtguiglobal.h>
#include <QtGui/private/qtgui-config_p.h> #include <QtGui/private/qtgui-config_p.h>
QT_REQUIRE_CONFIG(directwrite3); QT_REQUIRE_CONFIG(directwrite3);

View File

@ -19,22 +19,16 @@ qtConfig(freetype) {
qtConfig(directwrite):qtConfig(direct2d) { qtConfig(directwrite):qtConfig(direct2d) {
qtConfig(directwrite3) { qtConfig(directwrite3) {
QMAKE_USE_PRIVATE += dwrite_3 QMAKE_USE_PRIVATE += dwrite_3
DEFINES *= QT_USE_DIRECTWRITE3 QT_USE_DIRECTWRITE2
SOURCES += text/windows/qwindowsdirectwritefontdatabase.cpp SOURCES += text/windows/qwindowsdirectwritefontdatabase.cpp
HEADERS += text/windows/qwindowsdirectwritefontdatabase_p.h HEADERS += text/windows/qwindowsdirectwritefontdatabase_p.h
} else: qtConfig(directwrite2) {
QMAKE_USE_PRIVATE += dwrite_2
DEFINES *= QT_USE_DIRECTWRITE2
} else { } else {
QMAKE_USE_PRIVATE += dwrite QMAKE_USE_PRIVATE += dwrite_2
} }
QMAKE_USE_PRIVATE += d2d1 QMAKE_USE_PRIVATE += d2d1
SOURCES += text/windows/qwindowsfontenginedirectwrite.cpp SOURCES += text/windows/qwindowsfontenginedirectwrite.cpp
HEADERS += text/windows/qwindowsfontenginedirectwrite_p.h HEADERS += text/windows/qwindowsfontenginedirectwrite_p.h
} else {
DEFINES *= QT_NO_DIRECTWRITE
} }
QMAKE_USE_PRIVATE += advapi32 ole32 user32 gdi32 QMAKE_USE_PRIVATE += advapi32 ole32 user32 gdi32

View File

@ -21,7 +21,7 @@ endif()
if(WIN32) if(WIN32)
add_subdirectory(windows) add_subdirectory(windows)
endif() endif()
if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite1) if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite)
add_subdirectory(direct2d) add_subdirectory(direct2d)
endif() endif()
if(QNX) if(QNX)

View File

@ -21,7 +21,7 @@ endif()
if(WIN32) if(WIN32)
add_subdirectory(windows) add_subdirectory(windows)
endif() endif()
if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite1) if(QT_FEATURE_direct2d1_1 AND QT_FEATURE_directwrite)
# add_subdirectory(direct2d) # special case TODO # add_subdirectory(direct2d) # special case TODO
endif() endif()
if(QNX) if(QNX)

View File

@ -4,7 +4,7 @@ QT += \
core-private gui-private core-private gui-private
LIBS += -ldwmapi -lversion -ld3d11 -ldxgi -ldxguid LIBS += -ldwmapi -lversion -ld3d11 -ldxgi -ldxguid
QMAKE_USE_PRIVATE += gdi32 dwrite_1 d2d1_1 QMAKE_USE_PRIVATE += gdi32 dwrite_2 d2d1_1
include(../windows/windows.pri) include(../windows/windows.pri)

View File

@ -16,7 +16,7 @@ osx: SUBDIRS += cocoa
win32: SUBDIRS += windows win32: SUBDIRS += windows
qtConfig(direct2d1_1):qtConfig(directwrite1) { qtConfig(direct2d1_1):qtConfig(directwrite) {
SUBDIRS += direct2d SUBDIRS += direct2d
} }

View File

@ -90,13 +90,7 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
Qt::OpenGLPrivate Qt::OpenGLPrivate
) )
qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_directwrite3 #### Keys ignored in scope 3:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
DEFINES
QT_USE_DIRECTWRITE2
QT_USE_DIRECTWRITE3
)
#### Keys ignored in scope 4:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
# PLUGIN_EXTENDS = "-" # PLUGIN_EXTENDS = "-"
qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl

View File

@ -91,13 +91,7 @@ qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl
Qt::OpenGLPrivate Qt::OpenGLPrivate
) )
qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_directwrite3 #### Keys ignored in scope 3:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
DEFINES
QT_USE_DIRECTWRITE2
QT_USE_DIRECTWRITE3
)
#### Keys ignored in scope 4:.:.:windows.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
# PLUGIN_EXTENDS = "-" # PLUGIN_EXTENDS = "-"
qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl qt_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl

View File

@ -5,8 +5,6 @@ QT += \
qtConfig(opengl): QT += opengl-private qtConfig(opengl): QT += opengl-private
qtConfig(directwrite3): DEFINES *= QT_USE_DIRECTWRITE2 QT_USE_DIRECTWRITE3
LIBS += -ldwmapi LIBS += -ldwmapi
QMAKE_USE_PRIVATE += gdi32 QMAKE_USE_PRIVATE += gdi32