summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@nokia.com>2011-08-15 07:31:15 (GMT)
committerEike Ziller <eike.ziller@nokia.com>2011-08-24 07:04:39 (GMT)
commitec7a1dce2ed0766e7681598c17a80468794a249e (patch)
tree14d2ae4c652c7ce47504b3c5ee4bd9cb1f625578 /src/gui
parent71774c738ef466167bac36174948a3aabe0a6811 (diff)
downloadQt-ec7a1dce2ed0766e7681598c17a80468794a249e.zip
Qt-ec7a1dce2ed0766e7681598c17a80468794a249e.tar.gz
Qt-ec7a1dce2ed0766e7681598c17a80468794a249e.tar.bz2
Use CoreText for font rendering on uikit.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/text/qfontengine_coretext.mm12
-rw-r--r--src/gui/text/qfontengine_coretext_p.h6
-rw-r--r--src/gui/text/text.pri9
4 files changed, 22 insertions, 9 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 76d7316..9826689 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3098,7 +3098,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
ensurePen();
ensureState();
-#if defined (Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined (Q_WS_WIN) || defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA))
if (!supportsTransformations(ti.fontEngine)) {
QVarLengthArray<QFixedPoint> positions;
@@ -3438,7 +3438,7 @@ bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine)
bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransform &m) const
{
-#if defined(Q_WS_MAC)
+#if defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA))
// Mac font engines don't support scaling and rotation
if (m.type() > QTransform::TxTranslate)
#else
diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm
index 64d4a24..153451e 100644
--- a/src/gui/text/qfontengine_coretext.mm
+++ b/src/gui/text/qfontengine_coretext.mm
@@ -135,7 +135,7 @@ void QCoreTextFontEngineMulti::init(bool kerning)
attributeDict = CFDictionaryCreateMutable(0, 2,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(attributeDict, NSFontAttributeName, ctfont);
+ CFDictionaryAddValue(attributeDict, kCTFontAttributeName, ctfont);
if (!kerning) {
float zero = 0.0;
QCFType<CFNumberRef> noKern = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);
@@ -257,7 +257,7 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
//NSLog(@"Dictionary %@", runAttribs);
if (!runAttribs)
runAttribs = attributeDict;
- CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttribs, NSFontAttributeName));
+ CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttribs, kCTFontAttributeName));
uint fontIndex = fontIndexForFont(runFont);
const QFontEngine *engine = engineAt(fontIndex);
fontIndex <<= 24;
@@ -547,7 +547,6 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
ret.xoff = ret.xoff.round();
ret.yoff = ret.yoff.round();
}
-
return ret;
}
@@ -723,7 +722,12 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
QImage im(qRound(br.width) + 2, qRound(br.height) + 2, QImage::Format_RGB32);
im.fill(0);
- CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+ CGColorSpaceRef colorspace =
+#ifdef Q_WS_MAC
+ CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+#else
+ CGColorSpaceCreateDeviceRGB();
+#endif
uint cgflags = kCGImageAlphaNoneSkipFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
cgflags |= kCGBitmapByteOrder32Host;
diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/gui/text/qfontengine_coretext_p.h
index efe8295..0a2ae1f 100644
--- a/src/gui/text/qfontengine_coretext_p.h
+++ b/src/gui/text/qfontengine_coretext_p.h
@@ -44,6 +44,12 @@
#include <private/qfontengine_p.h>
+#ifdef QT_NO_CORESERVICES
+#include <CoreText/CoreText.h>
+#include <CoreGraphics/CoreGraphics.h>
+#include <private/qcore_mac_p.h>
+#endif
+
#if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
class QRawFontPrivate;
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index b6cdc52..1cfacf7 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -106,14 +106,17 @@ unix:x11 {
!embedded:!qpa:!x11:mac {
HEADERS += \
text/qfontengine_mac_p.h
- OBJECTIVE_HEADERS += \
- text/qfontengine_coretext_p.h
SOURCES += \
text/qfont_mac.cpp \
text/qrawfont_mac.cpp
OBJECTIVE_SOURCES += \
- text/qfontengine_coretext.mm \
text/qfontengine_mac.mm
+}
+!embedded:!x11:mac {
+ OBJECTIVE_HEADERS += \
+ text/qfontengine_coretext_p.h
+ OBJECTIVE_SOURCES += \
+ text/qfontengine_coretext.mm
contains(QT_CONFIG, harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_FOR_MAC
}