Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QWindowsFontEngineDirectWrite Class Reference

Windows font engine using Direct Write. More...

#include <qwindowsfontenginedirectwrite_p.h>

+ Inheritance diagram for QWindowsFontEngineDirectWrite:
+ Collaboration diagram for QWindowsFontEngineDirectWrite:

Public Member Functions

 QWindowsFontEngineDirectWrite (IDWriteFontFace *directWriteFontFace, qreal pixelSize, const QSharedPointer< QWindowsFontEngineData > &d)
 
 ~QWindowsFontEngineDirectWrite () override
 
void initFontInfo (const QFontDef &request, int dpi)
 
QFixed lineThickness () const override
 
QFixed underlinePosition () const override
 
bool getSfntTableData (uint tag, uchar *buffer, uint *length) const override
 Returns true if the font table idetified by tag exists in the font; returns false otherwise.
 
QFixed emSquareSize () const override
 
glyph_t glyphIndex (uint ucs4) const override
 
int stringToCMap (const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override
 
void recalcAdvances (QGlyphLayout *glyphs, ShaperFlags) const override
 
void addGlyphsToPath (glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags) override
 
glyph_metrics_t boundingBox (const QGlyphLayout &glyphs) override
 
glyph_metrics_t boundingBox (glyph_t g) override
 
glyph_metrics_t alphaMapBoundingBox (glyph_t glyph, const QFixedPoint &, const QTransform &matrix, GlyphFormat) override
 
QFixed capHeight () const override
 
QFixed xHeight () const override
 
qreal maxCharWidth () const override
 
FaceId faceId () const override
 
bool supportsHorizontalSubPixelPositions () const override
 
HFONT createHFONT () const
 
QImage alphaMapForGlyph (glyph_t glyph, const QFixedPoint &subPixelPosition) override
 
QImage alphaMapForGlyph (glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &t) override
 
QImage alphaRGBMapForGlyph (glyph_t t, const QFixedPoint &subPixelPosition, const QTransform &xform) override
 
QImage bitmapForGlyph (glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color) override
 
QFontEnginecloneWithSize (qreal pixelSize) const override
 
Qt::HANDLE handle () const override
 
const QSharedPointer< QWindowsFontEngineData > & fontEngineData () const
 
IDWriteFontFace * directWriteFontFace () const
 
void setUniqueFamilyName (const QString &newName)
 
void initializeHeightMetrics () const override
 
Properties properties () const override
 
void getUnscaledGlyph (glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override
 
- Public Member Functions inherited from QFontEngine
virtual ~QFontEngine ()
 
Type type () const
 
QByteArray getSfntTable (uint tag) const
 
virtual int synthesized () const
 
bool supportsSubPixelPositions () const
 
virtual bool supportsVerticalSubPixelPositions () const
 
virtual QFixedPoint subPixelPositionFor (const QFixedPoint &position) const
 
QFixed subPixelPositionForX (QFixed x) const
 
bool isColorFont () const
 
virtual void doKerning (QGlyphLayout *, ShaperFlags) 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 QFixed averageCharWidth () 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 bool canRender (const QChar *str, int len) const
 
virtual bool supportsTransformation (const QTransform &transform) const
 
virtual int glyphCount () const
 
virtual int glyphMargin (GlyphFormat format)
 
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 bool expectsGammaCorrectedBlending () const
 
virtual void setDefaultHintStyle (HintStyle)
 
void loadKerningPairs (QFixed scalingFactor)
 

Static Public Member Functions

static QString fontNameSubstitute (const QString &familyName)
 
- Static Public Member Functions inherited from QFontEngine
static bool isIgnorableChar (char32_t ucs4)
 
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)
 

Additional Inherited Members

- 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 , FullStringFallback = 0x008 }
 
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 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
 
- Protected Member Functions inherited from QFontEngine
 QFontEngine (Type type)
 
QFixed firstLeftBearing (const QGlyphLayout &glyphs)
 
QFixed lastRightBearing (const QGlyphLayout &glyphs)
 
QFixed calculatedCapHeight () const
 
bool processHheaTable () const
 
bool processOS2Table () const
 
- Protected Attributes inherited from QFontEngine
QFixed m_ascent
 
QFixed m_descent
 
QFixed m_leading
 
bool m_heightMetricsQueried
 

Detailed Description

Windows font engine using Direct Write.

Font engine for subpixel positioned text on Windows Vista (with platform update) and later. If selected during configuration, the engine will be selected only when the hinting preference of a font is set to None or Vertical hinting, or when fontengine=directwrite is selected as platform option.

Definition at line 39 of file qwindowsfontenginedirectwrite_p.h.

Constructor & Destructor Documentation

◆ QWindowsFontEngineDirectWrite()

QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite ( IDWriteFontFace * directWriteFontFace,
qreal pixelSize,
const QSharedPointer< QWindowsFontEngineData > & d )
explicit

Definition at line 201 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::cache_cost, QFontEngine::fontDef, QFontDef::pixelSize, Q_ASSERT, qCDebug, and QFixed::toInt().

Referenced by cloneWithSize().

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

◆ ~QWindowsFontEngineDirectWrite()

QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite ( )
override

Definition at line 225 of file qwindowsfontenginedirectwrite.cpp.

References QString::isEmpty(), QGuiApplicationPrivate::platformIntegration(), and qCDebug.

+ Here is the call graph for this function:

Member Function Documentation

◆ addGlyphsToPath()

void QWindowsFontEngineDirectWrite::addGlyphsToPath ( glyph_t * glyphs,
QFixedPoint * positions,
int nglyphs,
QPainterPath * path,
QTextItem::RenderFlags flags )
overridevirtual

Reimplemented from QFontEngine.

Definition at line 566 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::fontDef, i, QFontDef::pixelSize, positions, Q_UNUSED, and qErrnoWarning().

+ Here is the call graph for this function:

◆ alphaMapBoundingBox()

glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox ( glyph_t glyph,
const QFixedPoint & ,
const QTransform & matrix,
GlyphFormat  )
overridevirtual

Reimplemented from QFontEngine.

◆ alphaMapForGlyph() [1/2]

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

Reimplemented from QFontEngine.

Definition at line 678 of file qwindowsfontenginedirectwrite.cpp.

References alphaMapForGlyph().

Referenced by alphaMapForGlyph().

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

◆ alphaMapForGlyph() [2/2]

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

Reimplemented from QFontEngine.

Definition at line 657 of file qwindowsfontenginedirectwrite.cpp.

References QImage::constScanLine(), QFontEngine::Format_A8, QImage::Format_Alpha8, QFontEngine::glyphMargin(), QImage::height(), QWindowsFontEngineData::pow_gamma, qGray(), and QImage::width().

+ Here is the call graph for this function:

◆ alphaRGBMapForGlyph()

QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph ( glyph_t t,
const QFixedPoint & subPixelPosition,
const QTransform & xform )
overridevirtual

Reimplemented from QFontEngine.

Definition at line 1003 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::Format_A32, QImage::Format_RGB32, QFontEngine::glyphMargin(), and xform.

+ Here is the call graph for this function:

◆ bitmapForGlyph()

QImage QWindowsFontEngineDirectWrite::bitmapForGlyph ( glyph_t ,
const QFixedPoint & subPixelPosition,
const QTransform & t,
const QColor & color )
overridevirtual

Reimplemented from QFontEngine.

◆ boundingBox() [1/2]

glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox ( const QGlyphLayout & glyphs)
overridevirtual

Reimplemented from QFontEngine.

Definition at line 597 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::ascent(), QFontEngine::descent(), QGlyphLayout::effectiveAdvance(), QFontEngine::firstLeftBearing(), i, QFontEngine::lastRightBearing(), and QGlyphLayout::numGlyphs.

+ Here is the call graph for this function:

◆ boundingBox() [2/2]

glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox ( glyph_t g)
overridevirtual

Implements QFontEngine.

Definition at line 610 of file qwindowsfontenginedirectwrite.cpp.

References DESIGN_TO_LOGICAL, glyphIndex(), and qErrnoWarning().

+ Here is the call graph for this function:

◆ capHeight()

QFixed QWindowsFontEngineDirectWrite::capHeight ( ) const
overridevirtual

Implements QFontEngine.

Definition at line 639 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::calculatedCapHeight().

+ Here is the call graph for this function:

◆ cloneWithSize()

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

Reimplemented from QFontEngine.

Definition at line 1017 of file qwindowsfontenginedirectwrite.cpp.

References QWindowsFontEngineDirectWrite(), QFontEngine::fontDef, QString::isEmpty(), QFontDef::pixelSize, QGuiApplicationPrivate::platformIntegration(), and setUniqueFamilyName().

+ Here is the call graph for this function:

◆ createHFONT()

HFONT QWindowsFontEngineDirectWrite::createHFONT ( ) const

Definition at line 317 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::fontDef, QFontDef::pixelSize, and qRound().

+ Here is the call graph for this function:

◆ directWriteFontFace()

IDWriteFontFace * QWindowsFontEngineDirectWrite::directWriteFontFace ( ) const
inline

Definition at line 96 of file qwindowsfontenginedirectwrite_p.h.

◆ emSquareSize()

QFixed QWindowsFontEngineDirectWrite::emSquareSize ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 417 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::emSquareSize().

+ Here is the call graph for this function:

◆ faceId()

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

Reimplemented from QFontEngine.

Definition at line 477 of file qwindowsfontenginedirectwrite.cpp.

◆ fontEngineData()

