diff options
Diffstat (limited to 'src')
52 files changed, 625 insertions, 515 deletions
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 1e1e4dacf6..2388f53a9e 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -1,3 +1,5 @@ +load(qt_module) + TARGET = QtCore QPRO_PWD = $$PWD QT = @@ -10,7 +12,7 @@ DEFINES += QT_BUILD_CORE_LIB QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/corelib/qtcoreversion.h diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 0c2cf1619e..42cab84cc0 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -116,6 +116,10 @@ SOURCES += ../3rdparty/harfbuzz/src/harfbuzz-buffer.c \ tools/qharfbuzz.cpp HEADERS += tools/qharfbuzz_p.h +corelib_tools_private_headers.files = ../3rdparty/harfbuzz/src/*.h +corelib_tools_private_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET/$$eval(QT.$${MODULE}.VERSION)/$$TARGET +INSTALLS += corelib_tools_private_headers + INCLUDEPATH += ../3rdparty/md5 \ ../3rdparty/md4 diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index 731d20a893..12efd8638b 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -1,3 +1,5 @@ +load(qt_module) + TARGET = QtDBus QPRO_PWD = $$PWD QT = core-private \ @@ -31,7 +33,7 @@ win32 { CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d else:LIBS_PRIVATE += -ldbus-1 } -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/dub/qtdbusversion.h diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 4665c51821..f1d5bbaea5 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -1,3 +1,5 @@ +load(qt_module) + TARGET = QtGui QPRO_PWD = $$PWD QT = core-private @@ -9,7 +11,7 @@ DEFINES += QT_BUILD_GUI_LIB QT_NO_USING_NAMESPACE unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/gui/qtguiversion.h diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 7232f9c910..3b177af4ec 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3021,11 +3021,8 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) ensurePen(); ensureState(); - QRasterPaintEngineState *s = state(); - QFontEngine *fontEngine = textItem->fontEngine(); - const qreal pixelSize = fontEngine->fontDef.pixelSize; - if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) < 64 * 64) { + if (!supportsTransformations(fontEngine)) { drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, fontEngine); } else { @@ -3053,38 +3050,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte #if defined (Q_OS_WIN) || defined(Q_WS_MAC) - bool drawCached = true; - - if (s->matrix.type() >= QTransform::TxProject) - drawCached = false; - - // don't try to cache huge fonts - const qreal pixelSize = ti.fontEngine->fontDef.pixelSize; - if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64) - drawCached = false; - - // ### Remove the TestFontEngine and Box engine crap, in these - // ### cases we should delegate painting to the font engine - // ### directly... - -/* - #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - conQFontEngine::Type fontEngineType = ti.fontEngine->type(); - // qDebug() << "type" << fontEngineType << s->matrix.type(); - if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) ti.fontEngine)->ttf && s->matrix.type() > QTransform::TxTranslate) - || (s->matrix.type() <= QTransform::TxTranslate - && (fontEngineType == QFontEngine::TestFontEngine - || fontEngineType == QFontEngine::Box))) { - drawCached = false; - } -#else -*/ - if (s->matrix.type() > QTransform::TxTranslate) - drawCached = false; -// #endif - if (drawCached) { - QRasterPaintEngineState *s = state(); - + if (!supportsTransformations(ti.fontEngine)) { QVarLengthArray<QFixedPoint> positions; QVarLengthArray<glyph_t> glyphs; @@ -3356,6 +3322,37 @@ void QRasterPaintEngine::releaseDC(HDC) const #endif +bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine) const +{ + const QTransform &m = state()->matrix; +#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) + QFontEngine::Type fontEngineType = fontEngine->type(); + if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) fontEngine)->ttf && m.type() > QTransform::TxTranslate) + || (m.type() <= QTransform::TxTranslate + && (fontEngineType == QFontEngine::TestFontEngine + || fontEngineType == QFontEngine::Box))) { + return true; + } +#endif + return supportsTransformations(fontEngine->fontDef.pixelSize, m); +} + +bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransform &m) const +{ +#if defined(Q_WS_MAC) + // Mac font engines don't support scaling and rotation + if (m.type() > QTransform::TxTranslate) +#else + if (m.type() >= QTransform::TxProject) +#endif + return true; + + if (pixelSize * pixelSize * qAbs(m.determinant()) >= 64 * 64) + return true; + + return false; +} + /*! \internal */ diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 6d0388bfa3..9bdfbff9f6 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -237,6 +237,9 @@ public: QPoint coordinateOffset() const; + bool supportsTransformations(const QFontEngine *fontEngine) const; + bool supportsTransformations(qreal pixelSize, const QTransform &m) const; + protected: QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *); private: diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 3b52a789c3..8510416fcb 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1093,4 +1093,14 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) } } +bool QPaintEngineEx::supportsTransformations(qreal pixelSize, const QTransform &m) const +{ + Q_UNUSED(pixelSize); + + if (!m.isAffine()) + return true; + + return false; +} + QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 9e6cbfc1ea..604a43133f 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -227,6 +227,7 @@ public: IsEmulationEngine = 0x02 // If set, this object is a QEmulationEngine. }; virtual uint flags() const {return 0;} + virtual bool supportsTransformations(qreal pixelSize, const QTransform &m) const; protected: QPaintEngineEx(QPaintEngineExPrivate &data); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index aa684864e8..d46b30b6e2 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -149,14 +149,6 @@ static inline uint line_emulation(uint emulation) | QPaintEngine_OpaqueBackground); } -static bool qt_paintengine_supports_transformations(QPaintEngine::Type type) -{ - return type == QPaintEngine::OpenGL2 - || type == QPaintEngine::OpenVG - || type == QPaintEngine::OpenGL - || type == QPaintEngine::CoreGraphics; -} - #ifndef QT_NO_DEBUG static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition = false) { @@ -5683,35 +5675,37 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) if (!font.isValid()) return; - QVector<quint32> glyphIndexes = glyphRun.glyphIndexes(); - QVector<QPointF> glyphPositions = glyphRun.positions(); + QGlyphRunPrivate *glyphRun_d = QGlyphRunPrivate::get(glyphRun); - int count = qMin(glyphIndexes.size(), glyphPositions.size()); - QVarLengthArray<QFixedPoint, 128> fixedPointPositions(count); + const quint32 *glyphIndexes = glyphRun_d->glyphIndexData; + const QPointF *glyphPositions = glyphRun_d->glyphPositionData; - bool paintEngineSupportsTransformations = - d->extended != 0 - ? qt_paintengine_supports_transformations(d->extended->type()) - : qt_paintengine_supports_transformations(d->engine->type()); + int count = qMin(glyphRun_d->glyphIndexDataSize, glyphRun_d->glyphPositionDataSize); + QVarLengthArray<QFixedPoint, 128> fixedPointPositions(count); - // If the matrix is not affine, the paint engine will fall back to - // drawing the glyphs as paths, which in turn means we should not - // preprocess the glyph positions - if (!d->state->matrix.isAffine()) - paintEngineSupportsTransformations = true; + QRawFontPrivate *fontD = QRawFontPrivate::get(font); + bool supportsTransformations; + if (d->extended != 0) { + supportsTransformations = d->extended->supportsTransformations(fontD->fontEngine->fontDef.pixelSize, + d->state->matrix); + } else { + supportsTransformations = d->engine->type() == QPaintEngine::CoreGraphics + || d->state->matrix.isAffine(); + } for (int i=0; i<count; ++i) { - QPointF processedPosition = position + glyphPositions.at(i); - if (!paintEngineSupportsTransformations) + QPointF processedPosition = position + glyphPositions[i]; + if (!supportsTransformations) processedPosition = d->state->transform().map(processedPosition); fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); } - d->drawGlyphs(glyphIndexes.data(), fixedPointPositions.data(), count, font, glyphRun.overline(), + d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, font, glyphRun.overline(), glyphRun.underline(), glyphRun.strikeOut()); } -void QPainterPrivate::drawGlyphs(quint32 *glyphArray, QFixedPoint *positions, int glyphCount, +void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positions, + int glyphCount, const QRawFont &font, bool overline, bool underline, bool strikeOut) { @@ -5878,11 +5872,12 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText return; } - bool paintEngineSupportsTransformations = qt_paintengine_supports_transformations(d->extended->type()); - if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) { + bool supportsTransformations = d->extended->supportsTransformations(staticText_d->font.pixelSize(), + d->state->matrix); + if (supportsTransformations && !staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = true; staticText_d->needsRelayout = true; - } else if (!paintEngineSupportsTransformations && staticText_d->untransformedCoordinates) { + } else if (!supportsTransformations && staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = false; staticText_d->needsRelayout = true; } diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 35cdf86ee0..79d4b4bbe0 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -232,7 +232,7 @@ public: void drawOpaqueBackground(const QPainterPath &path, DrawOperation operation); #if !defined(QT_NO_RAWFONT) - void drawGlyphs(quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount, + void drawGlyphs(const quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount, const QRawFont &font, bool overline = false, bool underline = false, bool strikeOut = false); #endif diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 7f8a0f9c3e..8b78b52c08 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -325,6 +325,9 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) if (! (mask & QFont::FamilyResolved)) request.family = other->request.family; + if (! (mask & QFont::StyleNameResolved)) + request.styleName = other->request.styleName; + if (! (mask & QFont::SizeResolved)) { request.pointSize = other->request.pointSize; request.pixelSize = other->request.pixelSize; @@ -874,6 +877,38 @@ void QFont::setFamily(const QString &family) } /*! + \since 4.8 + + Returns the requested font style name, it will be used to match the + font with irregular styles (that can't be normalized in other style + properties). It depends on system font support, thus only works for + Mac OS X and X11 so far. On Windows irregular styles will be added + as separate font families so there is no need for this. + + \sa setFamily() setStyle() +*/ +QString QFont::styleName() const +{ + return d->request.styleName; +} + +/*! + \since 4.8 + + Sets the style name of the font. When set, other style properties + like \a style() and \a weight() will be ignored for font matching. + + \sa styleName() +*/ +void QFont::setStyleName(const QString &styleName) +{ + detach(); + + d->request.styleName = styleName; + resolve_mask |= QFont::StyleNameResolved; +} + +/*! Returns the point size of the font. Returns -1 if the font size was specified in pixels. @@ -2437,6 +2472,21 @@ QString QFontInfo::family() const } /*! + \since 4.8 + + Returns the style name of the matched window system font on + system that supports it. + + \sa QFont::styleName() +*/ +QString QFontInfo::styleName() const +{ + QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); + Q_ASSERT(engine != 0); + return engine->fontDef.styleName; +} + +/*! Returns the point size of the matched window system font. \sa pointSizeF() QFont::pointSize() diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index ce24747aac..1035b665a3 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -156,7 +156,8 @@ public: LetterSpacingResolved = 0x2000, WordSpacingResolved = 0x4000, HintingPreferenceResolved = 0x8000, - AllPropertiesResolved = 0xffff + StyleNameResolved = 0x10000, + AllPropertiesResolved = 0x1ffff }; QFont(); @@ -168,6 +169,9 @@ public: QString family() const; void setFamily(const QString &); + QString styleName() const; + void setStyleName(const QString &); + int pointSize() const; void setPointSize(int); qreal pointSizeF() const; diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index d36518ee4b..8eeae6ffc1 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -80,6 +80,7 @@ struct QFontDef } QString family; + QString styleName; #ifdef Q_WS_X11 QString addStyle; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 39abbd6f58..dd30a15030 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -51,7 +51,6 @@ #include "qabstractfileengine.h" #include "qthreadstorage.h" #include <qmath.h> -#include <private/qharfbuzz_p.h> #include "qfontengine_ft_p.h" #include <ft2build.h> @@ -758,6 +757,8 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, } #endif + fontDef.styleName = QString::fromUtf8(face->style_name); + unlockFace(); fsType = freetype->fsType(); diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index a52fd45df2..e320be4421 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -70,7 +70,7 @@ #include <qmutex.h> -#include <harfbuzz-shaper.h> +#include "private/qharfbuzz_copy_p.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h index 1238cba4da..37a724ec7c 100644 --- a/src/gui/text/qfontinfo.h +++ b/src/gui/text/qfontinfo.h @@ -61,6 +61,7 @@ public: QFontInfo &operator=(const QFontInfo &); QString family() const; + QString styleName() const; int pixelSize() const; int pointSize() const; qreal pointSizeF() const; diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 4a51e56805..18b6357863 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -132,13 +132,27 @@ QGlyphRun &QGlyphRun::operator=(const QGlyphRun &other) */ bool QGlyphRun::operator==(const QGlyphRun &other) const { - return ((d == other.d) - || (d->glyphIndexes == other.d->glyphIndexes - && d->glyphPositions == other.d->glyphPositions - && d->overline == other.d->overline - && d->underline == other.d->underline - && d->strikeOut == other.d->strikeOut - && d->rawFont == other.d->rawFont)); + if (d == other.d) + return true; + + if ((d->glyphIndexDataSize != other.d->glyphIndexDataSize) + || (d->glyphPositionDataSize != other.d->glyphPositionDataSize)) { + return false; + } + + for (int i=0; i<qMax(d->glyphIndexDataSize, d->glyphPositionDataSize); ++i) { + if (i < d->glyphIndexDataSize && d->glyphIndexData[i] != other.d->glyphIndexData[i]) + return false; + + if (i < d->glyphPositionDataSize && d->glyphPositionData[i] != other.d->glyphPositionData[i]) + return false; + } + + + return (d->overline == other.d->overline + && d->underline == other.d->underline + && d->strikeOut == other.d->strikeOut + && d->rawFont == other.d->rawFont); } /*! @@ -151,36 +165,6 @@ bool QGlyphRun::operator!=(const QGlyphRun &other) const } /*! - \internal - - Adds together the lists of glyph indexes and positions in \a other and this QGlyphRun - object and returns the result. The font in the returned QGlyphRun will be the same as in - this QGlyphRun object. -*/ -QGlyphRun QGlyphRun::operator+(const QGlyphRun &other) const -{ - QGlyphRun ret(*this); - ret += other; - return ret; -} - -/*! - \internal - - Appends the glyph indexes and positions in \a other to this QGlyphRun object and returns - a reference to the current object. -*/ -QGlyphRun &QGlyphRun::operator+=(const QGlyphRun &other) -{ - detach(); - - d->glyphIndexes += other.d->glyphIndexes; - d->glyphPositions += other.d->glyphPositions; - - return *this; -} - -/*! Returns the font selected for this QGlyphRun object. \sa setRawFont() @@ -208,7 +192,13 @@ void QGlyphRun::setRawFont(const QRawFont &rawFont) */ QVector<quint32> QGlyphRun::glyphIndexes() const { - return d->glyphIndexes; + if (d->glyphIndexes.constData() == d->glyphIndexData) { + return d->glyphIndexes; + } else { + QVector<quint32> indexes(d->glyphIndexDataSize); + qMemCopy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32)); + return indexes; + } } /*! @@ -218,7 +208,9 @@ QVector<quint32> QGlyphRun::glyphIndexes() const void QGlyphRun::setGlyphIndexes(const QVector<quint32> &glyphIndexes) { detach(); - d->glyphIndexes = glyphIndexes; + d->glyphIndexes = glyphIndexes; // Keep a reference to the QVector to avoid copying + d->glyphIndexData = glyphIndexes.constData(); + d->glyphIndexDataSize = glyphIndexes.size(); } /*! @@ -226,7 +218,14 @@ void QGlyphRun::setGlyphIndexes(const QVector<quint32> &glyphIndexes) */ QVector<QPointF> QGlyphRun::positions() const { - return d->glyphPositions; + if (d->glyphPositions.constData() == d->glyphPositionData) { + return d->glyphPositions; + } else { + QVector<QPointF> glyphPositions(d->glyphPositionDataSize); + qMemCopy(glyphPositions.data(), d->glyphPositionData, + d->glyphPositionDataSize * sizeof(QPointF)); + return glyphPositions; + } } /*! @@ -236,7 +235,9 @@ QVector<QPointF> QGlyphRun::positions() const void QGlyphRun::setPositions(const QVector<QPointF> &positions) { detach(); - d->glyphPositions = positions; + d->glyphPositions = positions; // Keep a reference to the vector to avoid copying + d->glyphPositionData = positions.constData(); + d->glyphPositionDataSize = positions.size(); } /*! @@ -245,12 +246,33 @@ void QGlyphRun::setPositions(const QVector<QPointF> &positions) void QGlyphRun::clear() { detach(); - d->glyphPositions = QVector<QPointF>(); - d->glyphIndexes = QVector<quint32>(); d->rawFont = QRawFont(); d->strikeOut = false; d->overline = false; d->underline = false; + + setPositions(QVector<QPointF>()); + setGlyphIndexes(QVector<quint32>()); +} + +/*! + Sets the glyph indexes and positions of this QGlyphRun to use the first \a size + elements in the arrays \a glyphIndexArray and \a glyphPositionArray. The data is + \e not copied. The caller must guarantee that the arrays are not deleted as long + as this QGlyphRun and any copies of it exists. + + \sa setGlyphIndexes(), setPositions() +*/ +void QGlyphRun::setRawData(const quint32 *glyphIndexArray, const QPointF *glyphPositionArray, + int size) +{ + detach(); + d->glyphIndexes.clear(); + d->glyphPositions.clear(); + + d->glyphIndexData = glyphIndexArray; + d->glyphPositionData = glyphPositionArray; + d->glyphIndexDataSize = d->glyphPositionDataSize = size; } /*! diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index 99a1fc8593..b4f02f0d87 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -66,6 +66,10 @@ public: QRawFont rawFont() const; void setRawFont(const QRawFont &rawFont); + void setRawData(const quint32 *glyphIndexArray, + const QPointF *glyphPositionArray, + int size); + QVector<quint32> glyphIndexes() const; void setGlyphIndexes(const QVector<quint32> &glyphIndexes); diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h index 533679d96a..a7745e68ce 100644 --- a/src/gui/text/qglyphrun_p.h +++ b/src/gui/text/qglyphrun_p.h @@ -71,6 +71,10 @@ public: : overline(false) , underline(false) , strikeOut(false) + , glyphIndexData(glyphIndexes.constData()) + , glyphIndexDataSize(0) + , glyphPositionData(glyphPositions.constData()) + , glyphPositionDataSize(0) { } @@ -82,6 +86,10 @@ public: , overline(other.overline) , underline(other.underline) , strikeOut(other.strikeOut) + , glyphIndexData(other.glyphIndexData) + , glyphIndexDataSize(other.glyphIndexDataSize) + , glyphPositionData(other.glyphPositionData) + , glyphPositionDataSize(other.glyphPositionDataSize) { } @@ -92,6 +100,17 @@ public: uint overline : 1; uint underline : 1; uint strikeOut : 1; + + const quint32 *glyphIndexData; + int glyphIndexDataSize; + + const QPointF *glyphPositionData; + int glyphPositionDataSize; + + static QGlyphRunPrivate *get(const QGlyphRun &glyphRun) + { + return glyphRun.d.data(); + } }; QT_END_NAMESPACE diff --git a/src/gui/text/qharfbuzz_copy_p.h b/src/gui/text/qharfbuzz_copy_p.h new file mode 100644 index 0000000000..74b824ab35 --- /dev/null +++ b/src/gui/text/qharfbuzz_copy_p.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2007 Red Hat, Inc. + * + * This code is a modified version of some part of HarfBuzz, + * an OpenType Layout engine library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + */ + +#ifndef QHARFBUZZ_COPY_P_H +#define QHARFBUZZ_COPY_P_H + +/* + The purpose of this header file is to allow inclusion of the private + headers for font and text classes without having to pull in the full + harfbuzz library under QTDIR/src/3rdparty/harfbuzz/src +*/ +#if defined(QT_BUILD_GUI_LIB) || defined(QT_COMPILES_IN_HARFBUZZ) +#include <private/qharfbuzz_p.h> +#else + +extern "C" { + +#ifdef __xlC__ +typedef unsigned hb_bitfield; +#else +typedef quint8 hb_bitfield; +#endif + +typedef enum { + /* no error */ + HB_Err_Ok = 0x0000, + HB_Err_Not_Covered = 0xFFFF, + + /* _hb_err() is called whenever returning the following errors, + * and in a couple places for HB_Err_Not_Covered too. */ + + /* programmer error */ + HB_Err_Invalid_Argument = 0x1A66, + + /* font error */ + HB_Err_Invalid_SubTable_Format = 0x157F, + HB_Err_Invalid_SubTable = 0x1570, + HB_Err_Read_Error = 0x6EAD, + + /* system error */ + HB_Err_Out_Of_Memory = 0xDEAD +} HB_Error; + +typedef quint32 HB_Glyph; +typedef void * HB_Font; +typedef void * HB_Face; +typedef void * HB_FontRec; +typedef quint32 hb_uint32; +typedef qint32 HB_Fixed; + +typedef struct { + HB_Fixed x; + HB_Fixed y; +} HB_FixedPoint; + +// The GlyphAttrbutes class is used inline so it needs to be complete. +typedef struct { + hb_bitfield justification :4; /* Justification class */ + hb_bitfield clusterStart :1; /* First glyph of representation of cluster */ + hb_bitfield mark :1; /* needs to be positioned around base char */ + hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ + hb_bitfield dontPrint :1; + hb_bitfield combiningClass :8; +} HB_GlyphAttributes; + +// This struct is strictly not needed, but we replicate it completely in +// case the compiler tries to get clever with padding. +typedef struct { + /*HB_LineBreakType*/ hb_bitfield lineBreakType :2; + /*HB_Bool*/ hb_bitfield whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */ + /*HB_Bool*/ hb_bitfield charStop :1; /* Valid cursor position (for left/right arrow) */ + /*HB_Bool*/ hb_bitfield wordBoundary :1; + /*HB_Bool*/ hb_bitfield sentenceBoundary :1; + hb_bitfield unused :2; +} HB_CharAttributes; + +} + +#endif // ifdef QT_BUILD_GUI_LIB + +#endif // QHARFBUZZ_COPY_P_H diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 481180ec78..71762df09f 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -404,6 +404,19 @@ QString QRawFont::familyName() const } /*! + Returns the style name of this QRawFont. + + \sa QFont::styleName() +*/ +QString QRawFont::styleName() const +{ + if (!isValid()) + return QString(); + + return d->fontEngine->fontDef.styleName; +} + +/*! Returns the style of this QRawFont. \sa QFont::style() diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index 3857da35e0..aca33af127 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -84,6 +84,7 @@ public: bool operator==(const QRawFont &other) const; QString familyName() const; + QString styleName() const; QFont::Style style() const; int weight() const; diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp index e8c10a5748..db60459176 100644 --- a/src/gui/text/qrawfont_ft.cpp +++ b/src/gui/text/qrawfont_ft.cpp @@ -46,7 +46,7 @@ #include "qrawfont_p.h" #include "qfontengine_ft_p.h" -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) # include "qfontengine_x11_p.h" #endif @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE class QFontEngineFTRawFont -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) : public QFontEngineX11FT #else : public QFontEngineFT @@ -63,7 +63,7 @@ class QFontEngineFTRawFont { public: QFontEngineFTRawFont(const QFontDef &fontDef) -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) : QFontEngineX11FT(fontDef) #else : QFontEngineFT(fontDef) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index dfe3e410f6..5127fcf969 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -856,7 +856,7 @@ void QTextEngine::shapeLine(const QScriptLine &line) } } -#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) +#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) && defined(Q_WS_MAC) static bool enableHarfBuzz() { static enum { Yes, No, Unknown } status = Unknown; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 988e41e502..25ab1e4420 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -70,7 +70,9 @@ #ifndef QT_BUILD_COMPAT_LIB #include "private/qtextdocument_p.h" #endif -#include "private/qharfbuzz_p.h" + +#include "private/qharfbuzz_copy_p.h" + #include "private/qfixed_p.h" #include <stdlib.h> diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a88b46625a..e386b5eb1f 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2280,10 +2280,20 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const glyphIndexes.setRawFont(font); QPair<QFontEngine *, int> key(fontEngine, int(flags)); - if (!glyphsHash.contains(key)) + if (!glyphsHash.contains(key)) { glyphsHash.insert(key, glyphIndexes); - else - glyphsHash[key] += glyphIndexes; + } else { + QGlyphRun &glyphRun = glyphsHash[key]; + + QVector<quint32> indexes = glyphRun.glyphIndexes(); + QVector<QPointF> positions = glyphRun.positions(); + + indexes += glyphIndexes.glyphIndexes(); + positions += glyphIndexes.positions(); + + glyphRun.setGlyphIndexes(indexes); + glyphRun.setPositions(positions); + } } } diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index 23c863392a..e8535e089c 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -41,7 +41,8 @@ HEADERS += \ text/qrawfont.h \ text/qrawfont_p.h \ text/qglyphrun.h \ - text/qglyphrun_p.h + text/qglyphrun_p.h \ + text/qharfbuzz_copy_p.h SOURCES += \ text/qfont.cpp \ diff --git a/src/network/network.pro b/src/network/network.pro index 4ee71b028e..cfd3f95300 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -1,3 +1,5 @@ +load(qt_module) + # Qt network module TARGET = QtNetwork QPRO_PWD = $$PWD @@ -18,7 +20,7 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000 unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/network/qtnetworkversion.h diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 46665176cf..5316626638 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1908,7 +1908,7 @@ bool QAbstractSocket::waitForReadyRead(int msecs) if (state() != ConnectedState) return false; - } while (qt_timeout_value(msecs, stopWatch.elapsed()) > 0); + } while (msecs == -1 || qt_timeout_value(msecs, stopWatch.elapsed()) > 0); return false; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 7ba92e4244..2895d5a9b0 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -158,6 +158,7 @@ public: void setRenderTextActive(bool); bool isNativePaintingActive() const; + bool supportsTransformations(qreal, const QTransform &) const { return true; } private: Q_DISABLE_COPY(QGL2PaintEngineEx) }; diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 2ff4ce0f31..578ce0f660 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -1,3 +1,5 @@ +load(qt_module) + TARGET = QtOpenGL QPRO_PWD = $$PWD QT = core-private gui-private widgets-private @@ -13,7 +15,7 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/opengl/qtopenglversion.h diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index 5d5f5ce652..8d0ea83a47 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -143,6 +143,7 @@ public: Qt::HANDLE handle() const; #endif inline Type type() const { return QPaintEngine::OpenGL; } + bool supportsTransformations(qreal, const QTransform &) const { return true; } private: void drawPolyInternal(const QPolygonF &pa, bool close = true); diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 287ffce721..9e8596f19e 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -48,7 +48,7 @@ #include <QtGui/QPlatformWindow> #include <QtGui/QPlatformWindowFormat> -#include <QtOpenGL/private/qpixmapdata_gl_p.h> +#include <QtGui/private/qpixmap_raster_p.h> #include <EGL/egl.h> @@ -78,7 +78,7 @@ QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) co #ifdef QEGL_EXTRA_DEBUG qWarning("QEglIntegration::createPixmapData %d\n", type); #endif - return new QGLPixmapData(type); + return new QRasterPixmapData(type); } QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 1232df6d52..53f74e3ddf 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -141,6 +141,7 @@ void QWaylandWindow::damage(const QRegion ®ion) QVector<QRect> rects = region.rects(); for (int i = 0; i < rects.size(); i++) { const QRect rect = rects.at(i); + wl_buffer_damage(mBuffer->buffer(), rect.x(), rect.y(), rect.width(), rect.height()); wl_surface_damage(mSurface, rect.x(), rect.y(), rect.width(), rect.height()); } diff --git a/src/qbase.pri b/src/qbase.pri index cf02978853..528dd1e17a 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -1,226 +1 @@ -load(qt_module) - -isEmpty(MODULE):MODULE = $$section($$list($$basename(_PRO_FILE_)), ., 0, 0) -isEmpty(TARGET):error("You must set TARGET before include()'ing $${_FILE_}") - -MODULE_INCLUDES = $$eval(QT.$${MODULE}.includes) -MODULE_PRIVATE_INCLUDES = $$eval(QT.$${MODULE}.private_includes) -INCLUDEPATH *= $$MODULE_PRIVATE_INCLUDES -INCLUDEPATH *= $$MODULE_PRIVATE_INCLUDES/$$TARGET -INCLUDEPATH *= $$MODULE_INCLUDES $$MODULE_INCLUDES/.. #just for today to have some compat -!isEmpty(RCC_DIR): INCLUDEPATH += $$RCC_DIR -isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 -TEMPLATE = lib -isEmpty(QT_MAJOR_VERSION) { - VERSION=5.0.0 -} else { - VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} -} - -#load up the headers info -CONFIG += qt_install_headers -#headers.pri is loaded from the last include path -LAST_MODULE_INCLUDE=$$MODULE_INCLUDES -for(include_path, MODULE_INCLUDES):LAST_MODULE_INCLUDE=$${include_path} -HEADERS_PRI = $$LAST_MODULE_INCLUDE/headers.pri -include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI) - -#version overriding -win32 { - #because libnetwork.pro could be qmake'd (qmade?) before libqcore.pro we - #need to override the version of libq* in all other libq*'s just to be - #sure the same version is used - VERSIONS_LIST = $$split(VERSION, ".") - QT_LIBS_OVERRIDE = $$member(VERSIONS_LIST, 0) - for(lib, $$list(qtcore qtgui qtnetwork qtxml qtopengl qtsql qt3support)) { - eval(QMAKE_$${upper($$lib)}_VERSION_OVERRIDE = $$QT_LIBS_OVERRIDE) - eval(QMAKE_$${upper($$lib)}D_VERSION_OVERRIDE = $$QT_LIBS_OVERRIDE) - } -} - -#other -DESTDIR = $$QMAKE_LIBDIR_QT -win32:!wince*:DLLDESTDIR = $$[QT_INSTALL_PREFIX]/bin - -CONFIG += qt warn_on depend_includepath -CONFIG += qmake_cache target_qt -CONFIG -= fix_output_dirs -win32|mac:!macx-xcode:CONFIG += debug_and_release -linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF - -contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols -unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions -contains(QT_CONFIG, largefile):CONFIG += largefile - -#mac frameworks -mac:!static:contains(QT_CONFIG, qt_framework) { - #QMAKE_FRAMEWORK_VERSION = 4.0 - CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework - CONFIG(debug, debug|release) { - !build_pass:CONFIG += build_all - } else { #release - !debug_and_release|build_pass { - CONFIG -= qt_install_headers #no need to install these as well - FRAMEWORK_HEADERS.version = Versions - FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES - FRAMEWORK_HEADERS.path = Headers - equals(TARGET, QtCore) { - #headers generated by configure - !contains(FRAMEWORK_HEADERS.files, .*/qconfig.h) { - FRAMEWORK_HEADERS.files *= $$QT_BUILD_TREE/src/corelib/global/qconfig.h - } - } - } - QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS - } -} - -mac { - CONFIG += explicitlib - macx-g++ { - QMAKE_CFLAGS += -fconstant-cfstrings - QMAKE_CXXFLAGS += -fconstant-cfstrings - } -} - -win32:!shared:CONFIG += static - -win32-borland { - mng:QMAKE_CFLAGS_WARN_ON += -w-par - mng:QMAKE_CXXFLAGS_WARN_ON += -w-par - # Keep the size of the .tds file for the Qt library smaller than - # 34 Mbytes to avoid linking problems - QMAKE_CFLAGS_DEBUG += -vi -y- - QMAKE_CXXFLAGS_DEBUG += -vi -y- -} - -win32 { - INCLUDEPATH += tmp - !static: DEFINES+=QT_MAKEDLL -} -symbian { - shared { - DEFINES+=QT_MAKEDLL - TARGET.CAPABILITY = All -Tcb - - # When building without autotests, DEF files are used by default. - # This is to maintain binary compatibility with previous releases. - # To explicitly disable DEF files usage, eg. when lots of code churn is - # going on, and functions may be added and removed before shipping, - # configure with -no-usedeffiles - # WARNING - disabling DEF files *will* break BC with previous released versions - # of Qt, and the only compatibility will be between this build of Qt and anything - # built in this exact environment. *Never* use this when building a version - # for release. - contains(CONFIG, def_files) { - DEF_FILE=../s60installs - } - } - load(armcc_warnings) - - # workaround for the fact that some of our required includes in Symbian^3 - # now depend upon files in epoc32/include/platform - INCLUDEPATH += $$OS_LAYER_SYSTEMINCLUDE -} -win32-borland:INCLUDEPATH += kernel - -aix-g++* { - QMAKE_CFLAGS += -mminimal-toc - QMAKE_CXXFLAGS += -mminimal-toc -} - -embedded { - EMBEDDED_H = $$EMBEDDED_CPP -} - -DEPENDPATH += ;$$NETWORK_H;$$KERNEL_H;$$WIDGETS_H;$$SQL_H;$$TABLE_H;$$DIALOGS_H; -DEPENDPATH += $$ICONVIEW_H;$$OPENGL_H;$$THREAD_H;$$TOOLS_H;$$CODECS_H; -DEPENDPATH += $$WORKSPACE_H;$$XML_H;$$STYLES_H;$$COMPAT_H -embedded:DEPENDPATH += ;$$EMBEDDED_H - -!static:PRL_EXPORT_DEFINES += QT_SHARED - -#install directives -include(qt_install.pri) - -unix:!symbian { - CONFIG += create_libtool create_pc explicitlib - QMAKE_LIBTOOL_LIBDIR = $$[QT_INSTALL_LIBS] - QMAKE_PRL_LIBDIR = $$[QT_INSTALL_LIBS] - QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS] - QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET - QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS] - QMAKE_PKGCONFIG_DESTDIR = pkgconfig - include_replace.match = $$QMAKE_INCDIR_QT - include_replace.replace = $$[QT_INSTALL_HEADERS] - lib_replace.match = $$QMAKE_LIBDIR_QT - lib_replace.replace = $$[QT_INSTALL_LIBS] - prefix_replace.match = $$QT_BUILD_TREE - prefix_replace.replace = $$[QT_INSTALL_PREFIX] - QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace - QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace - QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace -} - -win32-g++* { - CONFIG += create_pc - QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS] - QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET - QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS] - QMAKE_PKGCONFIG_DESTDIR = pkgconfig -} - -contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE -DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS -contains(QT_CONFIG, gui-qt3support):DEFINES *= QT3_SUPPORT -DEFINES *= QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code -DEFINES *= QT_USE_QSTRINGBUILDER - -TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end - -qtPrepareTool(QMAKE_LUPDATE, lupdate) -qtPrepareTool(QMAKE_LRELEASE, lrelease) - -moc_dir.name = moc_location -moc_dir.variable = QMAKE_MOC - -uic_dir.name = uic_location -uic_dir.variable = QMAKE_UIC - -rcc_dir.name = rcc_location -rcc_dir.variable = QMAKE_RCC - -lupdate_dir.name = lupdate_location -lupdate_dir.variable = QMAKE_LUPDATE - -lrelease_dir.name = lrelease_location -lrelease_dir.variable = QMAKE_LRELEASE - -QMAKE_PKGCONFIG_VARIABLES += moc_dir uic_dir rcc_dir lupdate_dir lrelease_dir - -include(qt_targets.pri) - -win32:DEFINES+=_USE_MATH_DEFINES - -symbian { - # Make partial upgrade SIS file for all dll's except webkit and s60main - !contains(TARGET.UID3, 0x200267C2):!contains(TARGET.UID3, 0xE00267C2):!contains(TARGET.UID3, 0x2001E61F):!contains(TARGET.UID3, 0xE001E61F) { - # Partial upgrade SIS file - vendorinfo = \ - "; Localised Vendor name" \ - "%{\"Nokia\"}" \ - " " \ - "; Unique Vendor name" \ - ":\"Nokia, Qt\"" \ - " " - isEmpty(QT_LIBINFIX): PARTIAL_UPGRADE_UID = 0x2001E61C - else: PARTIAL_UPGRADE_UID = 0xE001E61C - - pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \ - "$${LITERAL_HASH}{\"$${TARGET}\"}, ($$PARTIAL_UPGRADE_UID), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" - partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.files = $$QMAKE_LIBDIR_QT/$${TARGET}.dll - partial_upgrade.path = c:/sys/bin - DEPLOYMENT += partial_upgrade - } -} +load(qt_module_config) diff --git a/src/qt_install.pri b/src/qt_install.pri index f5ad51f591..8a9a7ab5ba 100644 --- a/src/qt_install.pri +++ b/src/qt_install.pri @@ -1,44 +1 @@ -#always install the library -win32 { - dlltarget.path=$$[QT_INSTALL_BINS] - INSTALLS += dlltarget -} -target.path=$$[QT_INSTALL_LIBS] -INSTALLS += target - -#headers -qt_install_headers { - INSTALL_HEADERS = $$SYNCQT.HEADER_FILES - equals(TARGET, QtCore) { - #headers generated by configure - INSTALL_HEADERS *= $$QT_BUILD_TREE/src/corelib/global/qconfig.h \ - $$QT_SOURCE_TREE/src/corelib/arch/$$QT_ARCH/arch - } - - equals(TARGET, phonon) { - class_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET - } else { - flat_headers.files = $$INSTALL_HEADERS - flat_headers.path = $$[QT_INSTALL_HEADERS]/Qt - INSTALLS += flat_headers - - class_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET - } - class_headers.files = $$SYNCQT.HEADER_CLASSES - INSTALLS += class_headers - - targ_headers.files = $$INSTALL_HEADERS - targ_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET - INSTALLS += targ_headers - - private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES - private_headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET/$$eval(QT.$${MODULE}.VERSION)/$$TARGET/private - INSTALLS += private_headers -} - -embedded|qpa: equals(TARGET, QtGui) { - # install fonts for embedded - INSTALLS += fonts - fonts.path = $$[QT_INSTALL_LIBS]/fonts - fonts.files = $$QT_SOURCE_TREE/lib/fonts/* -} +load(qt_installs) diff --git a/src/qt_targets.pri b/src/qt_targets.pri index af1a32bb02..900b50bde4 100644 --- a/src/qt_targets.pri +++ b/src/qt_targets.pri @@ -1,4 +1 @@ -QMAKE_TARGET_COMPANY = Nokia Corporation and/or its subsidiary(-ies) -QMAKE_TARGET_PRODUCT = Qt4 -QMAKE_TARGET_DESCRIPTION = C++ application development framework. -QMAKE_TARGET_COPYRIGHT = Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +load(qt_targets) diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index 4c598e2857..8cdd00e56f 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -35,4 +35,4 @@ symbian { error("$$_FILE_ is intended only for Symbian!") } -include(../qbase.pri) +load(qt_module_config) diff --git a/src/sql/sql.pro b/src/sql/sql.pro index c7cbbc4985..445946e07c 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -1,3 +1,5 @@ +load(qt_module) + TARGET = QtSql QPRO_PWD = $$PWD QT = core-private @@ -11,7 +13,7 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000 unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/sql/qtsqlversion.h diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index 18312d4829..435036e0c8 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -1,3 +1,5 @@ +load(qt_module) + TARGET = QtTest QPRO_PWD = $$PWD QT = core gui widgets @@ -84,7 +86,7 @@ qpa:mac: { } } -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/testlib/qttestlibversion.h diff --git a/src/tools/moc/moc.pro b/src/tools/moc/moc.pro index 0b8ddbe31e..8e2e76d4b9 100644 --- a/src/tools/moc/moc.pro +++ b/src/tools/moc/moc.pro @@ -15,4 +15,4 @@ include(../bootstrap/bootstrap.pri) target.path=$$[QT_INSTALL_BINS] INSTALLS += target -include(../../qt_targets.pri) +load(qt_targets) diff --git a/src/tools/rcc/rcc.pro b/src/tools/rcc/rcc.pro index edc85a1d15..6c78642406 100644 --- a/src/tools/rcc/rcc.pro +++ b/src/tools/rcc/rcc.pro @@ -13,4 +13,4 @@ include(../bootstrap/bootstrap.pri) target.path=$$[QT_INSTALL_BINS] INSTALLS += target -include(../../qt_targets.pri) +load(qt_targets) diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro index 591925ca90..0b0ae782d4 100644 --- a/src/tools/uic/uic.pro +++ b/src/tools/uic/uic.pro @@ -20,4 +20,4 @@ include(../bootstrap/bootstrap.pri) target.path=$$[QT_INSTALL_BINS] INSTALLS += target -include(../../qt_targets.pri) +load(qt_targets) diff --git a/src/uitools/uitools.pro b/src/uitools/uitools.pro index 0af26d9375..3f9f166dbd 100644 --- a/src/uitools/uitools.pro +++ b/src/uitools/uitools.pro @@ -3,7 +3,8 @@ TEMPLATE = lib TARGET = $$qtLibraryTarget(QtUiTools) QT = core xml -CONFIG += qt staticlib # Not adding module here, since the module pri's are only used for building +CONFIG += qt staticlib module +MODULE = uitools MODULE_PRI = ../modules/qt_uitools.pri \ ../modules/qt_uilib.pri @@ -22,7 +23,7 @@ isEmpty(QT_MAJOR_VERSION) { } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } -include(../qt_targets.pri) +load(qt_targets) QMAKE_TARGET_PRODUCT = UiLoader QMAKE_TARGET_DESCRIPTION = QUiLoader @@ -34,7 +35,17 @@ SOURCES += quiloader.cpp include($$QT_BUILD_TREE/include/QtUiTools/headers.pri, "", true) quitools_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES quitools_headers.path = $$[QT_INSTALL_HEADERS]/QtUiTools -INSTALLS += quitools_headers +quitools_private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES +quitools_private_headers.path = $$[QT_INSTALL_HEADERS]/QtUiTools/$$QT.uitools.VERSION/QtUiTools/private +INSTALLS += quitools_headers quitools_private_headers + +# Uilib is from designer. +include($$QT_BUILD_TREE/include/QtDesigner/headers.pri, "", true) +quilib_headers.files = $$replace($$list($$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES), ^, ../../tools/uilib/) +quilib_headers.path = $$[QT_INSTALL_HEADERS]/QtDesigner +quilib_private_headers.files = $$replace($$list($$SYNCQT.PRIVATE_HEADER_FILES), ^, ../../tools/uilib/) +quilib_private_headers.path = $$[QT_INSTALL_HEADERS]/QtDesigner/$$QT.uilib.VERSION/QtDesigner/private +INSTALLS += quilib_headers quilib_private_headers target.path=$$[QT_INSTALL_LIBS] INSTALLS += target diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index d3df5c9a2c..9d6e348b0d 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -66,6 +66,9 @@ #if defined(Q_OS_WINCE) extern bool qt_priv_ptr_valid; #endif +#if defined(Q_OS_UNIX) +#include <pwd.h> +#endif #endif QT_BEGIN_NAMESPACE @@ -858,23 +861,78 @@ void QFileDialog::selectFile(const QString &filename) d->lineEdit()->setText(file); } +#ifdef Q_OS_UNIX +Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0) +{ + if (expanded != 0) + *expanded = false; + if (!path.startsWith(QLatin1Char('~'))) + return path; + QString ret = path; + QStringList tokens = ret.split(QDir::separator()); + if (tokens.first() == QLatin1String("~")) { + ret.replace(0, 1, QDir::homePath()); + } else { + QString userName = tokens.first(); + userName.remove(0, 1); +#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) + passwd pw; + passwd *tmpPw; + char buf[200]; + const int bufSize = sizeof(buf); + int err = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize, &tmpPw); + if (err || !tmpPw) + return ret; + const QString homePath = QString::fromLocal8Bit(pw.pw_dir); +#else + passwd *pw = getpwnam(userName.toLocal8Bit().constData()); + if (!pw) + return ret; + const QString homePath = QString::fromLocal8Bit(pw->pw_dir); +#endif + ret.replace(0, tokens.first().length(), homePath); + } + if (expanded != 0) + *expanded = true; + return ret; +} +#endif + /** Returns the text in the line edit which can be one or more file names */ QStringList QFileDialogPrivate::typedFiles() const { + Q_Q(const QFileDialog); QStringList files; QString editText = lineEdit()->text(); - if (!editText.contains(QLatin1Char('"'))) + if (!editText.contains(QLatin1Char('"'))) { +#ifdef Q_OS_UNIX + const QString prefix = q->directory().absolutePath() + QDir::separator(); + if (QFile::exists(prefix + editText)) + files << editText; + else + files << qt_tildeExpansion(editText); +#else files << editText; - else { +#endif + } else { // " is used to separate files like so: "file1" "file2" "file3" ... // ### need escape character for filenames with quotes (") QStringList tokens = editText.split(QLatin1Char('\"')); for (int i=0; i<tokens.size(); ++i) { if ((i % 2) == 0) continue; // Every even token is a separator +#ifdef Q_OS_UNIX + const QString token = tokens.at(i); + const QString prefix = q->directory().absolutePath() + QDir::separator(); + if (QFile::exists(prefix + token)) + files << token; + else + files << qt_tildeExpansion(token); +#else files << toInternal(tokens.at(i)); +#endif } } return addDefaultSuffixToFiles(files); @@ -3338,6 +3396,17 @@ QStringList QFSCompleter::splitPath(const QString &path) const pathCopy = pathCopy.mid(2); else doubleSlash.clear(); +#elif defined(Q_OS_UNIX) + bool expanded; + pathCopy = qt_tildeExpansion(pathCopy, &expanded); + if (expanded) { + QFileSystemModel *dirModel; + if (proxyModel) + dirModel = qobject_cast<QFileSystemModel *>(proxyModel->sourceModel()); + else + dirModel = sourceModel; + dirModel->fetchMore(dirModel->index(pathCopy)); + } #endif QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']')); @@ -3354,14 +3423,14 @@ QStringList QFSCompleter::splitPath(const QString &path) const parts.append(QString()); #else QStringList parts = pathCopy.split(re); - if (path[0] == sep[0]) // read the "/" at the beginning as the split removed it + if (pathCopy[0] == sep[0]) // read the "/" at the beginning as the split removed it parts[0] = sep[0]; #endif #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) bool startsFromRoot = !parts.isEmpty() && parts[0].endsWith(QLatin1Char(':')); #else - bool startsFromRoot = path[0] == sep[0]; + bool startsFromRoot = pathCopy[0] == sep[0]; #endif if (parts.count() == 1 || (parts.count() > 1 && !startsFromRoot)) { const QFileSystemModel *dirModel; diff --git a/src/widgets/platforms/mac/qfontdatabase_mac.cpp b/src/widgets/platforms/mac/qfontdatabase_mac.cpp index 6fdaf06c8b..724dbf6c4a 100644 --- a/src/widgets/platforms/mac/qfontdatabase_mac.cpp +++ b/src/widgets/platforms/mac/qfontdatabase_mac.cpp @@ -249,6 +249,63 @@ static inline float weightToFloat(unsigned int weight) return (weight - 50) / 100.0; } +static QFontEngine *loadFromDatabase(const QFontDef &req, const QFontPrivate *d) +{ +#if defined(QT_MAC_USE_COCOA) + QCFString fontName = NULL; +#else + ATSFontFamilyRef familyRef = 0; + ATSFontRef fontRef = 0; +#endif + + QStringList family_list = familyList(req); + + const char *stylehint = styleHint(req); + if (stylehint) + family_list << QLatin1String(stylehint); + + // add QFont::defaultFamily() to the list, for compatibility with previous versions + family_list << QApplication::font().defaultFamily(); + + QMutexLocker locker(fontDatabaseMutex()); + QFontDatabasePrivate *db = privateDb(); + if (!db->count) + initializeDb(); + for (int i = 0; i < family_list.size(); ++i) { + for (int k = 0; k < db->count; ++k) { + if (db->families[k]->name.compare(family_list.at(i), Qt::CaseInsensitive) == 0) { + QByteArray family_name = db->families[k]->name.toUtf8(); +#if defined(QT_MAC_USE_COCOA) + QCFType<CTFontRef> ctFont = CTFontCreateWithName(QCFString(db->families[k]->name), 12, NULL); + if (ctFont) { + fontName = CTFontCopyFullName(ctFont); + goto found; + } +#else + familyRef = ATSFontFamilyFindFromName(QCFString(db->families[k]->name), kATSOptionFlagsDefault); + if (familyRef) { + fontRef = ATSFontFindFromName(QCFString(db->families[k]->name), kATSOptionFlagsDefault); + goto found; + } +#endif + } + } + } +found: +#ifdef QT_MAC_USE_COCOA + if (fontName) + return new QCoreTextFontEngineMulti(fontName, req, d->kerning); +#else + if (familyRef) { + QCFString actualName; + if (ATSFontFamilyGetName(familyRef, kATSOptionFlagsDefault, &actualName) == noErr) + req.family = actualName; + return new QFontEngineMacMulti(familyRef, req, fontDef, d->kerning); + } +#endif + return NULL; +} + void QFontDatabase::load(const QFontPrivate *d, int script) { // sanity checks @@ -289,69 +346,38 @@ void QFontDatabase::load(const QFontPrivate *d, int script) return; // the font info and fontdef should already be filled } - //find the font - QStringList family_list = familyList(req); - - const char *stylehint = styleHint(req); - if (stylehint) - family_list << QLatin1String(stylehint); - - // add QFont::defaultFamily() to the list, for compatibility with - // previous versions - family_list << QApplication::font().defaultFamily(); - + QFontEngine *engine = NULL; #if defined(QT_MAC_USE_COCOA) - QCFString fontName = NULL, familyName = NULL; -#else - ATSFontFamilyRef familyRef = 0; - ATSFontRef fontRef = 0; -#endif - - QMutexLocker locker(fontDatabaseMutex()); - QFontDatabasePrivate *db = privateDb(); - if (!db->count) - initializeDb(); - for(int i = 0; i < family_list.size(); ++i) { - for (int k = 0; k < db->count; ++k) { - if (db->families[k]->name.compare(family_list.at(i), Qt::CaseInsensitive) == 0) { - QByteArray family_name = db->families[k]->name.toUtf8(); -#if defined(QT_MAC_USE_COCOA) - QCFType<CTFontRef> ctFont = CTFontCreateWithName(QCFString(db->families[k]->name), 12, NULL); - if (ctFont) { - fontName = CTFontCopyFullName(ctFont); - familyName = CTFontCopyFamilyName(ctFont); - goto FamilyFound; - } -#else - familyRef = ATSFontFamilyFindFromName(QCFString(db->families[k]->name), kATSOptionFlagsDefault); - if (familyRef) { - fontRef = ATSFontFindFromName(QCFString(db->families[k]->name), kATSOptionFlagsDefault); - goto FamilyFound; - } -#endif + // Shortcut to get the font directly without going through the font database + if (!req.family.isEmpty() && !req.styleName.isEmpty()) { + QCFString expectedFamily = QCFString(req.family); + QCFString expectedStyle = QCFString(req.styleName); + + QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(NULL, 0, + &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, expectedFamily); + CFDictionaryAddValue(attributes, kCTFontStyleNameAttribute, expectedStyle); + + QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithAttributes(attributes); + CGAffineTransform transform = qt_transform_from_fontdef(req); + QCFType<CTFontRef> ctFont = CTFontCreateWithFontDescriptor(descriptor, req.pixelSize, &transform); + if (ctFont) { + QCFString familyName = CTFontCopyFamilyName(ctFont); + // Only accept the font if the family name is exactly the same as we specified + if (CFEqual(expectedFamily, familyName)) { + engine = new QCoreTextFontEngineMulti(ctFont, req, d->kerning); } } } -FamilyFound: - //fill in the engine's font definition - QFontDef fontDef = d->request; //copy.. - if(fontDef.pointSize < 0) - fontDef.pointSize = qt_mac_pointsize(fontDef, d->dpi); - else - fontDef.pixelSize = qt_mac_pixelsize(fontDef, d->dpi); - -#ifdef QT_MAC_USE_COCOA - fontDef.family = familyName; - QFontEngine *engine = new QCoreTextFontEngineMulti(fontName, fontDef, d->kerning); -#else - QCFString actualName; - if (ATSFontFamilyGetName(familyRef, kATSOptionFlagsDefault, &actualName) == noErr) - fontDef.family = actualName; - QFontEngine *engine = new QFontEngineMacMulti(familyRef, fontRef, fontDef, d->kerning); #endif - d->engineData->engine = engine; - engine->ref.ref(); //a ref for the engineData->engine - QFontCache::instance()->insertEngine(key, engine); + if (!engine) + engine = loadFromDatabase(req, d); + + if (engine) { + d->engineData->engine = engine; + engine->ref.ref(); + QFontCache::instance()->insertEngine(key, engine); + } } static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) diff --git a/src/widgets/platforms/mac/qfontengine_coretext.mm b/src/widgets/platforms/mac/qfontengine_coretext.mm index 737edc3a8c..a68a1551d9 100644 --- a/src/widgets/platforms/mac/qfontengine_coretext.mm +++ b/src/widgets/platforms/mac/qfontengine_coretext.mm @@ -116,17 +116,11 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const QCFString &name, const init(kerning); } -QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(CGFontRef cgFontRef, const QFontDef &fontDef, bool kerning) +QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(CTFontRef ctFontRef, const QFontDef &fontDef, bool kerning) : QFontEngineMulti(0) { this->fontDef = fontDef; - - transform = CGAffineTransformIdentity; - if (fontDef.stretch != 100) { - transform = CGAffineTransformMakeScale(float(fontDef.stretch) / float(100), 1); - } - - ctfont = CTFontCreateWithGraphicsFont(cgFontRef, fontDef.pixelSize, &transform, NULL); + ctfont = (CTFontRef) CFRetain(ctFontRef); init(kerning); } @@ -149,6 +143,9 @@ void QCoreTextFontEngineMulti::init(bool kerning) } QCoreTextFontEngine *fe = new QCoreTextFontEngine(ctfont, fontDef); + fontDef.family = fe->fontDef.family; + fontDef.styleName = fe->fontDef.styleName; + transform = fe->transform; fe->ref.ref(); engines.append(fe); } @@ -405,7 +402,7 @@ void QCoreTextFontEngineMulti::loadEngine(int) extern int qt_antialiasing_threshold; // from qapplication.cpp -static inline CGAffineTransform transformFromFontDef(const QFontDef &fontDef) +CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef) { CGAffineTransform transform = CGAffineTransformIdentity; if (fontDef.stretch != 100) @@ -416,7 +413,7 @@ static inline CGAffineTransform transformFromFontDef(const QFontDef &fontDef) QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def) { fontDef = def; - transform = transformFromFontDef(fontDef); + transform = qt_transform_from_fontdef(fontDef); ctfont = font; CFRetain(ctfont); cgFont = CTFontCopyGraphicsFont(font, NULL); @@ -426,7 +423,7 @@ QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def) QCoreTextFontEngine::QCoreTextFontEngine(CGFontRef font, const QFontDef &def) { fontDef = def; - transform = transformFromFontDef(fontDef); + transform = qt_transform_from_fontdef(fontDef); cgFont = font; // Keep reference count balanced CFRetain(cgFont); @@ -464,6 +461,9 @@ void QCoreTextFontEngine::init() QCFString family = CTFontCopyFamilyName(ctfont); fontDef.family = family; + QCFString styleName = (CFStringRef) CTFontCopyAttribute(ctfont, kCTFontStyleNameAttribute); + fontDef.styleName = styleName; + synthesisFlags = 0; CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont); if (traits & kCTFontItalicTrait) @@ -745,9 +745,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition 8, im.bytesPerLine(), colorspace, cgflags); CGContextSetFontSize(ctx, fontDef.pixelSize); - CGContextSetShouldAntialias(ctx, aa || - (fontDef.pointSize > qt_antialiasing_threshold - && !(fontDef.styleStrategy & QFont::NoAntialias))); + CGContextSetShouldAntialias(ctx, (aa || fontDef.pointSize > qt_antialiasing_threshold) + && !(fontDef.styleStrategy & QFont::NoAntialias)); CGContextSetShouldSmoothFonts(ctx, aa); CGAffineTransform oldTextMatrix = CGContextGetTextMatrix(ctx); CGAffineTransform cgMatrix = CGAffineTransformMake(1, 0, 0, 1, 0, 0); diff --git a/src/widgets/platforms/mac/qfontengine_coretext_p.h b/src/widgets/platforms/mac/qfontengine_coretext_p.h index 98d3b50c66..3ca8a0ad60 100644 --- a/src/widgets/platforms/mac/qfontengine_coretext_p.h +++ b/src/widgets/platforms/mac/qfontengine_coretext_p.h @@ -113,7 +113,7 @@ class QCoreTextFontEngineMulti : public QFontEngineMulti { public: QCoreTextFontEngineMulti(const QCFString &name, const QFontDef &fontDef, bool kerning); - QCoreTextFontEngineMulti(CGFontRef cgFontRef, const QFontDef &fontDef, bool kerning); + QCoreTextFontEngineMulti(CTFontRef ctFontRef, const QFontDef &fontDef, bool kerning); ~QCoreTextFontEngineMulti(); virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, @@ -141,6 +141,8 @@ private: friend class QFontDialogPrivate; }; +CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef); + #endif// !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) #endif // QFONTENGINE_CORETEXT_P_H diff --git a/src/widgets/platforms/mac/qpaintengine_mac_p.h b/src/widgets/platforms/mac/qpaintengine_mac_p.h index c87501ee1a..2434011e52 100644 --- a/src/widgets/platforms/mac/qpaintengine_mac_p.h +++ b/src/widgets/platforms/mac/qpaintengine_mac_p.h @@ -121,6 +121,8 @@ public: void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) { QPaintEngine::drawPolygon(points, pointCount, mode); } + bool supportsTransformations(qreal, const QTransform &) const { return true; }; + protected: friend class QMacPrintEngine; friend class QMacPrintEnginePrivate; diff --git a/src/widgets/platforms/x11/qfontdatabase_x11.cpp b/src/widgets/platforms/x11/qfontdatabase_x11.cpp index a5fdcb5216..754334c0c4 100644 --- a/src/widgets/platforms/x11/qfontdatabase_x11.cpp +++ b/src/widgets/platforms/x11/qfontdatabase_x11.cpp @@ -1452,6 +1452,35 @@ static const char *styleHint(const QFontDef &request) void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontDef &request) { + double size_value = qMax(qreal(1.), request.pixelSize); + FcPatternDel(pattern, FC_PIXEL_SIZE); + FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size_value); + + if (X11->display && QX11Info::appDepth(screen) <= 8) { + FcPatternDel(pattern, FC_ANTIALIAS); + // can't do antialiasing on 8bpp + FcPatternAddBool(pattern, FC_ANTIALIAS, false); + } else if (request.styleStrategy & (QFont::PreferAntialias|QFont::NoAntialias)) { + FcPatternDel(pattern, FC_ANTIALIAS); + FcPatternAddBool(pattern, FC_ANTIALIAS, + !(request.styleStrategy & QFont::NoAntialias)); + } + + if (script != QUnicodeTables::Common && *specialLanguages[script] != '\0') { + Q_ASSERT(script < QUnicodeTables::ScriptCount); + FcLangSet *ls = FcLangSetCreate(); + FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]); + FcPatternDel(pattern, FC_LANG); + FcPatternAddLangSet(pattern, FC_LANG, ls); + FcLangSetDestroy(ls); + } + + if (!request.styleName.isEmpty()) { + QByteArray cs = request.styleName.toUtf8(); + FcPatternAddString(pattern, FC_STYLE, (const FcChar8 *) cs.constData()); + return; + } + int weight_value = FC_WEIGHT_BLACK; if (request.weight == 0) weight_value = FC_WEIGHT_MEDIUM; @@ -1474,34 +1503,11 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD FcPatternDel(pattern, FC_SLANT); FcPatternAddInteger(pattern, FC_SLANT, slant_value); - double size_value = qMax(qreal(1.), request.pixelSize); - FcPatternDel(pattern, FC_PIXEL_SIZE); - FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size_value); - int stretch = request.stretch; if (!stretch) stretch = 100; FcPatternDel(pattern, FC_WIDTH); FcPatternAddInteger(pattern, FC_WIDTH, stretch); - - if (X11->display && QX11Info::appDepth(screen) <= 8) { - FcPatternDel(pattern, FC_ANTIALIAS); - // can't do antialiasing on 8bpp - FcPatternAddBool(pattern, FC_ANTIALIAS, false); - } else if (request.styleStrategy & (QFont::PreferAntialias|QFont::NoAntialias)) { - FcPatternDel(pattern, FC_ANTIALIAS); - FcPatternAddBool(pattern, FC_ANTIALIAS, - !(request.styleStrategy & QFont::NoAntialias)); - } - - if (script != QUnicodeTables::Common && *specialLanguages[script] != '\0') { - Q_ASSERT(script < QUnicodeTables::ScriptCount); - FcLangSet *ls = FcLangSetCreate(); - FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]); - FcPatternDel(pattern, FC_LANG); - FcPatternAddLangSet(pattern, FC_LANG, ls); - FcLangSetDestroy(ls); - } } static bool preferScalable(const QFontDef &request) @@ -2049,7 +2055,8 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) return; FcPatternDel(pattern, FC_FILE); - FcPatternAddString(pattern, FC_FILE, (const FcChar8 *)fnt->fileName.toUtf8().constData()); + QByteArray cs = fnt->fileName.toUtf8(); + FcPatternAddString(pattern, FC_FILE, (const FcChar8 *) cs.constData()); FcChar8 *fam = 0, *familylang = 0; int i, n = 0; @@ -2135,7 +2142,8 @@ QString QFontDatabase::resolveFontFamilyAlias(const QString &family) if (!pattern) return family; - FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) family.toUtf8().data()); + QByteArray cs = family.toUtf8(); + FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) cs.constData()); FcConfigSubstitute(0, pattern, FcMatchPattern); FcDefaultSubstitute(pattern); diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index 8c2710ccd9..b353e8e382 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -16,6 +16,6 @@ win32 { } !win32:error("$$_FILE_ is intended only for Windows!") -include(../qbase.pri) +load(qt_module_config) wince*:QMAKE_POST_LINK = diff --git a/src/xml/xml.pro b/src/xml/xml.pro index 986e478b69..f1d2baca50 100644 --- a/src/xml/xml.pro +++ b/src/xml/xml.pro @@ -1,3 +1,5 @@ +load(qt_module) + TARGET = QtXml QPRO_PWD = $$PWD QT = core-private @@ -10,7 +12,7 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000 unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore -include(../qbase.pri) +load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/xml/qtxmlversion.h |