winphone: Remove old non-DirectWrite code

Since 8.1, DirectWrite is always used on WinRT platforms.

Change-Id: I742e4a48be6c478a62c16a32cf89852b850aff9d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
This commit is contained in:
Andrew Knight 2015-08-03 08:16:45 +03:00
parent 4a552d95f6
commit 18c4a08623
3 changed files with 2 additions and 36 deletions

View File

@ -39,13 +39,11 @@
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QFile> #include <QtCore/QFile>
#ifdef QT_WINRT_USE_DWRITE
#include <QtCore/QUuid> #include <QtCore/QUuid>
#include <QtGui/private/qfontengine_ft_p.h> #include <QtGui/private/qfontengine_ft_p.h>
#include <dwrite_1.h> #include <dwrite_1.h>
#include <wrl.h> #include <wrl.h>
using namespace Microsoft::WRL; using namespace Microsoft::WRL;
#endif // QT_WINRT_USE_DWRITE
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -122,9 +120,7 @@ QString QWinRTFontDatabase::fontDir() const
const QString applicationDirPath = QCoreApplication::applicationDirPath(); const QString applicationDirPath = QCoreApplication::applicationDirPath();
fontDirectory = applicationDirPath + QLatin1String("/fonts"); fontDirectory = applicationDirPath + QLatin1String("/fonts");
if (!QFile::exists(fontDirectory)) { if (!QFile::exists(fontDirectory)) {
#ifdef QT_WINRT_USE_DWRITE
if (m_fontFamilies.isEmpty()) if (m_fontFamilies.isEmpty())
#endif
qWarning("No fonts directory found in application package."); qWarning("No fonts directory found in application package.");
fontDirectory = applicationDirPath; fontDirectory = applicationDirPath;
} }
@ -132,8 +128,6 @@ QString QWinRTFontDatabase::fontDir() const
return fontDirectory; return fontDirectory;
} }
#ifdef QT_WINRT_USE_DWRITE
QWinRTFontDatabase::~QWinRTFontDatabase() QWinRTFontDatabase::~QWinRTFontDatabase()
{ {
foreach (IDWriteFontFile *fontFile, m_fonts.keys()) foreach (IDWriteFontFile *fontFile, m_fonts.keys())
@ -449,13 +443,4 @@ void QWinRTFontDatabase::releaseHandle(void *handle)
QBasicFontDatabase::releaseHandle(handle); QBasicFontDatabase::releaseHandle(handle);
} }
#else // QT_WINRT_USE_DWRITE
QFont QWinRTFontDatabase::defaultFont() const
{
return QFont(QFontDatabase().families().value(0));
}
#endif // !QT_WINRT_USE_DWRITE
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -39,26 +39,21 @@
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h> #include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
#ifdef QT_WINRT_USE_DWRITE
struct IDWriteFontFile; struct IDWriteFontFile;
struct IDWriteFontFamily; struct IDWriteFontFamily;
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifdef QT_WINRT_USE_DWRITE
struct FontDescription struct FontDescription
{ {
quint32 index; quint32 index;
QByteArray uuid; QByteArray uuid;
}; };
#endif
class QWinRTFontDatabase : public QBasicFontDatabase class QWinRTFontDatabase : public QBasicFontDatabase
{ {
public: public:
QString fontDir() const; QString fontDir() const;
#ifdef QT_WINRT_USE_DWRITE
~QWinRTFontDatabase(); ~QWinRTFontDatabase();
QFont defaultFont() const Q_DECL_OVERRIDE; QFont defaultFont() const Q_DECL_OVERRIDE;
bool fontsAlwaysScalable() const Q_DECL_OVERRIDE; bool fontsAlwaysScalable() const Q_DECL_OVERRIDE;
@ -69,7 +64,6 @@ public:
private: private:
QHash<IDWriteFontFile *, FontDescription> m_fonts; QHash<IDWriteFontFile *, FontDescription> m_fonts;
QHash<QString, IDWriteFontFamily *> m_fontFamilies; QHash<QString, IDWriteFontFamily *> m_fontFamilies;
#endif // QT_WINRT_USE_DWRITE
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -1,14 +1,6 @@
TARGET = qwinrt TARGET = qwinrt
CONFIG -= precompile_header CONFIG -= precompile_header
# For Windows Phone 8 we have to deploy fonts together with the application as DirectWrite
# is not supported here.
winphone:equals(WINSDK_VER, 8.0): {
fonts.path = $$[QT_INSTALL_LIBS]/fonts
fonts.files = $$QT_SOURCE_TREE/lib/fonts/DejaVu*.ttf
INSTALLS += fonts
}
PLUGIN_TYPE = platforms PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QWinRTIntegrationPlugin PLUGIN_CLASS_NAME = QWinRTIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - !equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
@ -18,13 +10,8 @@ QT += core-private gui-private platformsupport-private
DEFINES *= QT_NO_CAST_FROM_ASCII __WRL_NO_DEFAULT_LIB__ GL_GLEXT_PROTOTYPES DEFINES *= QT_NO_CAST_FROM_ASCII __WRL_NO_DEFAULT_LIB__ GL_GLEXT_PROTOTYPES
LIBS += $$QMAKE_LIBS_CORE LIBS += $$QMAKE_LIBS_CORE -ldwrite
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/freetype/include
!if(winphone:equals(WINSDK_VER, 8.0)) {
LIBS += -ldwrite
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/freetype/include
DEFINES += QT_WINRT_USE_DWRITE
}
SOURCES = \ SOURCES = \
main.cpp \ main.cpp \