Add a way to retrieve CTFontRef from QFont

Since macFontID restricts to quint32, we have to return that in
QFont::handle.

Task-number: QTBUG-17890
Reviewed-by: Eskil
(cherry picked from commit c8f299b7e675c839b16d750cd2633a57cdd0526f)
bb10
Jiang Jiang 2011-05-04 16:06:06 +02:00
parent 1a2345ec19
commit 05a1416be8
2 changed files with 6 additions and 3 deletions

View File

@ -43,6 +43,7 @@
#include "qfont_p.h"
#include "qfontengine_p.h"
#include "qfontengine_mac_p.h"
#include "qfontengine_coretext_p.h"
#include "qfontinfo.h"
#include "qfontmetrics.h"
#include "qpaintdevice.h"
@ -119,10 +120,10 @@ quint32 QFont::macFontID() const // ### need 64-bit version
// Returns an ATSUFonFamilyRef
Qt::HANDLE QFont::handle() const
{
#if 0
#ifdef QT_MAC_USE_COCOA
QFontEngine *fe = d->engineForScript(QUnicodeTables::Common);
if (fe && fe->type() == QFontEngine::Mac)
return (Qt::HANDLE)static_cast<QFontEngineMacMulti*>(fe)->fontFamilyRef();
if (fe && fe->type() == QFontEngine::Multi)
return (Qt::HANDLE)static_cast<QCoreTextFontEngineMulti*>(fe)->macFontID();
#endif
return 0;
}

View File

@ -124,6 +124,8 @@ public:
QScriptItem *si) const;
virtual const char *name() const { return "CoreText"; }
inline CTFontRef macFontID() const { return ctfont; }
protected:
virtual void loadEngine(int at);