const QSharedPointer< QWindowsFontEngineData > & QWindowsFontEngineDirectWrite::fontEngineData ( ) const
inline

Definition at line 92 of file qwindowsfontenginedirectwrite_p.h.

◆ fontNameSubstitute()

QString QWindowsFontEngineDirectWrite::fontNameSubstitute ( const QString & familyName)
static

Definition at line 1071 of file qwindowsfontenginedirectwrite.cpp.

References QString::isEmpty(), and QWinRegistryKey::stringValue().

Referenced by QWindowsFontDatabase::createEngine().

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

◆ getSfntTableData()

bool QWindowsFontEngineDirectWrite::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 390 of file qwindowsfontenginedirectwrite.cpp.

References Q_ASSERT, qErrnoWarning(), ret, and tag.

+ Here is the call graph for this function:

◆ getUnscaledGlyph()

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

Reimplemented from QFontEngine.

Definition at line 519 of file qwindowsfontenginedirectwrite.cpp.

References qErrnoWarning().

+ Here is the call graph for this function:

◆ glyphIndex()

glyph_t QWindowsFontEngineDirectWrite::glyphIndex ( uint ucs4) const
overridevirtual

Implements QFontEngine.

Definition at line 425 of file qwindowsfontenginedirectwrite.cpp.

References glyphIndex(), and qErrnoWarning().

Referenced by boundingBox(), and glyphIndex().

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

◆ handle()

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

Reimplemented from QFontEngine.

Definition at line 1034 of file qwindowsfontenginedirectwrite.cpp.

◆ initFontInfo()

void QWindowsFontEngineDirectWrite::initFontInfo ( const QFontDef & request,
int dpi )

Definition at line 1039 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::fontDef, QFontEngine::Format_ARGB, QFontEngine::glyphFormat, QFontDef::pixelSize, QFontDef::pointSize, qRound(), request, QFontDef::styleName, and QFontEngine::FaceId::variableAxes.

+ Here is the call graph for this function:

◆ initializeHeightMetrics()

void QWindowsFontEngineDirectWrite::initializeHeightMetrics ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 333 of file qwindowsfontenginedirectwrite.cpp.

References DESIGN_TO_LOGICAL, QFontEngine::initializeHeightMetrics(), QFontEngine::m_ascent, QFontEngine::m_descent, and QFontEngine::m_leading.

+ Here is the call graph for this function:

◆ lineThickness()

QFixed QWindowsFontEngineDirectWrite::lineThickness ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 382 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::lineThickness().

+ Here is the call graph for this function:

◆ maxCharWidth()

qreal QWindowsFontEngineDirectWrite::maxCharWidth ( ) const
overridevirtual

Implements QFontEngine.

Definition at line 652 of file qwindowsfontenginedirectwrite.cpp.

References QFixed::toReal().

+ Here is the call graph for this function:

◆ properties()

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

Reimplemented from QFontEngine.

Definition at line 692 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::properties().

+ Here is the call graph for this function:

◆ recalcAdvances()

void QWindowsFontEngineDirectWrite::recalcAdvances ( QGlyphLayout * glyphs,
ShaperFlags  ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 482 of file qwindowsfontenginedirectwrite.cpp.

References QGlyphLayout::advances, QFont::AnyStretch, DESIGN_TO_LOGICAL, QFontEngine::DesignMetrics, QFontEngine::fontDef, QGlyphLayout::glyphs, i, QGlyphLayout::numGlyphs, QFontDef::pixelSize, qErrnoWarning(), and QFontDef::stretch.

Referenced by stringToCMap().

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

◆ setUniqueFamilyName()

void QWindowsFontEngineDirectWrite::setUniqueFamilyName ( const QString & newName)
inline

Definition at line 98 of file qwindowsfontenginedirectwrite_p.h.

Referenced by cloneWithSize().

+ Here is the caller graph for this function:

◆ stringToCMap()

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

Implements QFontEngine.

Definition at line 438 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::GlyphIndicesOnly, QGlyphLayout::glyphs, i, QFontEngine::isIgnorableChar(), it, QGlyphLayout::numGlyphs, Q_ASSERT, qErrnoWarning(), recalcAdvances(), and str.

+ Here is the call graph for this function:

◆ supportsHorizontalSubPixelPositions()

bool QWindowsFontEngineDirectWrite::supportsHorizontalSubPixelPositions ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 684 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::fontDef.

◆ underlinePosition()

QFixed QWindowsFontEngineDirectWrite::underlinePosition ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 374 of file qwindowsfontenginedirectwrite.cpp.

References QFontEngine::underlinePosition().

+ Here is the call graph for this function:

◆ xHeight()

QFixed QWindowsFontEngineDirectWrite::xHeight ( ) const
overridevirtual

Reimplemented from QFontEngine.

Definition at line 647 of file qwindowsfontenginedirectwrite.cpp.


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