QtBase  v6.3.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QCoreTextFontEngine Class Reference

#include <qfontengine_coretext_p.h>

Inheritance diagram for QCoreTextFontEngine:
Inheritance graph
[legend]
Collaboration diagram for QCoreTextFontEngine:
Collaboration graph
[legend]

Public Types

enum  FontSmoothing { Disabled , Subpixel , Grayscale }
 
- Public Types inherited from QFontEngine
enum  Type {
  Box , Multi , Win , Mac ,
  Freetype , QPF1 , QPF2 , Proxy ,
  DirectWrite , TestFontEngine = 0x1000
}
 
enum  GlyphFormat {
  Format_None , Format_Render = Format_None , Format_Mono , Format_A8 ,
  Format_A32 , Format_ARGB
}
 
enum  ShaperFlag { DesignMetrics = 0x0002 , GlyphIndicesOnly = 0x0004 }
 
enum  SynthesizedFlags { SynthesizedItalic = 0x1 , SynthesizedBold = 0x2 , SynthesizedStretch = 0x4 }
 
enum  HintStyle { HintNone , HintLight , HintMedium , HintFull }
 
enum  SubpixelAntialiasingType {
  Subpixel_None , Subpixel_RGB , Subpixel_BGR , Subpixel_VRGB ,
  Subpixel_VBGR
}
 

Public Member Functions

 QCoreTextFontEngine (CTFontRef font, const QFontDef &def)
 
 QCoreTextFontEngine (CGFontRef font, const QFontDef &def)
 
 ~QCoreTextFontEngine ()
 
glyph_t glyphIndex (uint ucs4) const override
 
