CoreText: Share code by using delegate constructor
Change-Id: If3d5d533f98552335517ef61cb748d0117fe3053 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
9dd2048c1a
commit
61a94d2d04
@ -190,10 +190,8 @@ QCoreTextFontEngine *QCoreTextFontEngine::create(const QByteArray &fontData, qre
|
||||
}
|
||||
|
||||
QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def)
|
||||
: QFontEngine(Mac)
|
||||
: QCoreTextFontEngine(def)
|
||||
{
|
||||
fontDef = def;
|
||||
transform = qt_transform_from_fontdef(fontDef);
|
||||
ctfont = font;
|
||||
CFRetain(ctfont);
|
||||
cgFont = CTFontCopyGraphicsFont(font, NULL);
|
||||
@ -201,10 +199,8 @@ QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def)
|
||||
}
|
||||
|
||||
QCoreTextFontEngine::QCoreTextFontEngine(CGFontRef font, const QFontDef &def)
|
||||
: QFontEngine(Mac)
|
||||
: QCoreTextFontEngine(def)
|
||||
{
|
||||
fontDef = def;
|
||||
transform = qt_transform_from_fontdef(fontDef);
|
||||
cgFont = font;
|
||||
// Keep reference count balanced
|
||||
CFRetain(cgFont);
|
||||
@ -212,6 +208,13 @@ QCoreTextFontEngine::QCoreTextFontEngine(CGFontRef font, const QFontDef &def)
|
||||
init();
|
||||
}
|
||||
|
||||
QCoreTextFontEngine::QCoreTextFontEngine(const QFontDef &def)
|
||||
: QFontEngine(Mac)
|
||||
{
|
||||
fontDef = def;
|
||||
transform = qt_transform_from_fontdef(fontDef);
|
||||
}
|
||||
|
||||
QCoreTextFontEngine::~QCoreTextFontEngine()
|
||||
{
|
||||
CFRelease(cgFont);
|
||||
|
@ -126,6 +126,7 @@ public:
|
||||
|
||||
static QCoreTextFontEngine *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
|
||||
protected:
|
||||
QCoreTextFontEngine(const QFontDef &def);
|
||||
void init();
|
||||
QImage imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool colorful, const QTransform &m);
|
||||
void loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyphs, QGlyphLayout *glyphs) const;
|
||||
|
Loading…
Reference in New Issue
Block a user