summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qabstractfontengine_p.h2
-rw-r--r--src/gui/text/qfont.cpp198
-rw-r--r--src/gui/text/qfont.h21
-rw-r--r--src/gui/text/qfont_p.h28
-rw-r--r--src/gui/text/qfontdatabase.cpp457
-rw-r--r--src/gui/text/qfontdatabase.h5
-rw-r--r--src/gui/text/qfontengine.cpp14
-rw-r--r--src/gui/text/qfontengine_ft.cpp4
-rw-r--r--src/gui/text/qfontengine_ft_p.h10
-rw-r--r--src/gui/text/qfontengine_p.h67
-rw-r--r--src/gui/text/qfontengine_qpf.cpp31
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h9
-rw-r--r--src/gui/text/qfontmetrics.cpp16
-rw-r--r--src/gui/text/qfontmetrics.h6
-rw-r--r--src/gui/text/qfontsubset.cpp34
-rw-r--r--src/gui/text/qlinecontrol.cpp39
-rw-r--r--src/gui/text/qrawfont.cpp18
-rw-r--r--src/gui/text/qrawfont_ft.cpp11
-rw-r--r--src/gui/text/qrawfont_p.h20
-rw-r--r--src/gui/text/qtextcontrol.cpp10
-rw-r--r--src/gui/text/qtextengine.cpp222
-rw-r--r--src/gui/text/qtextengine_p.h6
-rw-r--r--src/gui/text/qtextlayout.cpp17
23 files changed, 2 insertions, 1243 deletions
diff --git a/src/gui/text/qabstractfontengine_p.h b/src/gui/text/qabstractfontengine_p.h
index 44bb6be84f..b744d6664c 100644
--- a/src/gui/text/qabstractfontengine_p.h
+++ b/src/gui/text/qabstractfontengine_p.h
@@ -91,9 +91,7 @@ public:
virtual Type type() const { return Proxy; }
virtual const char *name() const { return "proxy engine"; }
-#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN)
virtual void draw(QPaintEngine *, qreal, qreal, const QTextItemInt &);
-#endif
inline QAbstractFontEngine::Capabilities capabilities() const
{ return engineCapabilities; }
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 3d2dfb9c76..7cd9fb15e9 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -62,17 +62,8 @@
#include <private/qtextengine_p.h>
#include <limits.h>
-#ifdef Q_WS_X11
-#include "qx11info_x11.h"
-#include <private/qt_x11_p.h>
-#endif
-#ifdef Q_OS_SYMBIAN
-#include <private/qt_s60_p.h>
-#endif
-#ifdef Q_WS_QPA
#include <QtGui/qplatformscreen_qpa.h>
#include <QtGui/private/qguiapplication_p.h>
-#endif
#include <QtCore/QMutexLocker>
#include <QtCore/QMutex>
@@ -86,13 +77,7 @@
QT_BEGIN_NAMESPACE
-#ifdef Q_WS_WIN
-extern HDC shared_dc();
-#endif
-#ifdef Q_WS_X11
-extern const QX11Info *qt_x11Info(const QPaintDevice *pd);
-#endif
bool QFontDef::exactMatch(const QFontDef &other) const
{
@@ -146,9 +131,6 @@ bool QFontDef::exactMatch(const QFontDef &other) const
&& (this_foundry.isEmpty()
|| other_foundry.isEmpty()
|| this_foundry == other_foundry)
-#ifdef Q_WS_X11
- && addStyle == other.addStyle
-#endif // Q_WS_X11
);
}
@@ -160,14 +142,6 @@ Q_GUI_EXPORT int qt_defaultDpiX()
return 75;
int dpi;
-#ifdef Q_WS_X11
- dpi = QX11Info::appDpiX();
-#elif defined(Q_WS_WIN)
- dpi = GetDeviceCaps(shared_dc(),LOGPIXELSX);
-#elif defined(Q_WS_MAC)
- extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp
- dpi = qt_mac_defaultDpi_x();
-#elif defined(Q_WS_QPA)
QScreen *screen = QGuiApplication::primaryScreen();
if (screen) {
dpi = qRound(screen->logicalDotsPerInchX());
@@ -175,9 +149,6 @@ Q_GUI_EXPORT int qt_defaultDpiX()
//PI has not been initialised, or it is being initialised. Give a default dpi
dpi = 100;
}
-#elif defined(Q_OS_SYMBIAN)
- dpi = S60->defaultDpiX;
-#endif // Q_WS_X11
return dpi;
}
@@ -188,14 +159,6 @@ Q_GUI_EXPORT int qt_defaultDpiY()
return 75;
int dpi;
-#ifdef Q_WS_X11
- dpi = QX11Info::appDpiY();
-#elif defined(Q_WS_WIN)
- dpi = GetDeviceCaps(shared_dc(),LOGPIXELSY);
-#elif defined(Q_WS_MAC)
- extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp
- dpi = qt_mac_defaultDpi_y();
-#elif defined(Q_WS_QPA)
QScreen *screen = QGuiApplication::primaryScreen();
if (screen) {
dpi = qRound(screen->logicalDotsPerInchY());
@@ -203,9 +166,6 @@ Q_GUI_EXPORT int qt_defaultDpiY()
//PI has not been initialised, or it is being initialised. Give a default dpi
dpi = 100;
}
-#elif defined(Q_OS_SYMBIAN)
- dpi = S60->defaultDpiY;
-#endif // Q_WS_X11
return dpi;
}
@@ -220,15 +180,6 @@ QFontPrivate::QFontPrivate()
rawMode(false), underline(false), overline(false), strikeOut(false), kerning(true),
capital(0), letterSpacingIsAbsolute(false), scFont(0)
{
-#ifdef Q_WS_X11
- if (QX11Info::display())
- screen = QX11Info::appScreen();
- else
- screen = 0;
-#endif
-#ifdef Q_WS_WIN
- hdc = 0;
-#endif
}
QFontPrivate::QFontPrivate(const QFontPrivate &other)
@@ -239,9 +190,6 @@ QFontPrivate::QFontPrivate(const QFontPrivate &other)
letterSpacing(other.letterSpacing), wordSpacing(other.wordSpacing),
scFont(other.scFont)
{
-#ifdef Q_WS_WIN
- hdc = other.hdc;
-#endif
if (scFont && scFont != this)
scFont->ref.ref();
}
@@ -258,11 +206,7 @@ QFontPrivate::~QFontPrivate()
extern QMutex *qt_fontdatabase_mutex();
-#if !defined(Q_WS_MAC)
#define QT_FONT_ENGINE_FROM_DATA(data, script) data->engines[script]
-#else
-#define QT_FONT_ENGINE_FROM_DATA(data, script) data->engine
-#endif
QFontEngine *QFontPrivate::engineForScript(int script) const
{
@@ -379,26 +323,16 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other)
QFontEngineData::QFontEngineData()
: ref(1), fontCache(QFontCache::instance())
{
-#if !defined(Q_WS_MAC)
memset(engines, 0, QUnicodeTables::ScriptCount * sizeof(QFontEngine *));
-#else
- engine = 0;
-#endif
}
QFontEngineData::~QFontEngineData()
{
-#if !defined(Q_WS_MAC)
for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) {
if (engines[i])
engines[i]->ref.deref();
engines[i] = 0;
}
-#else
- if (engine)
- engine->ref.deref();
- engine = 0;
-#endif // Q_WS_X11 || Q_WS_WIN || Q_WS_MAC
}
@@ -710,12 +644,7 @@ QFont::QFont(const QFont &font, QPaintDevice *pd)
{
Q_ASSERT(pd != 0);
int dpi = pd->logicalDpiY();
-#ifdef Q_WS_X11
- const QX11Info *info = qt_x11Info(pd);
- int screen = info ? info->screen() : 0;
-#else
const int screen = 0;
-#endif
if (font.d->dpi != dpi || font.d->screen != screen ) {
d = new QFontPrivate(*font.d);
d->dpi = dpi;
@@ -723,10 +652,6 @@ QFont::QFont(const QFont &font, QPaintDevice *pd)
} else {
d = font.d.data();
}
-#ifdef Q_WS_WIN
- if (pd->devType() == QInternal::Printer && pd->getDC())
- d->hdc = pd->getDC();
-#endif
}
/*!
@@ -787,11 +712,7 @@ QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
: d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved)
{
if (pointSize <= 0) {
-#ifdef Q_OS_SYMBIAN
- pointSize = 7;
-#else
pointSize = 12;
-#endif
} else {
resolve_mask |= QFont::SizeResolved;
}
@@ -866,9 +787,6 @@ void QFont::setFamily(const QString &family)
detach();
d->request.family = family;
-#if defined(Q_WS_X11)
- d->request.addStyle.clear();
-#endif // Q_WS_X11
resolve_mask |= QFont::FamilyResolved;
}
@@ -1457,9 +1375,6 @@ void QFont::setStyleHint(StyleHint hint, StyleStrategy strategy)
resolve_mask |= QFont::StyleHintResolved;
resolve_mask |= QFont::StyleStrategyResolved;
-#if defined(Q_WS_X11)
- d->request.addStyle.clear();
-#endif // Q_WS_X11
}
/*!
@@ -1780,9 +1695,6 @@ bool QFont::operator<(const QFont &f) const
if (r1.styleHint != r2.styleHint) return r1.styleHint < r2.styleHint;
if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy;
if (r1.family != r2.family) return r1.family < r2.family;
-#ifdef Q_WS_X11
- if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle;
-#endif // Q_WS_X11
if (f.d->capital != d->capital) return f.d->capital < d->capital;
if (f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute) return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute;
@@ -1886,17 +1798,6 @@ static void initFontSubst()
// default substitutions
static const char * const initTbl[] = {
-#if defined(Q_WS_X11)
- "arial", "helvetica",
- "times new roman", "times",
- "courier new", "courier",
- "sans serif", "helvetica",
-#elif defined(Q_WS_WIN)
- "times", "times new roman",
- "courier", "courier new",
- "helvetica", "arial",
- "sans serif", "arial",
-#endif
0, 0
};
@@ -1905,10 +1806,6 @@ static void initFontSubst()
Q_ASSERT(fontSubst != 0);
if (!fontSubst->isEmpty())
return;
-#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)
- if (X11->has_fontconfig)
- return;
-#endif
for (int i=0; initTbl[i] != 0; i += 2) {
QStringList &list = (*fontSubst)[QString::fromLatin1(initTbl[i])];
@@ -2211,7 +2108,6 @@ bool QFont::fromString(const QString &descrip)
return true;
}
-#if !defined(Q_WS_QWS)
/*! \internal
Internal function that dumps font cache statistics.
@@ -2221,7 +2117,6 @@ void QFont::cacheStatistics()
}
-#endif // !Q_WS_QWS
@@ -2255,11 +2150,7 @@ QDataStream &operator<<(QDataStream &s, const QFont &font)
} else if (s.version() <= 3) {
qint16 pointSize = (qint16) (font.d->request.pointSize * 10);
if (pointSize < 0) {
-#ifdef Q_WS_X11
- pointSize = (qint16)(font.d->request.pixelSize*720/QX11Info::appDpiY());
-#else
pointSize = (qint16)QFontInfo(font).pointSize() * 10;
-#endif
}
s << pointSize;
} else {
@@ -2775,19 +2666,12 @@ void QFontCache::clear()
end = engineDataCache.end();
while (it != end) {
QFontEngineData *data = it.value();
-#if !defined(Q_WS_MAC)
for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) {
if (data->engines[i]) {
data->engines[i]->ref.deref();
data->engines[i] = 0;
}
}
-#else
- if (data->engine) {
- data->engine->ref.deref();
- data->engine = 0;
- }
-#endif
++it;
}
}
@@ -2811,17 +2695,6 @@ void QFontCache::clear()
engineCache.clear();
}
-#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2)
-void QFontCache::removeEngineForFont(const QByteArray &_fontName)
-{
-
- /* This could be optimized but the code becomes much more complex if we want to handle multi
- * font engines and it is probably not worth it. Therefore we just clear the entire font cache.
- */
- Q_UNUSED(_fontName);
- clear();
-}
-#endif
QFontEngineData *QFontCache::findEngineData(const Key &key) const
{
@@ -2909,69 +2782,6 @@ void QFontCache::decreaseCost(uint cost)
cost, total_cost, max_cost);
}
-#if defined(Q_WS_WIN) || defined (Q_WS_QWS)
-void QFontCache::cleanupPrinterFonts()
-{
- FC_DEBUG("QFontCache::cleanupPrinterFonts");
-
- {
- FC_DEBUG(" CLEAN engine data:");
-
- // clean out all unused engine data
- EngineDataCache::Iterator it = engineDataCache.begin(),
- end = engineDataCache.end();
- while (it != end) {
- if (it.key().screen == 0) {
- ++it;
- continue;
- }
-
- if(it.value()->ref != 0) {
- for(int i = 0; i < QUnicodeTables::ScriptCount; ++i) {
- if(it.value()->engines[i]) {
- it.value()->engines[i]->ref.deref();
- it.value()->engines[i] = 0;
- }
- }
- ++it;
- } else {
-
- EngineDataCache::Iterator rem = it++;
-
- decreaseCost(sizeof(QFontEngineData));
-
- FC_DEBUG(" %p", rem.value());
-
- delete rem.value();
- engineDataCache.erase(rem);
- }
- }
- }
-
- EngineCache::Iterator it = engineCache.begin(),
- end = engineCache.end();
- while(it != end) {
- if (it.value().data->ref != 0 || it.key().screen == 0) {
- ++it;
- continue;
- }
-
- FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'",
- it.value().data, it.value().timestamp, it.value().hits,
- int(it.value().data->ref), it.value().data->cache_count,
- it.value().data->name());
-
- if (--it.value().data->cache_count == 0) {
- FC_DEBUG(" DELETE: last occurrence in cache");
-
- decreaseCost(it.value().data->cache_cost);
- delete it.value().data;
- }
-
- engineCache.erase(it++);
- }
-}
-#endif
void QFontCache::timerEvent(QTimerEvent *)
{
@@ -3004,14 +2814,6 @@ void QFontCache::timerEvent(QTimerEvent *)
#ifdef QFONTCACHE_DEBUG
FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref));
-# if defined(Q_WS_X11) || defined(Q_WS_WIN)
- // print out all engines
- for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) {
- if (! it.value()->engines[i])
- continue;
- FC_DEBUG(" contains %p", it.value()->engines[i]);
- }
-# endif // Q_WS_X11 || Q_WS_WIN
#endif // QFONTCACHE_DEBUG
if (it.value()->ref != 0)
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 421c1dd2de..326dc9d63e 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -46,9 +46,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qsharedpointer.h>
-#if defined(Q_WS_X11) || defined(Q_WS_QWS)
-typedef struct FT_FaceRec_* FT_Face;
-#endif
QT_BEGIN_HEADER
@@ -246,17 +243,7 @@ public:
{ qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
#endif
-#ifdef Q_WS_WIN
- HFONT handle() const;
-#else // !Q_WS_WIN
Qt::HANDLE handle() const;
-#endif // Q_WS_WIN
-#ifdef Q_WS_MAC
- quint32 macFontID() const;
-#endif
-#if defined(Q_WS_X11) || defined(Q_WS_QWS)
- FT_Face freetypeFace() const;
-#endif
// needed for X11
void setRawName(const QString &);
@@ -275,9 +262,7 @@ public:
static void removeSubstitution(const QString &);
static void initialize();
static void cleanup();
-#ifndef Q_WS_QWS
static void cacheStatistics();
-#endif
QString defaultFamily() const;
QString lastResortFamily() const;
@@ -292,12 +277,6 @@ private:
void detach();
-#if defined(Q_WS_MAC)
- void macSetFont(QPaintDevice *);
-#elif defined(Q_WS_X11)
- void x11SetScreen(int screen = -1);
- int x11Screen() const;
-#endif
friend class QFontPrivate;
friend class QFontDialogPrivate;
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index ebc842c794..f4641ff77e 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -73,18 +73,12 @@ struct QFontDef
styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle),
weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100),
ignorePitch(true), hintingPreference(QFont::PreferDefaultHinting)
-#ifdef Q_WS_MAC
- ,fixedPitchComputed(false)
-#endif
{
}
QString family;
QString styleName;
-#ifdef Q_WS_X11
- QString addStyle;
-#endif // Q_WS_X11
qreal pointSize;
qreal pixelSize;
@@ -115,9 +109,6 @@ struct QFontDef
&& family == other.family
&& (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName)
&& hintingPreference == other.hintingPreference
-#ifdef Q_WS_X11
- && addStyle == other.addStyle
-#endif
;
}
inline bool operator<(const QFontDef &other) const
@@ -133,9 +124,6 @@ struct QFontDef
return styleName < other.styleName;
if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference;
-#ifdef Q_WS_X11
- if (addStyle != other.addStyle) return addStyle < other.addStyle;
-#endif // Q_WS_X11
if (ignorePitch != other.ignorePitch) return ignorePitch < other.ignorePitch;
if (fixedPitch != other.fixedPitch) return fixedPitch < other.fixedPitch;
@@ -152,20 +140,13 @@ public:
QAtomicInt ref;
QFontCache *fontCache;
-#if !defined(Q_WS_MAC)
QFontEngine *engines[QUnicodeTables::ScriptCount];
-#else
- QFontEngine *engine;
-#endif
};
class Q_GUI_EXPORT QFontPrivate
{
public:
-#ifdef Q_WS_X11
- static int defaultEncodingID;
-#endif // Q_WS_X11
QFontPrivate();
QFontPrivate(const QFontPrivate &other);
@@ -180,9 +161,6 @@ public:
int dpi;
int screen;
-#ifdef Q_WS_WIN
- HDC hdc;
-#endif
uint rawMode : 1;
uint underline : 1;
@@ -222,9 +200,6 @@ public:
~QFontCache();
void clear();
-#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2)
- void removeEngineForFont(const QByteArray &fontName);
-#endif
// universal key structure. QFontEngineDatas and QFontEngines are cached using
// the same keys
struct Key {
@@ -269,9 +244,6 @@ public:
QFontEngine *findEngine(const Key &key);
void insertEngine(const Key &key, QFontEngine *engine);
-#if defined(Q_WS_WIN) || defined(Q_WS_QWS)
- void cleanupPrinterFonts();
-#endif
private:
void increaseCost(uint cost);
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 680f63edb3..740cd4c52c 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -50,22 +50,13 @@
#include "private/qunicodetables_p.h"
#include "qfontengine_p.h"
-#ifdef Q_WS_QPA
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qplatformfontdatabase_qpa.h>
#include "qabstractfileengine.h"
-#endif
-#ifdef Q_WS_X11
-#include <locale.h>
-#endif
#include <stdlib.h>
#include <limits.h>
-#if (defined(Q_WS_QWS)|| defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE)
-# include <ft2build.h>
-# include FT_TRUETYPE_TABLES_H
-#endif
// #define QFONTDATABASE_DEBUG
#ifdef QFONTDATABASE_DEBUG
@@ -81,9 +72,6 @@
# define FM_DEBUG if (false) qDebug
#endif
-#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE)
-# include <dwrite.h>
-#endif
QT_BEGIN_NAMESPACE
@@ -164,53 +152,13 @@ struct QtFontEncoding
struct QtFontSize
{
-#ifdef Q_WS_X11
- QtFontEncoding *encodings;
- QtFontEncoding *encodingID(int id, uint xpoint = 0, uint xres = 0,
- uint yres = 0, uint avgwidth = 0, bool add = false);
- unsigned short count : 16;
-#endif // Q_WS_X11
-
-#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
- QByteArray fileName;
- int fileIndex;
-#endif // defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
-#if defined(Q_WS_QPA)
+
void *handle;
-#endif
unsigned short pixelSize : 16;
};
-#ifdef Q_WS_X11
-QtFontEncoding *QtFontSize::encodingID(int id, uint xpoint, uint xres,
- uint yres, uint avgwidth, bool add)
-{
- // we don't match using the xpoint, xres and yres parameters, only the id
- for (int i = 0; i < count; ++i) {
- if (encodings[i].encoding == id)
- return encodings + i;
- }
-
- if (!add) return 0;
-
- if (!(count % 4)) {
- QtFontEncoding *newEncodings = (QtFontEncoding *)
- realloc(encodings,
- (((count+4) >> 2) << 2) * sizeof(QtFontEncoding));
- Q_CHECK_PTR(newEncodings);
- encodings = newEncodings;
- }
- encodings[count].encoding = id;
- encodings[count].xpoint = xpoint;
- encodings[count].xres = xres;
- encodings[count].yres = yres;
- encodings[count].avgwidth = avgwidth;
- encodings[count].pitch = '*';
- return encodings + count++;
-}
-#endif // Q_WS_X11
struct QtFontStyle
{
@@ -241,34 +189,17 @@ struct QtFontStyle
: key(k), bitmapScalable(false), smoothScalable(false),
count(0), pixelSizes(0)
{
-#if defined(Q_WS_X11)
- weightName = setwidthName = 0;
-#endif // Q_WS_X11
}
~QtFontStyle() {
-#ifdef Q_WS_X11
- delete [] weightName;
- delete [] setwidthName;
-#endif
-#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
while (count) {
// bitfield count-- in while condition does not work correctly in mwccsym2
count--;
-#ifdef Q_WS_X11
- free(pixelSizes[count].encodings);
-#endif
-#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
- pixelSizes[count].fileName.~QByteArray();
-#endif
-#if defined (Q_WS_QPA)
QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
if (integration) { //on shut down there will be some that we don't release.
integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);
}
-#endif
}
-#endif
free(pixelSizes);
}
@@ -279,13 +210,7 @@ struct QtFontStyle
QtFontSize *pixelSizes;
QString styleName;
-#ifdef Q_WS_X11
- const char *weightName;
- const char *setwidthName;
-#endif // Q_WS_X11
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
bool antialiased;
-#endif
QtFontSize *pixelSize(unsigned short size, bool = false);
};
@@ -325,17 +250,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
pixelSizes = newPixelSizes;
}
pixelSizes[count].pixelSize = size;
-#ifdef Q_WS_X11
- pixelSizes[count].count = 0;
- pixelSizes[count].encodings = 0;
-#endif
-#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
- new (&pixelSizes[count].fileName) QByteArray;
- pixelSizes[count].fileIndex = 0;
-#endif
-#if defined(Q_WS_QPA)
pixelSizes[count].handle = 0;
-#endif
return pixelSizes + (count++);
}
@@ -412,26 +327,13 @@ struct QtFontFamily
QtFontFamily(const QString &n)
:
-#ifdef Q_WS_X11
- fixedPitch(true), ftWritingSystemCheck(false),
- xlfdLoaded(false), synthetic(false), symbol_checked(false),
-#else
fixedPitch(false),
-#endif
-#ifdef Q_WS_WIN
- writingSystemCheck(false),
- loaded(false),
-#endif
#if !defined(QWS) && defined(Q_OS_MAC)
fixedPitchComputed(false),
#endif
name(n), count(0), foundries(0)
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
, bogusWritingSystems(false)
-#endif
-#if defined(Q_WS_QPA)
, askedForFallback(false)
-#endif
{
memset(writingSystems, 0, sizeof(writingSystems));
}
@@ -442,40 +344,17 @@ struct QtFontFamily
}
bool fixedPitch : 1;
-#ifdef Q_WS_X11
- bool ftWritingSystemCheck : 1;
- bool xlfdLoaded : 1;
- bool synthetic : 1;
-#endif
-#ifdef Q_WS_WIN
- bool writingSystemCheck : 1;
- bool loaded : 1;
-#endif
#if !defined(QWS) && defined(Q_OS_MAC)
bool fixedPitchComputed : 1;
#endif
-#ifdef Q_WS_X11
- bool symbol_checked : 1;
-#endif
QString name;
-#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
- QByteArray fontFilename;
- int fontFileIndex;
-#endif
-#ifdef Q_WS_WIN
- QString english_name;
-#endif
int count;
QtFontFoundry **foundries;
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
bool bogusWritingSystems;
QStringList fallbackFamilies;
-#endif
-#if defined (Q_WS_QPA)
bool askedForFallback;
-#endif
unsigned char writingSystems[QFontDatabase::WritingSystemsCount];
QtFontFoundry *foundry(const QString &f, bool = false);
@@ -644,44 +523,16 @@ QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_truetype_b
return writingSystems;
}
-#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
-// class with virtual destructor, derived in qfontdatabase_s60.cpp
-class QSymbianFontDatabaseExtras
-{
-public:
- virtual ~QSymbianFontDatabaseExtras() {}
-};
-#endif
class QFontDatabasePrivate
{
public:
QFontDatabasePrivate()
: count(0), families(0), reregisterAppFonts(false)
-#if defined(Q_WS_QWS)
- , stream(0)
-#endif
-#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- , symbianExtras(0)
-#endif
-#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE)
- , directWriteFactory(0)
- , directWriteGdiInterop(0)
-#endif
{ }
~QFontDatabasePrivate() {
free();
-#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- if (symbianExtras)
- delete symbianExtras;
-#endif
-#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE)
- if (directWriteGdiInterop)
- directWriteGdiInterop->Release();
- if (directWriteFactory != 0)
- directWriteFactory->Release();
-#endif
}
QtFontFamily *family(const QString &f, bool = false);
void free() {
@@ -694,15 +545,8 @@ public:
}
int count;
-#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)
- QString systemLang;
-#endif
QtFontFamily **families;
-#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE)
- IDWriteFactory *directWriteFactory;
- IDWriteGdiInterop *directWriteGdiInterop;
-#endif
struct ApplicationFont {
@@ -728,27 +572,7 @@ public:
void invalidate();
-#if defined(Q_WS_QWS)
- bool loadFromCache(const QString &fontPath);
- void addQPF2File(const QByteArray &file);
-#endif // Q_WS_QWS
-#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
- void addFont(const QString &familyname, const char *foundryname, int weight,
- bool italic, int pixelSize, const QByteArray &file, int fileIndex,
- bool antialiased,
- const QList<QFontDatabase::WritingSystem> &writingSystems = QList<QFontDatabase::WritingSystem>());
-#ifndef QT_NO_FREETYPE
- QStringList addTTFile(const QByteArray &file, const QByteArray &fontData = QByteArray());
-#endif // QT_NO_FREETYPE
-#endif
-#if defined(Q_WS_QWS)
- QDataStream *stream;
-#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- QSymbianFontDatabaseExtras *symbianExtras;
-#endif
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
QStringList fallbackFamilies;
-#endif
};
void QFontDatabasePrivate::invalidate()
@@ -797,118 +621,7 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create)
return families[pos];
}
-#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
-void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize,
- const QByteArray &file, int fileIndex, bool antialiased,
- const QList<QFontDatabase::WritingSystem> &writingSystems)
-{
-// qDebug() << "Adding font" << familyname << weight << italic << pixelSize << file << fileIndex << antialiased;
- QtFontStyle::Key styleKey;
- styleKey.style = italic ? QFont::StyleItalic : QFont::StyleNormal;
- styleKey.weight = weight;
- styleKey.stretch = 100;
- QtFontFamily *f = family(familyname, true);
-
- if (writingSystems.isEmpty()) {
- for (int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) {
- f->writingSystems[ws] = QtFontFamily::Supported;
- }
- f->bogusWritingSystems = true;
- } else {
- for (int i = 0; i < writingSystems.count(); ++i) {
- f->writingSystems[writingSystems.at(i)] = QtFontFamily::Supported;
- }
- }
- QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true);
- QtFontStyle *style = foundry->style(styleKey, QString(), true);
- style->smoothScalable = (pixelSize == 0);
- style->antialiased = antialiased;
- QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
- size->fileName = file;
- size->fileIndex = fileIndex;
-
-#if defined(Q_WS_QWS)
- if (stream) {
- *stream << familyname << foundry->name << weight << quint8(italic) << pixelSize
- << file << fileIndex << quint8(antialiased);
- *stream << quint8(writingSystems.count());
- for (int i = 0; i < writingSystems.count(); ++i)
- *stream << quint8(writingSystems.at(i));
- }
-#else // ..in case of defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
- f->fontFilename = file;
- f->fontFileIndex = fileIndex;
-#endif
-}
-#endif
-
-#if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE)
-QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteArray &fontData)
-{
- QStringList families;
- extern FT_Library qt_getFreetype();
- FT_Library library = qt_getFreetype();
-
- int index = 0;
- int numFaces = 0;
- do {
- FT_Face face;
- FT_Error error;
- if (!fontData.isEmpty()) {
- error = FT_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face);
- } else {
- error = FT_New_Face(library, file, index, &face);
- }
- if (error != FT_Err_Ok) {
- qDebug() << "FT_New_Face failed with index" << index << ":" << hex << error;
- break;
- }
- numFaces = face->num_faces;
-
- int weight = QFont::Normal;
- bool italic = face->style_flags & FT_STYLE_FLAG_ITALIC;
-
- if (face->style_flags & FT_STYLE_FLAG_BOLD)
- weight = QFont::Bold;
-
- QList<QFontDatabase::WritingSystem> writingSystems;
- // detect symbol fonts
- for (int i = 0; i < face->num_charmaps; ++i) {
- FT_CharMap cm = face->charmaps[i];
- if (cm->encoding == ft_encoding_adobe_custom
- || cm->encoding == ft_encoding_symbol) {
- writingSystems.append(QFontDatabase::Symbol);
- break;
- }
- }
- if (writingSystems.isEmpty()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
- if (os2) {
- quint32 unicodeRange[4] = {
- static_cast<quint32>(os2->ulUnicodeRange1), static_cast<quint32>(os2->ulUnicodeRange2), static_cast<quint32>(os2->ulUnicodeRange3), static_cast<quint32>(os2->ulUnicodeRange4)
- };
- quint32 codePageRange[2] = {
- static_cast<quint32>(os2->ulCodePageRange1), static_cast<quint32>(os2->ulCodePageRange2)
- };
-
- writingSystems = qt_determine_writing_systems_from_truetype_bits(unicodeRange, codePageRange);
- //for (int i = 0; i < writingSystems.count(); ++i)
- // qDebug() << QFontDatabase::writingSystemName(writingSystems.at(i));
- }
- }
-
- QString family = QString::fromAscii(face->family_name);
- families.append(family);
- addFont(family, /*foundry*/ "", weight, italic,
- /*pixelsize*/ 0, file, index, /*antialias*/ true, writingSystems);
-
- FT_Done_Face(face);
- ++index;
- } while (index < numFaces);
- return families;
-}
-#endif
static const int scriptForWritingSystem[] = {
QUnicodeTables::Common, // Any
@@ -961,18 +674,6 @@ int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
}
-#if defined Q_WS_QWS || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN)
-static inline bool requiresOpenType(int writingSystem)
-{
- return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala)
- || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko);
-}
-static inline bool scriptRequiresOpenType(int script)
-{
- return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala)
- || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko);
-}
-#endif
/*!
@@ -1030,12 +731,10 @@ struct QtFontDesc
int familyIndex;
};
-#if !defined(Q_WS_MAC)
static void match(int script, const QFontDef &request,
const QString &family_name, const QString &foundry_name, int force_encoding_id,
QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>(), bool forceXLFD=false);
-#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA)
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef)
{
fontDef->family = desc.family->name;
@@ -1061,10 +760,7 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe
fontDef->stretch = desc.style->key.stretch;
fontDef->ignorePitch = false;
}
-#endif
-#endif
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || defined(Q_WS_QPA)
static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key)
{
// look for the requested font in the engine data cache
@@ -1077,7 +773,6 @@ static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key)
d->engineData->ref.ref();
}
}
-#endif
static QStringList familyList(const QFontDef &req)
{
@@ -1117,26 +812,8 @@ QMutex *qt_fontdatabase_mutex()
}
QT_BEGIN_INCLUDE_NAMESPACE
-#if defined(Q_WS_X11)
-# include "qfontdatabase_x11.cpp"
-#elif defined(Q_WS_MAC)
-# include "qfontdatabase_mac.cpp"
-#elif defined(Q_WS_WIN)
-# include "qfontdatabase_win.cpp"
-#elif defined(Q_WS_QWS)
-# include "qfontdatabase_qws.cpp"
-#elif defined(Q_WS_QPA)
# include "qfontdatabase_qpa.cpp"
-#elif defined(Q_OS_SYMBIAN)
-# include "qfontdatabase_s60.cpp"
-#endif
QT_END_INCLUDE_NAMESPACE
-#if !defined(Q_WS_X11) && !defined(Q_WS_QPA)
-QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
-{
- return family;
-}
-#endif
static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey,
const QString &styleName = QString())
@@ -1177,56 +854,7 @@ static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &st
return foundry->styles[best];
}
-#if defined(Q_WS_X11)
-static QtFontEncoding *findEncoding(int script, int styleStrategy,
- QtFontSize *size, int force_encoding_id)
-{
- QtFontEncoding *encoding = 0;
-
- if (force_encoding_id >= 0) {
- encoding = size->encodingID(force_encoding_id);
- if (!encoding)
- FM_DEBUG(" required encoding_id not available");
- return encoding;
- }
-
- if (styleStrategy & (QFont::OpenGLCompatible | QFont::PreferBitmap)) {
- FM_DEBUG(" PreferBitmap and/or OpenGL set, skipping Freetype");
- } else {
- encoding = size->encodingID(-1); // -1 == prefer Freetype
- if (encoding)
- return encoding;
- }
-
- // FT not available, find an XLFD font, trying the default encoding first
- encoding = size->encodingID(QFontPrivate::defaultEncodingID);
- if (encoding) {
- // does it support the requested script?
- bool supportsScript = false;
- for (int ws = 1; !supportsScript && ws < QFontDatabase::WritingSystemsCount; ++ws) {
- if (scriptForWritingSystem[ws] != script)
- continue;
- supportsScript = writingSystems_for_xlfd_encoding[encoding->encoding][ws];
- }
- if (!supportsScript)
- encoding = 0;
- }
- // find the first encoding that supports the requested script
- for (int ws = 1; !encoding && ws < QFontDatabase::WritingSystemsCount; ++ws) {
- if (scriptForWritingSystem[ws] != script)
- continue;
- for (int x = 0; !encoding && x < size->count; ++x) {
- const int enc = size->encodings[x].encoding;
- if (writingSystems_for_xlfd_encoding[enc][ws])
- encoding = size->encodings + x;
- }
- }
- return encoding;
-}
-#endif // Q_WS_X11
-
-#if !defined(Q_WS_MAC)
static
unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
const QtFontFamily *family, const QString &foundry_name,
@@ -1290,23 +918,11 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
}
}
-#ifdef Q_WS_X11
- QtFontEncoding *encoding = 0;
-#endif
// 4. find closest size match
if (! size) {
unsigned int distance = ~0u;
for (int x = 0; x < style->count; ++x) {
-#ifdef Q_WS_X11
- encoding =
- findEncoding(script, styleStrategy, style->pixelSizes + x, force_encoding_id);
- if (!encoding) {
- FM_DEBUG(" size %3d does not support the script we want",
- style->pixelSizes[x].pixelSize);
- continue;
- }
-#endif
unsigned int d;
if (style->pixelSizes[x].pixelSize < pixelSize) {
@@ -1341,16 +957,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
}
}
-#ifdef Q_WS_X11
- if (size) {
- encoding = findEncoding(script, styleStrategy, size, force_encoding_id);
- if (!encoding) size = 0;
- }
- if (! encoding) {
- FM_DEBUG(" foundry doesn't support the script we want");
- continue;
- }
-#endif // Q_WS_X11
unsigned int this_score = 0x0000;
enum {
@@ -1360,17 +966,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
EncodingMismatch = 0x0002,
XLFDPenalty = 0x0001
};
-#ifdef Q_WS_X11
- if (encoding->encoding != -1) {
- this_score += XLFDPenalty;
- if (encoding->encoding != QFontPrivate::defaultEncodingID)
- this_score += EncodingMismatch;
- }
- if (pitch != '*') {
- if (!(pitch == 'm' && encoding->pitch == 'c') && pitch != encoding->pitch)
- this_score += PitchMismatch;
- }
-#else
if (pitch != '*') {
#if !defined(QWS) && defined(Q_OS_MAC)
qt_mac_get_fixed_pitch(const_cast<QtFontFamily*>(family));
@@ -1379,7 +974,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
|| (pitch == 'p' && family->fixedPitch))
this_score += PitchMismatch;
}
-#endif
if (styleKey != style->key)
this_score += StyleMismatch;
if (!style->smoothScalable && px != size->pixelSize) // bitmap scaled
@@ -1395,9 +989,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
desc->foundry = foundry;
desc->style = style;
desc->size = size;
-#ifdef Q_WS_X11
- desc->encoding = encoding;
-#endif // Q_WS_X11
} else {
FM_DEBUG(" score %x no better than best %x", this_score, score);
}
@@ -1405,9 +996,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
return score;
}
-#endif
-#if !defined(Q_WS_MAC)
/*!
\internal
@@ -1436,11 +1025,6 @@ static void match(int script, const QFontDef &request,
family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(),
foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(),
script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-#if defined(FONT_MATCH_DEBUG) && defined(Q_WS_X11)
- if (force_encoding_id >= 0) {
- FM_DEBUG(" required encoding: %d", force_encoding_id);
- }
-#endif
desc->family = 0;
desc->foundry = 0;
@@ -1451,12 +1035,8 @@ static void match(int script, const QFontDef &request,
unsigned int score = ~0u;
-#ifdef Q_WS_X11
- load(family_name, script, forceXLFD);
-#else
Q_UNUSED(forceXLFD);
load(family_name, script);
-#endif
QFontDatabasePrivate *db = privateDb();
for (int x = 0; x < db->count; ++x) {
@@ -1468,9 +1048,6 @@ static void match(int script, const QFontDef &request,
if (!family_name.isEmpty()
&& test.family->name.compare(family_name, Qt::CaseInsensitive) != 0
-#ifdef Q_WS_WIN
- && test.family->english_name.compare(family_name, Qt::CaseInsensitive) != 0
-#endif
)
continue;
@@ -1514,7 +1091,6 @@ static void match(int script, const QFontDef &request,
break;
}
}
-#endif
static QString styleStringHelper(int weight, QFont::Style style)
{
@@ -1677,9 +1253,6 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const
QMutexLocker locker(fontDatabaseMutex());
QT_PREPEND_NAMESPACE(load)();
-#ifdef Q_WS_X11
- checkSymbolFonts();
-#endif
QList<WritingSystem> list;
for (int i = 0; i < d->count; ++i) {
@@ -1713,9 +1286,6 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString
QMutexLocker locker(fontDatabaseMutex());
QT_PREPEND_NAMESPACE(load)();
-#ifdef Q_WS_X11
- checkSymbolFonts(familyName);
-#endif
QList<WritingSystem> list;
QtFontFamily *f = d->family(familyName);
@@ -1746,10 +1316,6 @@ QStringList QFontDatabase::families(WritingSystem writingSystem) const
QMutexLocker locker(fontDatabaseMutex());
QT_PREPEND_NAMESPACE(load)();
-#ifdef Q_WS_X11
- if (writingSystem != Any)
- checkSymbolFonts();
-#endif
QStringList flist;
for (int i = 0; i < d->count; i++) {
@@ -1950,12 +1516,6 @@ bool QFontDatabase::isScalable(const QString &family,
QList<int> QFontDatabase::pointSizes(const QString &family,
const QString &styleName)
{
-#if defined(Q_WS_WIN)
- // windows and macosx are always smoothly scalable
- Q_UNUSED(family);
- Q_UNUSED(styleName);
- return standardSizes();
-#else
bool smoothScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
@@ -1972,11 +1532,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
if (!fam) return sizes;
-#ifdef Q_WS_X11
- int dpi = QX11Info::appDpiY();
-#else
const int dpi = qt_defaultDpiY(); // embedded
-#endif
for (int j = 0; j < fam->count; j++) {
QtFontFoundry *foundry = fam->foundries[j];
@@ -2005,7 +1561,6 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
qSort(sizes);
return sizes;
-#endif
}
/*!
@@ -2061,11 +1616,6 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
QList<int> QFontDatabase::smoothSizes(const QString &family,
const QString &styleName)
{
-#ifdef Q_WS_WIN
- Q_UNUSED(family);
- Q_UNUSED(styleName);
- return QFontDatabase::standardSizes();
-#else
bool smoothScalable = false;
QString familyName, foundryName;
parseFontName(family, foundryName, familyName);
@@ -2082,11 +1632,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
if (!fam)
return sizes;
-#ifdef Q_WS_X11
- int dpi = QX11Info::appDpiY();
-#else
const int dpi = qt_defaultDpiY(); // embedded
-#endif
for (int j = 0; j < fam->count; j++) {
QtFontFoundry *foundry = fam->foundries[j];
@@ -2115,7 +1661,6 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
qSort(sizes);
return sizes;
-#endif
}
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index fb8ef20d6d..6e0550334f 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -153,13 +153,8 @@ private:
static void createDatabase();
static void parseFontName(const QString &name, QString &foundry, QString &family);
static QString resolveFontFamilyAlias(const QString &family);
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request);
-#endif
static void load(const QFontPrivate *d, int script);
-#ifdef Q_WS_X11
- static QFontEngine *loadXlfd(int screen, int script, const QFontDef &request, int force_encoding_id = -1);
-#endif
friend struct QFontDef;
friend class QFontPrivate;
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 1960b1e9b2..3f008064e2 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -796,7 +796,6 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache:
return 0;
}
-#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs)
{
uint left_right = (left << 16) + right;
@@ -895,11 +894,6 @@ end:
// qDebug() << 'i' << i << "left_right" << hex << kerning_pairs.at(i).left_right;
}
-#else
-void QFontEngine::doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const
-{
-}
-#endif
int QFontEngine::glyphCount() const
{
@@ -1249,7 +1243,6 @@ glyph_metrics_t QFontEngineBox::boundingBox(const QGlyphLayout &glyphs)
return overall;
}
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &ti)
{
if (!ti.glyphs.numGlyphs)
@@ -1276,7 +1269,6 @@ void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt
painter->drawRect(QRectF(positions[k].toPointF(), s));
painter->restore();
}
-#endif
glyph_metrics_t QFontEngineBox::boundingBox(glyph_t)
{
@@ -1310,12 +1302,6 @@ qreal QFontEngineBox::maxCharWidth() const
return _size;
}
-#ifdef Q_WS_X11
-int QFontEngineBox::cmap() const
-{
- return -1;
-}
-#endif
const char *QFontEngineBox::name() const
{
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 9ed3906f4a..ecb717ec56 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -754,7 +754,6 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
metrics = face->size->metrics;
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
/*
TrueType fonts with embedded bitmaps may have a bitmap font specific
ascent/descent in the EBLC table. There is no direct public API
@@ -777,7 +776,6 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
}
}
}
-#endif
fontDef.styleName = QString::fromUtf8(face->style_name);
@@ -862,10 +860,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
int vfactor = 1;
int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor);
-#ifndef Q_WS_QWS
if (format != Format_Mono && !embeddedbitmap)
load_flags |= FT_LOAD_NO_BITMAP;
-#endif
FT_Matrix matrix = freetype->matrix;
bool transform = matrix.xx != 0x10000
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index f22a043548..bbef0bfcc7 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -58,9 +58,6 @@
#include <ft2build.h>
#include FT_FREETYPE_H
-#if defined(Q_WS_X11)
-#include <private/qt_x11_p.h>
-#endif
#ifndef Q_OS_WIN
#include <unistd.h>
@@ -165,9 +162,6 @@ public:
Subpixel_VBGR
};
-#if defined(Q_WS_X11) && !defined(QT_NO_XRENDER)
- typedef XGlyphInfo GlyphInfo;
-#else
struct GlyphInfo {
unsigned short width;
unsigned short height;
@@ -176,7 +170,6 @@ public:
short xOff;
short yOff;
};
-#endif
struct GlyphAndSubPixelPosition
{
@@ -310,9 +303,6 @@ private:
const QFixedPoint *positions,
GlyphFormat format = Format_Render);
-#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
- virtual void draw(QPaintEngine * /*p*/, qreal /*x*/, qreal /*y*/, const QTextItemInt & /*si*/) {}
-#endif
QFontEngineFT(const QFontDef &fd);
virtual ~QFontEngineFT();
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 2bec69c467..ec1f22b6e1 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -60,16 +60,7 @@
#include "private/qtextengine_p.h"
#include "private/qfont_p.h"
-#ifdef Q_WS_WIN
-# include "QtCore/qt_windows.h"
-#endif
-#ifdef Q_WS_MAC
-# include "private/qt_mac_p.h"
-# include "QtCore/qmap.h"
-# include "QtCore/qcache.h"
-# include "private/qcore_mac_p.h"
-#endif
#include <private/qfontengineglyphcache_p.h>
@@ -181,9 +172,6 @@ public:
virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const {}
virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const;
-#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(Q_WS_QPA)
- virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si) = 0;
-#endif
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
QPainterPath *path, QTextItem::RenderFlags flags);
@@ -275,7 +263,6 @@ public:
bool symbol;
mutable HB_FontRec hbFont;
mutable HB_Face hbFace;
-#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
struct KernPair {
uint left_right;
QFixed adjust;
@@ -287,7 +274,6 @@ public:
};
QVector<KernPair> kerning_pairs;
void loadKerningPairs(QFixed scalingFactor);
-#endif
int glyphFormat;
QImage currentlyLockedAlphaMap;
@@ -319,48 +305,6 @@ inline uint qHash(const QFontEngine::FaceId &f)
class QGlyph;
-#if defined(Q_WS_QWS)
-
-#ifndef QT_NO_QWS_QPF
-
-class QFontEngineQPF1Data;
-
-class QFontEngineQPF1 : public QFontEngine
-{
-public:
- QFontEngineQPF1(const QFontDef&, const QString &fn);
- ~QFontEngineQPF1();
-
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
-
- virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
- virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
-
- virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
- virtual glyph_metrics_t boundingBox(glyph_t glyph);
-
- virtual QFixed ascent() const;
- virtual QFixed descent() const;
- virtual QFixed leading() const;
- virtual qreal maxCharWidth() const;
- virtual qreal minLeftBearing() const;
- virtual qreal minRightBearing() const;
- virtual QFixed underlinePosition() const;
- virtual QFixed lineThickness() const;
-
- virtual Type type() const;
-
- virtual bool canRender(const QChar *string, int len);
- inline const char *name() const { return 0; }
- virtual QImage alphaMapForGlyph(glyph_t);
-
-
- QFontEngineQPF1Data *d;
-};
-#endif // QT_NO_QWS_QPF
-
-#endif // QWS
class QFontEngineBox : public QFontEngine
@@ -372,9 +316,7 @@ public:
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
-#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN)
void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
-#endif
virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
@@ -389,9 +331,6 @@ public:
virtual qreal minRightBearing() const { return 0; }
virtual QImage alphaMapForGlyph(glyph_t);
-#ifdef Q_WS_X11
- int cmap() const;
-#endif
virtual const char *name() const;
virtual bool canRender(const QChar *string, int len);
@@ -471,12 +410,6 @@ public:
QT_END_NAMESPACE
-#ifdef Q_WS_WIN
-# include "private/qfontengine_win_p.h"
-#endif
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
-# include "private/qfontengine_ft_p.h"
-#endif
#endif // QFONTENGINE_P_H
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 584cdc0d66..8bdaa46524 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -70,11 +70,6 @@ QT_BEGIN_NAMESPACE
QT_BEGIN_INCLUDE_NAMESPACE
-#if defined(Q_WS_QWS)
-# include "private/qwscommand_qws_p.h"
-# include "qwsdisplay_qws.h"
-# include "qabstractfontengine_p.h"
-#endif
#include "qplatformdefs.h"
QT_END_INCLUDE_NAMESPACE
@@ -231,12 +226,7 @@ QVariant QFontEngineQPF::extractHeaderField(const uchar *data, HeaderTag request
QString qws_fontCacheDir()
{
QString dir;
-#if defined(Q_WS_QWS)
- extern QString qws_dataDir();
- dir = qws_dataDir();
-#else
dir = QDir::tempPath();
-#endif
dir.append(QLatin1String("/fonts/"));
QDir qd(dir);
if (!qd.exists() && !qd.mkpath(dir))
@@ -504,24 +494,10 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng
<< "glyphMapOffset" << glyphMapOffset << "glyphDataOffset" << glyphDataOffset
<< "fd" << fd << "glyphDataSize" << glyphDataSize;
#endif
-#if defined(Q_WS_QWS)
- if (isValid() && renderingFontEngine)
- qt_fbdpy->sendFontCommand(QWSFontCommand::StartedUsingFont, encodedFileName);
-#endif
}
QFontEngineQPF::~QFontEngineQPF()
{
-#if defined(Q_WS_QWS)
- if (isValid() && renderingFontEngine) {
- QT_TRY {
- qt_fbdpy->sendFontCommand(QWSFontCommand::StoppedUsingFont, encodedFileName);
- } QT_CATCH(...) {
- qDebug("QFontEngineQPF::~QFontEngineQPF: Out of memory");
- // ignore.
- }
- }
-#endif
delete renderingFontEngine;
if (fontData) {
if (munmap((void *)fontData, dataSize) == -1) {
@@ -982,14 +958,7 @@ bool QFontEngineQPF::lockFile()
perror("unlocking possibly corrupt qpf");
return false;
}
-#if defined(Q_WS_QWS)
- extern int qws_client_id;
- // qws_client_id == 0 means we're the server. in this case we just
- // set the id to 1
- header->lock = qws_client_id ? qws_client_id : 1;
-#else
header->lock = 1;
-#endif
return true;
}
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index 3ac5392d0f..6b633d615c 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -59,16 +59,7 @@
#include <QtCore/qvarlengtharray.h>
#include "private/qfont_p.h"
-#ifdef Q_WS_WIN
-# include "QtCore/qt_windows.h"
-#endif
-#ifdef Q_WS_MAC
-# include "private/qt_mac_p.h"
-# include "QtCore/qmap.h"
-# include "QtCore/qcache.h"
-# include "private/qcore_mac_p.h"
-#endif
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 9fce85f25b..012e9f300b 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -49,15 +49,9 @@
#include <math.h>
-#ifdef Q_WS_X11
-#include "qx11info_x11.h"
-#endif
QT_BEGIN_NAMESPACE
-#ifdef Q_WS_X11
-extern const QX11Info *qt_x11Info(const QPaintDevice *pd);
-#endif
extern void qt_format_text(const QFont& font, const QRectF &_r,
int tf, const QString &text, QRectF *brect,
@@ -182,12 +176,7 @@ QFontMetrics::QFontMetrics(const QFont &font)
QFontMetrics::QFontMetrics(const QFont &font, QPaintDevice *paintdevice)
{
int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi();
-#ifdef Q_WS_X11
- const QX11Info *info = qt_x11Info(paintdevice);
- int screen = info ? info->screen() : 0;
-#else
const int screen = 0;
-#endif
if (font.d->dpi != dpi || font.d->screen != screen ) {
d = new QFontPrivate(*font.d);
d->dpi = dpi;
@@ -1060,12 +1049,7 @@ QFontMetricsF::QFontMetricsF(const QFont &font)
QFontMetricsF::QFontMetricsF(const QFont &font, QPaintDevice *paintdevice)
{
int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi();
-#ifdef Q_WS_X11
- const QX11Info *info = qt_x11Info(paintdevice);
- int screen = info ? info->screen() : 0;
-#else
const int screen = 0;
-#endif
if (font.d->dpi != dpi || font.d->screen != screen ) {
d = new QFontPrivate(*font.d);
d->dpi = dpi;
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index f21e820556..21e211a4a7 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -54,9 +54,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#ifdef Q_WS_QWS
-class QFontEngine;
-#endif
class QTextCodec;
class QRect;
@@ -121,9 +118,6 @@ public:
inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); }
private:
-#if defined(Q_WS_MAC)
- friend class QFontPrivate;
-#endif
friend class QFontMetricsF;
friend class QStackTextEngine;
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index dc2a14a52a..cf707fe78f 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -45,14 +45,8 @@
#include "private/qpdf_p.h"
#include "private/qfunctions_p.h"
-#ifdef Q_WS_X11
-#include "private/qfontengine_x11_p.h"
-#endif
#ifndef QT_NO_FREETYPE
-#if defined(Q_WS_X11) || defined(Q_WS_QWS)
-# include "private/qfontengine_ft_p.h"
-#endif
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
@@ -285,24 +279,6 @@ QByteArray QFontSubset::glyphName(unsigned short unicode, bool symbol)
#ifndef QT_NO_FREETYPE
static FT_Face ft_face(const QFontEngine *engine)
{
-#ifdef Q_WS_X11
-#ifndef QT_NO_FONTCONFIG
- if (engine->type() == QFontEngine::Freetype) {
- const QFontEngineFT *ft = static_cast<const QFontEngineFT *>(engine);
- return ft->non_locked_face();
- } else
-#endif
- if (engine->type() == QFontEngine::XLFD) {
- const QFontEngineXLFD *xlfd = static_cast<const QFontEngineXLFD *>(engine);
- return xlfd->non_locked_face();
- }
-#endif
-#ifdef Q_WS_QWS
- if (engine->type() == QFontEngine::Freetype) {
- const QFontEngineFT *ft = static_cast<const QFontEngineFT *>(engine);
- return ft->non_locked_face();
- }
-#endif
return 0;
}
#endif
@@ -322,10 +298,6 @@ QByteArray QFontSubset::glyphName(unsigned int glyph, const QVector<int> reverse
char name[32];
name[0] = 0;
if (face && FT_HAS_GLYPH_NAMES(face)) {
-#if defined(Q_WS_X11)
- if (fontEngine->type() == QFontEngine::XLFD)
- glyphIndex = static_cast<QFontEngineXLFD *>(fontEngine)->glyphIndexToFreetypeGlyphIndex(glyphIndex);
-#endif
FT_Get_Glyph_Name(face, glyphIndex, &name, 32);
if (name[0] == '.') // fix broken PS fonts returning .notdef for many glyphs
name[0] = 0;
@@ -334,12 +306,6 @@ QByteArray QFontSubset::glyphName(unsigned int glyph, const QVector<int> reverse
s << '/' << name;
} else
#endif
-#if defined(Q_WS_X11)
- if (fontEngine->type() == QFontEngine::XLFD) {
- uint uc = static_cast<QFontEngineXLFD *>(fontEngine)->toUnicode(glyphIndex);
- s << '/' << glyphName(uc, false /* ### */);
- } else
-#endif
if (reverseMap[glyphIndex] && reverseMap[glyphIndex] < 0x10000) {
s << '/' << glyphName(reverseMap[glyphIndex], false);
} else {
diff --git a/src/gui/text/qlinecontrol.cpp b/src/gui/text/qlinecontrol.cpp
index 33de367d96..3373807bd7 100644
--- a/src/gui/text/qlinecontrol.cpp
+++ b/src/gui/text/qlinecontrol.cpp
@@ -1491,10 +1491,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
else if (event == QKeySequence::Paste) {
if (!isReadOnly()) {
QClipboard::Mode mode = QClipboard::Clipboard;
-#ifdef Q_WS_X11
- if (event->modifiers() == (Qt::CTRL | Qt::SHIFT) && event->key() == Qt::Key_Insert)
- mode = QClipboard::Selection;
-#endif
paste(mode);
}
}
@@ -1598,26 +1594,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
#endif // QT_NO_SHORTCUT
else {
bool handled = false;
-#ifdef Q_WS_MAC
- if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) {
- Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier);
- if (myModifiers & Qt::ShiftModifier) {
- if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier)
- || myModifiers == (Qt::AltModifier|Qt::ShiftModifier)
- || myModifiers == Qt::ShiftModifier) {
-
- event->key() == Qt::Key_Up ? home(1) : end(1);
- }
- } else {
- if ((myModifiers == Qt::ControlModifier
- || myModifiers == Qt::AltModifier
- || myModifiers == Qt::NoModifier)) {
- event->key() == Qt::Key_Up ? home(0) : end(0);
- }
- }
- handled = true;
- }
-#endif
if (event->modifiers() & Qt::ControlModifier) {
switch (event->key()) {
case Qt::Key_Backspace:
@@ -1626,21 +1602,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
del();
}
break;
-#if defined(Q_WS_X11)
- case Qt::Key_E:
- end(0);
- break;
-
- case Qt::Key_U:
- if (!isReadOnly()) {
- setSelection(0, text().size());
-#ifndef QT_NO_CLIPBOARD
- copy();
-#endif
- del();
- }
- break;
-#endif
default:
if (!handled)
unknown = true;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 01c04a74ca..389c5bdc75 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -646,23 +646,6 @@ extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSyst
QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem)
{
QRawFont rawFont;
-#if defined(Q_WS_MAC)
- QTextLayout layout(QFontDatabase::writingSystemSample(writingSystem), font);
- layout.beginLayout();
- QTextLine line = layout.createLine();
- layout.endLayout();
- QList<QGlyphRun> list = layout.glyphRuns();
- if (list.size()) {
- // Pick the one matches the family name we originally requested,
- // if none of them match, just pick the first one
- for (int i = 0; i < list.size(); i++) {
- rawfont = list.at(i).rawFont();
- if (rawfont.familyName() == font.family())
- return rawfont;
- }
- return list.at(0).rawFont();
- }
-#else
QFontPrivate *font_d = QFontPrivate::get(font);
int script = qt_script_for_writing_system(writingSystem);
QFontEngine *fe = font_d->engineForScript(script);
@@ -681,7 +664,6 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
rawFont.d.data()->fontEngine->ref.ref();
rawFont.d.data()->hintingPreference = font.hintingPreference();
}
-#endif
return rawFont;
}
diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp
index 1666df3fdf..c941b98694 100644
--- a/src/gui/text/qrawfont_ft.cpp
+++ b/src/gui/text/qrawfont_ft.cpp
@@ -47,28 +47,17 @@
#include "qfontengine_ft_p.h"
#include "quuid.h"
-#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)
-# include "qfontengine_x11_p.h"
-#endif
QT_BEGIN_NAMESPACE
class QFontEngineFTRawFont
-#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)
- : public QFontEngineX11FT
-#else
: public QFontEngineFT
-#endif
{
public:
QFontEngineFTRawFont(const QFontDef &fontDef)
-#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)
- : QFontEngineX11FT(fontDef)
-#else
: QFontEngineFT(fontDef)
-#endif
{
}
diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h
index 0187c374a0..1f2e957906 100644
--- a/src/gui/text/qrawfont_p.h
+++ b/src/gui/text/qrawfont_p.h
@@ -71,21 +71,11 @@ public:
: fontEngine(0)
, hintingPreference(QFont::PreferDefaultHinting)
, thread(0)
-#if defined(Q_WS_WIN)
- , fontHandle(NULL)
- , ptrAddFontMemResourceEx(NULL)
- , ptrRemoveFontMemResourceEx(NULL)
-#endif
{}
QRawFontPrivate(const QRawFontPrivate &other)
: hintingPreference(other.hintingPreference)
, thread(other.thread)
-#if defined(Q_WS_WIN)
- , fontHandle(NULL)
- , ptrAddFontMemResourceEx(other.ptrAddFontMemResourceEx)
- , ptrRemoveFontMemResourceEx(other.ptrRemoveFontMemResourceEx)
-#endif
{
fontEngine = other.fontEngine;
if (fontEngine != 0)
@@ -117,16 +107,6 @@ public:
QThread *thread;
QAtomicInt ref;
-#if defined(Q_WS_WIN)
- HANDLE fontHandle;
-
- typedef HANDLE (WINAPI *PtrAddFontMemResourceEx)(PVOID, DWORD, PVOID, DWORD *);
- typedef BOOL (WINAPI *PtrRemoveFontMemResourceEx)(HANDLE);
-
- PtrAddFontMemResourceEx ptrAddFontMemResourceEx;
- PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx;
-
-#endif // Q_WS_WIN
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 4edaf8a0e6..810c715437 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -88,9 +88,6 @@ const bool fullWidthSelection = true;
QT_BEGIN_NAMESPACE
#ifndef QT_NO_CONTEXTMENU
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
-extern bool qt_use_rtl_extensions;
-#endif
#endif
// could go into QTextCursor...
@@ -1171,10 +1168,6 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e)
}
else if (e == QKeySequence::Paste) {
QClipboard::Mode mode = QClipboard::Clipboard;
-#ifdef Q_WS_X11
- if (e->modifiers() == (Qt::CTRL | Qt::SHIFT) && e->key() == Qt::Key_Insert)
- mode = QClipboard::Selection;
-#endif
q->paste(mode);
}
#endif
@@ -1932,9 +1925,6 @@ void QTextControlPrivate::focusEvent(QFocusEvent *e)
if (e->gotFocus()) {
#ifdef QT_KEYPAD_NAVIGATION
if (!QGuiApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason
-#ifdef Q_OS_SYMBIAN
- || e->reason() == Qt::ActiveWindowFocusReason
-#endif
))) {
#endif
cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 416a219e05..3a2431d1ea 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -819,11 +819,6 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd
QT_BEGIN_INCLUDE_NAMESPACE
-#if defined(Q_WS_X11) || defined (Q_WS_QWS)
-# include "qfontengine_ft_p.h"
-#elif defined(Q_WS_MAC)
-# include "qtextengine_mac.cpp"
-#endif
#include <private/qharfbuzz_p.h>
@@ -874,20 +869,6 @@ void QTextEngine::shapeLine(const QScriptLine &line)
}
}
-#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) && defined(Q_WS_MAC)
-static bool enableHarfBuzz()
-{
- static enum { Yes, No, Unknown } status = Unknown;
-
- if (status == Unknown) {
- QByteArray v = qgetenv("QT_ENABLE_HARFBUZZ");
- bool value = !v.isEmpty() && v != "0" && v != "false";
- if (value) status = Yes;
- else status = No;
- }
- return status == Yes;
-}
-#endif
void QTextEngine::shapeText(int item) const
{
@@ -897,30 +878,7 @@ void QTextEngine::shapeText(int item) const
if (si.num_glyphs)
return;
-#if defined(Q_WS_MAC)
-#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC)
- if (enableHarfBuzz()) {
-#endif
- QFontEngine *actualFontEngine = fontEngine(si, &si.ascent, &si.descent, &si.leading);
- if (actualFontEngine->type() == QFontEngine::Multi)
- actualFontEngine = static_cast<QFontEngineMulti *>(actualFontEngine)->engine(0);
-
- HB_Face face = actualFontEngine->harfbuzzFace();
- HB_Script script = (HB_Script) si.analysis.script;
- if (face->supported_scripts[script])
- shapeTextWithHarfbuzz(item);
- else
- shapeTextMac(item);
-#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC)
- } else {
- shapeTextMac(item);
- }
-#endif
-#elif defined(Q_WS_WINCE)
- shapeTextWithCE(item);
-#else
shapeTextWithHarfbuzz(item);
-#endif
si.width = 0;
@@ -978,186 +936,6 @@ static inline bool hasCaseChange(const QScriptItem &si)
si.analysis.flags == QScriptAnalysis::Lowercase;
}
-#if defined(Q_WS_WINCE) //TODO
-// set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs
-// and no reordering.
-// also computes logClusters heuristically
-static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayout *glyphs, unsigned short *logClusters, int num_glyphs)
-{
- // ### zeroWidth and justification are missing here!!!!!
-
- Q_UNUSED(num_glyphs);
- Q_ASSERT(num_glyphs <= length);
-
-// qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs);
-
- int glyph_pos = 0;
- for (int i = 0; i < length; i++) {
- if (uc[i].isHighSurrogate() && i < length-1 && uc[i+1].isLowSurrogate()) {
- logClusters[i] = glyph_pos;
- logClusters[++i] = glyph_pos;
- } else {
- logClusters[i] = glyph_pos;
- }
- ++glyph_pos;
- }
-
- // first char in a run is never (treated as) a mark
- int cStart = 0;
-
- const bool symbolFont = false; // ####
- glyphs->attributes[0].mark = false;
- glyphs->attributes[0].clusterStart = true;
- glyphs->attributes[0].dontPrint = (!symbolFont && uc[0].unicode() == 0x00ad) || qIsControlChar(uc[0].unicode());
-
- int pos = 0;
- int lastCat = QChar::category(uc[0].unicode());
- for (int i = 1; i < length; ++i) {
- if (logClusters[i] == pos)
- // same glyph
- continue;
- ++pos;
- while (pos < logClusters[i]) {
- glyphs[pos].attributes = glyphs[pos-1].attributes;
- ++pos;
- }
- // hide soft-hyphens by default
- if ((!symbolFont && uc[i].unicode() == 0x00ad) || qIsControlChar(uc[i].unicode()))
- glyphs->attributes[pos].dontPrint = true;
- const QUnicodeTables::Properties *prop = QUnicodeTables::properties(uc[i].unicode());
- int cat = prop->category;
- if (cat != QChar::Mark_NonSpacing) {
- glyphs->attributes[pos].mark = false;
- glyphs->attributes[pos].clusterStart = true;
- glyphs->attributes[pos].combiningClass = 0;
- cStart = logClusters[i];
- } else {
- int cmb = prop->combiningClass;
-
- if (cmb == 0) {
- // Fix 0 combining classes
- if ((uc[pos].unicode() & 0xff00) == 0x0e00) {
- // thai or lao
- unsigned char col = uc[pos].cell();
- if (col == 0x31 ||
- col == 0x34 ||
- col == 0x35 ||
- col == 0x36 ||
- col == 0x37 ||
- col == 0x47 ||
- col == 0x4c ||
- col == 0x4d ||
- col == 0x4e) {
- cmb = QChar::Combining_AboveRight;
- } else if (col == 0xb1 ||
- col == 0xb4 ||
- col == 0xb5 ||
- col == 0xb6 ||
- col == 0xb7 ||
- col == 0xbb ||
- col == 0xcc ||
- col == 0xcd) {
- cmb = QChar::Combining_Above;
- } else if (col == 0xbc) {
- cmb = QChar::Combining_Below;
- }
- }
- }
-
- glyphs->attributes[pos].mark = true;
- glyphs->attributes[pos].clusterStart = false;
- glyphs->attributes[pos].combiningClass = cmb;
- logClusters[i] = cStart;
- glyphs->advances_x[pos] = 0;
- glyphs->advances_y[pos] = 0;
- }
-
- // one gets an inter character justification point if the current char is not a non spacing mark.
- // as then the current char belongs to the last one and one gets a space justification point
- // after the space char.
- if (lastCat == QChar::Separator_Space)
- glyphs->attributes[pos-1].justification = HB_Space;
- else if (cat != QChar::Mark_NonSpacing)
- glyphs->attributes[pos-1].justification = HB_Character;
- else
- glyphs->attributes[pos-1].justification = HB_NoJustification;
-
- lastCat = cat;
- }
- pos = logClusters[length-1];
- if (lastCat == QChar::Separator_Space)
- glyphs->attributes[pos].justification = HB_Space;
- else
- glyphs->attributes[pos].justification = HB_Character;
-}
-
-void QTextEngine::shapeTextWithCE(int item) const
-{
- QScriptItem &si = layoutData->items[item];
- si.glyph_data_offset = layoutData->used;
-
- QFontEngine *fe = fontEngine(si, &si.ascent, &si.descent, &si.leading);
-
- QTextEngine::ShaperFlags flags;
- if (si.analysis.bidiLevel % 2)
- flags |= RightToLeft;
- if (option.useDesignMetrics())
- flags |= DesignMetrics;
-
- // pre-initialize char attributes
- if (! attributes())
- return;
-
- const int len = length(item);
- int num_glyphs = length(item);
- const QChar *str = layoutData->string.unicode() + si.position;
- ushort upperCased[256];
- if (hasCaseChange(si)) {
- ushort *uc = upperCased;
- if (len > 256)
- uc = new ushort[len];
- for (int i = 0; i < len; ++i) {
- if(si.analysis.flags == QScriptAnalysis::Lowercase)
- uc[i] = str[i].toLower().unicode();
- else
- uc[i] = str[i].toUpper().unicode();
- }
- str = reinterpret_cast<const QChar *>(uc);
- }
-
- while (true) {
- if (! ensureSpace(num_glyphs)) {
- // If str is converted to uppercase/lowercase form with a new buffer,
- // we need to delete that buffer before return for error
- const ushort *uc = reinterpret_cast<const ushort *>(str);
- if (hasCaseChange(si) && uc != upperCased)
- delete [] uc;
- return;
- }
- num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used;
-
- QGlyphLayout g = availableGlyphs(&si);
- unsigned short *log_clusters = logClusters(&si);
-
- if (fe->stringToCMap(str,
- len,
- &g,
- &num_glyphs,
- flags)) {
- heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs);
- break;
- }
- }
-
- si.num_glyphs = num_glyphs;
-
- layoutData->used += si.num_glyphs;
-
- const ushort *uc = reinterpret_cast<const ushort *>(str);
- if (hasCaseChange(si) && uc != upperCased)
- delete [] uc;
-}
-#endif
static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num)
{
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index fd11b9f658..2bdc866276 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -637,12 +637,6 @@ private:
void addRequiredBoundaries() const;
void shapeText(int item) const;
void shapeTextWithHarfbuzz(int item) const;
-#if defined(Q_WS_WINCE)
- void shapeTextWithCE(int item) const;
-#endif
-#if defined(Q_WS_MAC)
- void shapeTextMac(int item) const;
-#endif
void splitItem(int item, int pos) const;
void resolveAdditionalFormats() const;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 8a77b07008..3e7c0ad4ab 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1290,10 +1290,6 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
&& (p->transform().type() > QTransform::TxTranslate);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing);
-#ifdef Q_WS_MAC
- // Always draw the cursor aligned to pixel boundary.
- x = qRound(x);
-#endif
p->fillRect(QRectF(x, y, qreal(width), (base + descent + 1).toReal()), p->pen().brush());
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing, false);
@@ -1899,9 +1895,7 @@ void QTextLine::layout_helper(int maxGlyphs)
// expand the text beyond the edge.
if (sb_or_ws|breakany) {
QFixed rightBearing = lbh.rightBearing; // store previous right bearing
-#if !defined(Q_WS_MAC)
if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width)
-#endif
lbh.adjustRightBearing();
if (lbh.checkFullOtherwiseExtend(line)) {
// we are too wide, fix right bearing
@@ -2123,15 +2117,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
fontD->fontEngine = fontEngine;
fontD->thread = QThread::currentThread();
fontD->fontEngine->ref.ref();
-
-#if defined(Q_WS_WIN)
- if (fontEngine->supportsSubPixelPositions())
- fontD->hintingPreference = QFont::PreferVerticalHinting;
- else
- fontD->hintingPreference = QFont::PreferFullHinting;
-#elif defined(Q_WS_MAC)
- fontD->hintingPreference = QFont::PreferNoHinting;
-#elif !defined(QT_NO_FREETYPE)
+#if !defined(QT_NO_FREETYPE)
if (fontEngine->type() == QFontEngine::Freetype) {
QFontEngineFT *freeTypeEngine = static_cast<QFontEngineFT *>(fontEngine);
switch (freeTypeEngine->defaultHintStyle()) {
@@ -2148,7 +2134,6 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
};
}
#endif
-
QVarLengthArray<glyph_t> glyphsArray;
QVarLengthArray<QFixedPoint> positionsArray;