bool stringToCMap (const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override
 
void recalcAdvances (QGlyphLayout *, ShaperFlags) const override
 
glyph_metrics_t boundingBox (const QGlyphLayout &glyphs) override
 
glyph_metrics_t boundingBox (glyph_t glyph) override
 
QFixed capHeight () const override
 
QFixed xHeight () const override
 
qreal maxCharWidth () const override
 
QFixed averageCharWidth () const override
 
void addGlyphsToPath (glyph_t *glyphs, QFixedPoint *positions, int numGlyphs, QPainterPath *path, QTextItem::RenderFlags) override
 
bool canRender (const QChar *string, int len) const override
 
int synthesized () const override
 
bool supportsHorizontalSubPixelPositions () const override
 
bool supportsVerticalSubPixelPositions () const override
 
QFixed lineThickness () const override
 
QFixed underlinePosition () const override
 
void draw (CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight)
 
FaceId faceId () const override
 
bool getSfntTableData (uint, uchar *, uint *) const override
 
void getUnscaledGlyph (glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override
 
QImage alphaMapForGlyph (glyph_t, const QFixedPoint &subPixelPosition) override
 
QImage alphaMapForGlyph (glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &t) override
 
QImage alphaRGBMapForGlyph (glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t) override
 
glyph_metrics_t alphaMapBoundingBox (glyph_t glyph, const QFixedPoint &, const QTransform &matrix, GlyphFormat) override
 
QImage bitmapForGlyph (glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color) override
 
QFixed emSquareSize () const override
 
void doKerning (QGlyphLayout *g, ShaperFlags flags) const override
 
bool supportsTransformation (const QTransform &transform) const override
 
bool expectsGammaCorrectedBlending () const override
 
QFontEnginecloneWithSize (qreal pixelSize) const override
 
Qt::HANDLE handle () const override
 
int glyphMargin (QFontEngine::GlyphFormat format) override
 
QFontEngine::Properties properties () const override
 
 Q_ENUM (FontSmoothing)
 
- Public Member Functions inherited from QFontEngine
virtual ~QFontEngine ()
 
Type type () const
 
QByteArray getSfntTable (uint tag) const
 
bool supportsSubPixelPositions () const
 
virtual QFixedPoint subPixelPositionFor (const QFixedPoint &position) const
 
QFixed subPixelPositionForX (const QFixed &x) const
 
void getGlyphPositions (const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
 
virtual void addOutlineToPath (qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags)
 
void addBitmapFontToPath (qreal x, qreal y, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags)
 
virtual QImage alphaMapForGlyph (glyph_t)
 
virtual QImage alphaMapForGlyph (glyph_t, const QTransform &t)
 
virtual GlyphglyphData (glyph_t glyph, const QFixedPoint &subPixelPosition, GlyphFormat neededFormat, const QTransform &t)
 
virtual bool hasInternalCaching () const
 
virtual void removeGlyphFromCache (glyph_t)
 
virtual glyph_metrics_t boundingBox (glyph_t glyph, const QTransform &matrix)
 
glyph_metrics_t tightBoundingBox (const QGlyphLayout &glyphs)
 
virtual QFixed ascent () const
 
virtual QFixed descent () const
 
virtual QFixed leading () const
 
virtual qreal minLeftBearing () const
 
virtual qreal minRightBearing () const
 
virtual void getGlyphBearings (glyph_t glyph, qreal *leftBearing=nullptr, qreal *rightBearing=nullptr)
 
bool canRender (uint ucs4) const
 
virtual int glyphCount () const
 
voidharfbuzzFont () const
 
voidharfbuzzFace () const
 
bool supportsScript (QChar::Script script) const
 
virtual int getPointInOutline (glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
 
void clearGlyphCache (const void *key)
 
void setGlyphCache (const void *key, QFontEngineGlyphCache *data)
 
QFontEngineGlyphCacheglyphCache (const void *key, GlyphFormat format, const QTransform &transform, const QColor &color=QColor()) const
 
virtual bool hasUnreliableGlyphOutline () const
 
virtual void setDefaultHintStyle (HintStyle)
 
void loadKerningPairs (QFixed scalingFactor)
 

Static Public Member Functions

static FontSmoothing fontSmoothing ()
 
static qreal fontSmoothingGamma ()
 
static bool ct_getSfntTable (void *user_data, uint tag, uchar *buffer, uint *length)
 
static QFont::Weight qtWeightFromCFWeight (float value)
 
static QCoreTextFontEnginecreate (const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
 
- Static Public Member Functions inherited from QFontEngine
static bool scriptRequiresOpenType (QChar::Script script)
 
static const uchargetCMap (const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize)
 
static quint32 getTrueTypeGlyphIndex (const uchar *cmap, int cmapSize, uint unicode)
 
static QByteArray convertToPostscriptFontFamilyName (const QByteArray &fontFamily)
 

Protected Member Functions

 QCoreTextFontEngine (const QFontDef &def)
 
void init ()
 
QImage imageForGlyph (glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &m, const QColor &color=QColor())
 
void loadAdvancesForGlyphs (QVarLengthArray< CGGlyph > &cgGlyphs, QGlyphLayout *glyphs) const
 
bool hasColorGlyphs () const
 
bool shouldAntialias () const
 
bool shouldSmoothFont () const
 
void initializeHeightMetrics () const override
 
- Protected Member Functions inherited from QFontEngine
 QFontEngine (Type type)
 
QFixed lastRightBearing (const QGlyphLayout &glyphs)
 
QFixed calculatedCapHeight () const
 
bool processHheaTable () const
 
bool processOS2Table () const
 

Protected Attributes

QCFType< CTFontRef > ctfont
 
QCFType< CGFontRef > cgFont
 
int synthesisFlags
 
CGAffineTransform transform
 
QFixed avgCharWidth
 
QFixed underlineThickness
 
QFixed underlinePos
 
QFontEngine::FaceId face_id
 
bool kerningPairsLoaded
 
- Protected Attributes inherited from QFontEngine
QFixed m_ascent
 
QFixed m_descent
 
QFixed m_leading
 
bool m_heightMetricsQueried
 

Additional Inherited Members

- Public Attributes inherited from QFontEngine
QAtomicInt ref
 
QFontDef fontDef
 
Holder font_
 
Holder face_
 
struct QFontEngine::FaceData faceData
 
uint cache_cost
 
uint fsType: 16
 
bool symbol
 
bool isSmoothlyScalable
 
QList< KernPairkerning_pairs
 
GlyphFormat glyphFormat
 
int m_subPixelPositionCount
 

Detailed Description

Definition at line 67 of file qfontengine_coretext_p.h.

Member Enumeration Documentation

◆ FontSmoothing

Enumerator
Disabled 
Subpixel 
Grayscale 

Definition at line 122 of file qfontengine_coretext_p.h.

Constructor & Destructor Documentation

◆ QCoreTextFontEngine() [1/3]

QCoreTextFontEngine::QCoreTextFontEngine ( CTFontRef  font,
const QFontDef def 
)

Definition at line 190 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ QCoreTextFontEngine() [2/3]

QCoreTextFontEngine::QCoreTextFontEngine ( CGFontRef  font,
const QFontDef def 
)

Definition at line 198 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ ~QCoreTextFontEngine()

QCoreTextFontEngine::~QCoreTextFontEngine ( )

Definition at line 213 of file qfontengine_coretext.mm.

◆ QCoreTextFontEngine() [3/3]

QCoreTextFontEngine::QCoreTextFontEngine ( const QFontDef def)
protected

Definition at line 206 of file qfontengine_coretext.mm.

Here is the call graph for this function:

Member Function Documentation

◆ addGlyphsToPath()

void QCoreTextFontEngine::addGlyphsToPath ( glyph_t glyphs,
QFixedPoint positions,
int  numGlyphs,
QPainterPath path,
QTextItem::RenderFlags   
)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 504 of file qfontengine_coretext.mm.

◆ alphaMapBoundingBox()

glyph_metrics_t QCoreTextFontEngine::alphaMapBoundingBox ( glyph_t  glyph,
const QFixedPoint subPixelPosition,
const QTransform matrix,
GlyphFormat  format 
)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 536 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ alphaMapForGlyph() [1/2]

QImage QCoreTextFontEngine::alphaMapForGlyph ( glyph_t  glyph,
const QFixedPoint subPixelPosition,
const QTransform t 
)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 828 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ alphaMapForGlyph() [2/2]

QImage QCoreTextFontEngine::alphaMapForGlyph ( glyph_t  glyph,
const QFixedPoint subPixelPosition 
)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 823 of file qfontengine_coretext.mm.

◆ alphaRGBMapForGlyph()

QImage QCoreTextFontEngine::alphaRGBMapForGlyph ( glyph_t  glyph,
const QFixedPoint subPixelPosition,
const QTransform t 
)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 850 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ averageCharWidth()

QFixed QCoreTextFontEngine::averageCharWidth ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 391 of file qfontengine_coretext.mm.

◆ bitmapForGlyph()

QImage QCoreTextFontEngine::bitmapForGlyph ( glyph_t  glyph,
const QFixedPoint subPixelPosition,
const QTransform t,
const QColor color 
)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 858 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ boundingBox() [1/2]

glyph_metrics_t QCoreTextFontEngine::boundingBox ( const QGlyphLayout glyphs)
overridevirtual

Implements QFontEngine.

Definition at line 340 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ boundingBox() [2/2]

glyph_metrics_t QCoreTextFontEngine::boundingBox ( glyph_t  glyph)
overridevirtual

Implements QFontEngine.

Definition at line 348 of file qfontengine_coretext.mm.

◆ canRender()

bool QCoreTextFontEngine::canRender ( const QChar string,
int  len 
) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 896 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ capHeight()

QFixed QCoreTextFontEngine::capHeight ( ) const
overridevirtual

Implements QFontEngine.

Definition at line 377 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ cloneWithSize()

QFontEngine * QCoreTextFontEngine::cloneWithSize ( qreal  pixelSize) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 934 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ create()

QCoreTextFontEngine * QCoreTextFontEngine::create ( const QByteArray fontData,
qreal  pixelSize,
QFont::HintingPreference  hintingPreference 
)
static

Definition at line 164 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ ct_getSfntTable()

bool QCoreTextFontEngine::ct_getSfntTable ( void user_data,
uint  tag,
uchar buffer,
uint length 
)
static

Definition at line 91 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doKerning()

void QCoreTextFontEngine::doKerning ( QGlyphLayout g,
ShaperFlags  flags 
) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 999 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ draw()

void QCoreTextFontEngine::draw ( CGContextRef  ctx,
qreal  x,
qreal  y,
const QTextItemInt ti,
int  paintDeviceHeight 
)

Definition at line 409 of file qfontengine_coretext.mm.

◆ emSquareSize()

QFixed QCoreTextFontEngine::emSquareSize ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 929 of file qfontengine_coretext.mm.

Here is the caller graph for this function:

◆ expectsGammaCorrectedBlending()

bool QCoreTextFontEngine::expectsGammaCorrectedBlending ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 708 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ faceId()

QFontEngine::FaceId QCoreTextFontEngine::faceId ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 891 of file qfontengine_coretext.mm.

◆ fontSmoothing()

QCoreTextFontEngine::FontSmoothing QCoreTextFontEngine::fontSmoothing ( )
static

Definition at line 629 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fontSmoothingGamma()

qreal QCoreTextFontEngine::fontSmoothingGamma ( )
static

Definition at line 713 of file qfontengine_coretext.mm.

◆ getSfntTableData()

bool QCoreTextFontEngine::getSfntTableData ( uint  tag,
uchar buffer,
uint length 
) const
overridevirtual

Returns true if the font table idetified by tag exists in the font; returns false otherwise.

If buffer is \nullptr, stores the size of the buffer required for the font table data, in bytes, in length. If buffer is not \nullptr and the capacity of the buffer, passed in length, is sufficient to store the font table data, also copies the font table data to buffer.

Note: returning false when the font table exists could lead to an undefined behavior.

Reimplemented from QFontEngine.

Definition at line 902 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ getUnscaledGlyph()

void QCoreTextFontEngine::getUnscaledGlyph ( glyph_t  glyph,
QPainterPath path,
glyph_metrics_t metrics 
)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 907 of file qfontengine_coretext.mm.

◆ glyphIndex()

glyph_t QCoreTextFontEngine::glyphIndex ( uint  ucs4) const
overridevirtual

Implements QFontEngine.

Definition at line 287 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ glyphMargin()

int QCoreTextFontEngine::glyphMargin ( QFontEngine::GlyphFormat  format)
inlineoverridevirtual

Reimplemented from QFontEngine.

Definition at line 118 of file qfontengine_coretext_p.h.

Here is the call graph for this function:

◆ handle()

Qt::HANDLE QCoreTextFontEngine::handle ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 943 of file qfontengine_coretext.mm.

◆ hasColorGlyphs()

bool QCoreTextFontEngine::hasColorGlyphs ( ) const
protected

Definition at line 404 of file qfontengine_coretext.mm.

Here is the caller graph for this function:

◆ imageForGlyph()

QImage QCoreTextFontEngine::imageForGlyph ( glyph_t  glyph,
const QFixedPoint subPixelPosition,
const QTransform m,
const QColor color = QColor() 
)
protected

Definition at line 718 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void QCoreTextFontEngine::init ( )
protected

Definition at line 217 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeHeightMetrics()

void QCoreTextFontEngine::initializeHeightMetrics ( ) const
overrideprotectedvirtual

Reimplemented from QFontEngine.

Definition at line 368 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ lineThickness()

QFixed QCoreTextFontEngine::lineThickness ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 959 of file qfontengine_coretext.mm.

◆ loadAdvancesForGlyphs()

void QCoreTextFontEngine::loadAdvancesForGlyphs ( QVarLengthArray< CGGlyph > &  cgGlyphs,
QGlyphLayout glyphs 
) const
protected

Definition at line 881 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ maxCharWidth()

qreal QCoreTextFontEngine::maxCharWidth ( ) const
overridevirtual

Implements QFontEngine.

Definition at line 396 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ properties()

QFontEngine::Properties QCoreTextFontEngine::properties ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 969 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ Q_ENUM()

QCoreTextFontEngine::Q_ENUM ( FontSmoothing  )

◆ qtWeightFromCFWeight()

QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight ( float  value)
static

Definition at line 107 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recalcAdvances()

void QCoreTextFontEngine::recalcAdvances ( QGlyphLayout ,
ShaperFlags   
) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 866 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ shouldAntialias()

bool QCoreTextFontEngine::shouldAntialias ( ) const
protected

Definition at line 686 of file qfontengine_coretext.mm.

Here is the caller graph for this function:

◆ shouldSmoothFont()

bool QCoreTextFontEngine::shouldSmoothFont ( ) const
protected

Definition at line 691 of file qfontengine_coretext.mm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stringToCMap()

bool QCoreTextFontEngine::stringToCMap ( const QChar str,
int  len,
QGlyphLayout glyphs,
int *  nglyphs,
ShaperFlags  flags 
) const
overridevirtual

Implements QFontEngine.

Definition at line 306 of file qfontengine_coretext.mm.

Here is the call graph for this function:

◆ supportsHorizontalSubPixelPositions()

bool QCoreTextFontEngine::supportsHorizontalSubPixelPositions ( ) const
inlineoverridevirtual

Reimplemented from QFontEngine.

Definition at line 94 of file qfontengine_coretext_p.h.

◆ supportsTransformation()

bool QCoreTextFontEngine::supportsTransformation ( const QTransform transform) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 948 of file qfontengine_coretext.mm.

◆ supportsVerticalSubPixelPositions()

bool QCoreTextFontEngine::supportsVerticalSubPixelPositions ( ) const
inlineoverridevirtual

Reimplemented from QFontEngine.

Definition at line 95 of file qfontengine_coretext_p.h.

◆ synthesized()

int QCoreTextFontEngine::synthesized ( ) const
inlineoverridevirtual

Reimplemented from QFontEngine.

Definition at line 93 of file qfontengine_coretext_p.h.

◆ underlinePosition()

QFixed QCoreTextFontEngine::underlinePosition ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 964 of file qfontengine_coretext.mm.

◆ xHeight()

QFixed QCoreTextFontEngine::xHeight ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 386 of file qfontengine_coretext.mm.

Here is the call graph for this function:

Member Data Documentation

◆ avgCharWidth

QFixed QCoreTextFontEngine::avgCharWidth
protected

Definition at line 147 of file qfontengine_coretext_p.h.

◆ cgFont

QCFType<CGFontRef> QCoreTextFontEngine::cgFont
protected

Definition at line 144 of file qfontengine_coretext_p.h.

◆ ctfont

QCFType<CTFontRef> QCoreTextFontEngine::ctfont
protected

Definition at line 143 of file qfontengine_coretext_p.h.

◆ face_id

QFontEngine::FaceId QCoreTextFontEngine::face_id
protected

Definition at line 150 of file qfontengine_coretext_p.h.

◆ kerningPairsLoaded

bool QCoreTextFontEngine::kerningPairsLoaded
mutableprotected

Definition at line 151 of file qfontengine_coretext_p.h.

◆ synthesisFlags

int QCoreTextFontEngine::synthesisFlags
protected

Definition at line 145 of file qfontengine_coretext_p.h.

◆ transform

CGAffineTransform QCoreTextFontEngine::transform
protected

Definition at line 146 of file qfontengine_coretext_p.h.

◆ underlinePos

QFixed QCoreTextFontEngine::underlinePos
protected

Definition at line 149 of file qfontengine_coretext_p.h.

◆ underlineThickness

QFixed QCoreTextFontEngine::underlineThickness
protected

Definition at line 148 of file qfontengine_coretext_p.h.


The documentation for this class was generated from the following files: