Added iOS compatibility.
Put MacOS-specific code in #ifdef blocks so that it is not compiled for iOS. Add iOS implementation for MacOS-specific code, where possible. Change-Id: I3664c76fcfa8d5497ad1db676b9331e4ae0dca0e Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
parent
dcd893fbf7
commit
affbbcd738
@ -39,8 +39,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QT_NO_CORESERVICES
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <IOKit/graphics/IOGraphicsLib.h>
|
||||
#endif
|
||||
|
||||
#include "qcoretextfontdatabase_p.h"
|
||||
#include "qfontengine_coretext_p.h"
|
||||
@ -118,6 +120,7 @@ static NSInteger languageMapSort(id obj1, id obj2, void *context)
|
||||
|
||||
QCoreTextFontDatabase::QCoreTextFontDatabase()
|
||||
{
|
||||
#ifndef QT_NO_CORESERVICES
|
||||
QSettings appleSettings(QLatin1String("apple.com"));
|
||||
QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold"));
|
||||
if (appleValue.isValid())
|
||||
@ -152,6 +155,9 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
|
||||
QCoreTextFontEngine::defaultGlyphFormat = (font_smoothing > 0
|
||||
? QFontEngineGlyphCache::Raster_RGBMask
|
||||
: QFontEngineGlyphCache::Raster_A8);
|
||||
#else
|
||||
QCoreTextFontEngine::defaultGlyphFormat = QFontEngineGlyphCache::Raster_A8;
|
||||
#endif
|
||||
}
|
||||
|
||||
QCoreTextFontDatabase::~QCoreTextFontDatabase()
|
||||
@ -342,6 +348,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString family, cons
|
||||
return fallbackLists[styleHint];
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CORESERVICES
|
||||
OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref);
|
||||
QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
|
||||
{
|
||||
@ -382,6 +389,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
|
||||
|
||||
return QStringList();
|
||||
}
|
||||
#endif
|
||||
|
||||
QFont QCoreTextFontDatabase::defaultFont() const
|
||||
{
|
||||
|
@ -55,7 +55,9 @@ public:
|
||||
QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
|
||||
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
|
||||
QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const;
|
||||
#ifndef QT_NO_CORESERVICES
|
||||
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
|
||||
#endif
|
||||
void releaseHandle(void *handle);
|
||||
QFont defaultFont() const;
|
||||
QList<int> standardSizes() const;
|
||||
|
@ -413,7 +413,11 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
|
||||
QImage im(qRound(br.width)+2, qRound(br.height)+2, QImage::Format_RGB32);
|
||||
im.fill(0);
|
||||
|
||||
#ifndef QT_NO_CORESERVICES
|
||||
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
#else
|
||||
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
|
||||
#endif
|
||||
uint cgflags = kCGImageAlphaNoneSkipFirst;
|
||||
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
|
||||
cgflags |= kCGBitmapByteOrder32Host;
|
||||
|
@ -44,7 +44,13 @@
|
||||
|
||||
#include <private/qfontengine_p.h>
|
||||
#include <private/qcore_mac_p.h>
|
||||
|
||||
#ifndef QT_NO_CORESERVICES
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#else
|
||||
#include <CoreText/CoreText.h>
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
#endif
|
||||
|
||||
#if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user