QProxyFontEngine(QAbstractFontEngine *engine, const QFontDef &def);
virtual ~QProxyFontEngine();
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
+ virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
virtual QImage alphaMapForGlyph(glyph_t);
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags);
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
glyphs.glyphs = &glyph;
int numGlyphs;
QChar *chars = QString(QLatin1String("O")).data();
- fe->stringToCMap(chars, 1, &glyphs, &numGlyphs, QTextEngine::GlyphIndicesOnly);
+ fe->stringToCMap(chars, 1, &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly);
QImage im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform());
delete fe;
QVarLengthGlyphLayoutArray qglyphs(*numGlyphs);
- QTextEngine::ShaperFlags shaperFlags(QTextEngine::GlyphIndicesOnly);
+ QFontEngine::ShaperFlags shaperFlags(QFontEngine::GlyphIndicesOnly);
if (rightToLeft)
- shaperFlags |= QTextEngine::RightToLeft;
+ shaperFlags |= QFontEngine::RightToLeft;
int nGlyphs = *numGlyphs;
bool result = fe->stringToCMap(reinterpret_cast<const QChar *>(string), length, &qglyphs, &nGlyphs, shaperFlags);
for (hb_uint32 i = 0; i < numGlyphs; ++i)
qglyphs.glyphs[i] = glyphs[i];
- fe->recalcAdvances(&qglyphs, flags & HB_ShaperFlag_UseDesignMetrics ? QFlags<QTextEngine::ShaperFlag>(QTextEngine::DesignMetrics) : QFlags<QTextEngine::ShaperFlag>(0));
+ fe->recalcAdvances(&qglyphs, (flags & HB_ShaperFlag_UseDesignMetrics) ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
for (hb_uint32 i = 0; i < numGlyphs; ++i)
advances[i] = qglyphs.advances_x[i].value();
QGlyphLayoutArray<8> glyphs;
int nglyphs = 7;
QChar x((ushort)'x');
- stringToCMap(&x, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
+ stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly);
glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]);
return bb.height;
QGlyphLayoutArray<8> glyphs;
int nglyphs = 7;
QChar x((ushort)'x');
- stringToCMap(&x, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
+ stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly);
glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]);
return bb.xoff;
return 0;
}
-void QFontEngine::doKerning(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
+void QFontEngine::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
int numPairs = kerning_pairs.size();
if(!numPairs)
const KernPair *pairs = kerning_pairs.constData();
- if(flags & QTextEngine::DesignMetrics) {
+ if (flags & DesignMetrics) {
for(int i = 0; i < glyphs->numGlyphs - 1; ++i)
glyphs->advances_x[i] += kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs);
} else {
{
}
-bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
+bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
{
if (*nglyphs < len) {
*nglyphs = len;
return false;
}
- for (int i = 0; i < len; i++) {
+ for (int i = 0; i < len; ++i)
glyphs->glyphs[i] = 0;
- if (!(flags & QTextEngine::GlyphIndicesOnly)) {
- glyphs->advances_x[i] = _size;
- glyphs->advances_y[i] = 0;
- }
- }
*nglyphs = len;
glyphs->numGlyphs = len;
+
+ if (!(flags & GlyphIndicesOnly))
+ recalcAdvances(glyphs, flags);
+
return true;
}
-void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const
+void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
{
for (int i = 0; i < glyphs->numGlyphs; i++) {
glyphs->advances_x[i] = _size;
bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
QGlyphLayout *glyphs, int *nglyphs,
- QTextEngine::ShaperFlags flags) const
+ QFontEngine::ShaperFlags flags) const
{
int ng = *nglyphs;
if (!engine(0)->stringToCMap(str, len, glyphs, &ng, flags))
glyphs.glyphs[i] = hi | glyphs.glyphs[i];
}
-void QFontEngineMulti::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
+void QFontEngineMulti::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
if (glyphs->numGlyphs <= 0)
return;
glyphs->glyphs[i] = hi | glyphs->glyphs[i];
}
-void QFontEngineMulti::doKerning(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
+void QFontEngineMulti::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
if (glyphs->numGlyphs <= 0)
return;
QVarLengthGlyphLayoutArray glyphs(len);
int nglyphs = len;
- if (stringToCMap(string, len, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly) == false) {
+ if (!stringToCMap(string, len, &glyphs, &nglyphs, GlyphIndicesOnly)) {
glyphs.resize(nglyphs);
- stringToCMap(string, len, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
+ stringToCMap(string, len, &glyphs, &nglyphs, GlyphIndicesOnly);
}
bool allExist = true;
if (set && set->outline_drawing)
load_flags = FT_LOAD_NO_BITMAP;
- if (default_hint_style == HintNone || (flags & HB_ShaperFlag_UseDesignMetrics) || (set && set->outline_drawing))
+ if (default_hint_style == HintNone || (flags & DesignMetrics) || (set && set->outline_drawing))
load_flags |= FT_LOAD_NO_HINTING;
else
load_flags |= load_target;
const QChar *ch = (const QChar *)(const void*)char_table;
QGlyphLayoutArray<char_table_entries> glyphs;
int ng = char_table_entries;
- stringToCMap(ch, char_table_entries, &glyphs, &ng, QTextEngine::GlyphIndicesOnly);
+ stringToCMap(ch, char_table_entries, &glyphs, &ng, GlyphIndicesOnly);
while (--ng) {
if (glyphs.glyphs[ng]) {
glyph_metrics_t gi = const_cast<QFontEngineFT *>(this)->boundingBox(glyphs.glyphs[ng]);
return underline_position;
}
-void QFontEngineFT::doKerning(QGlyphLayout *g, QTextEngine::ShaperFlags flags) const
+void QFontEngineFT::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) const
{
if (!kerning_pairs_loaded) {
kerning_pairs_loaded = true;
}
bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
- QTextEngine::ShaperFlags flags) const
+ QFontEngine::ShaperFlags flags) const
{
if (*nglyphs < len) {
*nglyphs = len;
return false;
}
- bool mirrored = flags & QTextEngine::RightToLeft;
+ bool mirrored = flags & QFontEngine::RightToLeft;
int glyph_pos = 0;
if (freetype->symbol_map) {
FT_Face face = freetype->face;
*nglyphs = glyph_pos;
glyphs->numGlyphs = glyph_pos;
- if (flags & QTextEngine::GlyphIndicesOnly)
- return true;
-
- recalcAdvances(glyphs, flags);
+ if (!(flags & GlyphIndicesOnly))
+ recalcAdvances(glyphs, flags);
return true;
}
-void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
+void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
FT_Face face = 0;
bool design = (default_hint_style == HintNone ||
default_hint_style == HintLight ||
- (flags & HB_ShaperFlag_UseDesignMetrics)) && FT_IS_SCALABLE(freetype->face);
+ (flags & DesignMetrics)) && FT_IS_SCALABLE(freetype->face);
for (int i = 0; i < glyphs->numGlyphs; i++) {
Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : 0;
// Since we are passing Format_None to loadGlyph, use same default format logic as loadGlyph
virtual QFixed lineThickness() const;
virtual QFixed underlinePosition() const;
- void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ void doKerning(QGlyphLayout *, ShaperFlags) const;
inline virtual Type type() const
{ return QFontEngine::Freetype; }
virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
QPainterPath *path, QTextItem::RenderFlags flags);
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
- QTextEngine::ShaperFlags flags) const;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
virtual glyph_metrics_t boundingBox(glyph_t glyph);
virtual glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix);
- virtual void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const;
+ virtual void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const;
virtual QImage alphaMapForGlyph(glyph_t g) { return alphaMapForGlyph(g, 0); }
virtual QImage alphaMapForGlyph(glyph_t, QFixed);
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
class QChar;
class QPainterPath;
-class QTextEngine;
struct QGlyphLayout;
#define MAKE_TAG(ch1, ch2, ch3, ch4) (\
Format_A32
};
+ enum ShaperFlag {
+ RightToLeft = 0x0001,
+ DesignMetrics = 0x0002,
+ GlyphIndicesOnly = 0x0004
+ };
+ Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag)
+
QFontEngine();
virtual ~QFontEngine();
virtual QFixed emSquareSize() const { return ascent(); }
/* returns 0 as glyph index for non existent glyphs */
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const = 0;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const = 0;
/**
* This is a callback from harfbuzz. The font engine uses the font-system in use to find out the
* advances of each glyph and set it on the layout.
*/
- virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const {}
- virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const {}
+ virtual void doKerning(QGlyphLayout *, ShaperFlags) const;
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
QPainterPath *path, QTextItem::RenderFlags flags);
mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QFontEngine::ShaperFlags)
+
inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2)
{
return (f1.index == f2.index) && (f1.encoding == f2.encoding) && (f1.filename == f2.filename);
QFontEngineBox(int size);
~QFontEngineBox();
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
+ virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
explicit QFontEngineMulti(int engineCount);
~QFontEngineMulti();
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
- QTextEngine::ShaperFlags flags) const;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
virtual glyph_metrics_t boundingBox(glyph_t glyph);
- virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
- virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
+ virtual void doKerning(QGlyphLayout *, ShaperFlags) const;
virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags);
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0);
return false;
}
-bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
+bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
{
if (*nglyphs < len) {
*nglyphs = len;
const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset);
- bool mirrored = flags & QTextEngine::RightToLeft;
+ bool mirrored = flags & QFontEngine::RightToLeft;
int glyph_pos = 0;
if (symbol) {
for (int i = 0; i < len; ++i) {
return true;
}
-void QFontEngineQPA::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const
+void QFontEngineQPA::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
{
for (int i = 0; i < glyphs->numGlyphs; ++i) {
const Glyph *g = findGlyph(glyphs->glyphs[i]);
FaceId faceId() const { return face_id; }
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
+ void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
QImage alphaMapForGlyph(glyph_t t);
return false;
}
-bool QFontEngineQPF::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
+bool QFontEngineQPF::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
{
if (!externalCMap && !cmapOffset && renderingFontEngine) {
if (!renderingFontEngine->stringToCMap(str, len, glyphs, nglyphs, flags))
const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset);
- bool mirrored = flags & QTextEngine::RightToLeft;
+ bool mirrored = flags & RightToLeft;
int glyph_pos = 0;
if (symbol) {
for (int i = 0; i < len; ++i) {
return true;
}
-void QFontEngineQPF::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const
+void QFontEngineQPF::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
{
#ifndef QT_NO_FREETYPE
const_cast<QFontEngineQPF *>(this)->ensureGlyphsLoaded(*glyphs);
freetype->unlock();
}
-void QFontEngineQPF::doKerning(QGlyphLayout *g, QTextEngine::ShaperFlags flags) const
+void QFontEngineQPF::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) const
{
if (!kerning_pairs_loaded) {
kerning_pairs_loaded = true;
FaceId faceId() const { return face_id; }
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
+ void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
#if !defined(QT_NO_FREETYPE)
FT_Face lockFace() const;
void unlockFace() const;
- void doKerning(QGlyphLayout *g, QTextEngine::ShaperFlags flags) const;
+ void doKerning(QGlyphLayout *g, ShaperFlags flags) const;
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
virtual QFixed emSquareSize() const;
#endif
for (uint uc = 0; uc < 0x10000; ++uc) {
QChar ch(uc);
int nglyphs = 10;
- fontEngine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
+ fontEngine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly);
int idx = glyph_indices.indexOf(glyphs.glyphs[0]);
if (idx >= 0 && !reverseMap.at(idx))
reverseMap[idx] = uc;
QGlyphLayout glyphs;
glyphs.glyphs = glyphIndexes;
- return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QTextEngine::GlyphIndicesOnly);
+ return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly);
}
/*!
{
int nGlyphs = item->num_glyphs;
- QTextEngine::ShaperFlags shaperFlags(QTextEngine::GlyphIndicesOnly);
+ QFontEngine::ShaperFlags shaperFlags(QFontEngine::GlyphIndicesOnly);
if (item->item.bidiLevel % 2)
- shaperFlags |= QTextEngine::RightToLeft;
+ shaperFlags |= QFontEngine::RightToLeft;
bool result = fontEngine->stringToCMap(reinterpret_cast<const QChar *>(item->string + item->item.pos), item->item.length, glyphs, &nGlyphs, shaperFlags);
item->num_glyphs = nGlyphs;
shaper_item.log_clusters[i] += glyph_pos;
if (kerningEnabled && !shaper_item.kerning_applied)
- actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFlag(QTextEngine::DesignMetrics) : QFlag(0));
+ actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
if (engineIdx != 0) {
for (hb_uint32 i = 0; i < shaper_item.num_glyphs; ++i)
WidthOnly = 0x07
};
- // keep in sync with QAbstractFontEngine::TextShapingFlag!!
- enum ShaperFlag {
- RightToLeft = 0x0001,
- DesignMetrics = 0x0002,
- GlyphIndicesOnly = 0x0004
- };
- Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag)
-
void invalidate();
void clearLineData();
const QTextLayout::FormatRange *selection;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEngine::ShaperFlags)
-
QT_END_NAMESPACE
#endif // QTEXTENGINE_P_H
static void loadAdvancesForGlyphs(CTFontRef ctfont,
QVarLengthArray<CGGlyph> &cgGlyphs,
QGlyphLayout *glyphs, int len,
- QTextEngine::ShaperFlags flags,
+ QFontEngine::ShaperFlags flags,
const QFontDef &fontDef)
{
Q_UNUSED(flags);
}
bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
- int *nglyphs, QTextEngine::ShaperFlags flags) const
+ int *nglyphs, QFontEngine::ShaperFlags flags) const
{
QCFType<CFStringRef> cfstring;
}
*nglyphs = glyph_pos;
- if (flags & QTextEngine::GlyphIndicesOnly)
+ if (flags & GlyphIndicesOnly)
return true;
QVarLengthArray<CGSize> advances(glyph_pos);
return im;
}
-void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
+void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
int i, numGlyphs = glyphs->numGlyphs;
QVarLengthArray<CGGlyph> cgGlyphs(numGlyphs);
QCoreTextFontEngine(CGFontRef font, const QFontDef &def);
~QCoreTextFontEngine();
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
+ virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
virtual glyph_metrics_t boundingBox(glyph_t glyph);
return SelectObject(m_fontEngineData->hdc, designFont);
}
-bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
+bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
{
if (*nglyphs < len) {
*nglyphs = len;
return false;
}
- *nglyphs = getGlyphIndexes(str, len, glyphs, flags & QTextEngine::RightToLeft);
+ *nglyphs = getGlyphIndexes(str, len, glyphs, flags & RightToLeft);
- if (flags & QTextEngine::GlyphIndicesOnly)
- return true;
+ if (!(flags & GlyphIndicesOnly))
+ recalcAdvances(glyphs, flags);
- recalcAdvances(glyphs, flags);
return true;
}
#endif
}
-void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
+void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
HGDIOBJ oldFont = 0;
HDC hdc = m_fontEngineData->hdc;
- if (ttf && (flags & QTextEngine::DesignMetrics)) {
+ if (ttf && (flags & DesignMetrics)) {
for(int i = 0; i < glyphs->numGlyphs; i++) {
unsigned int glyph = glyphs->glyphs[i];
if(int(glyph) >= designAdvancesSize) {
virtual int synthesized() const;
virtual QFixed emSquareSize() const;
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- virtual void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
+ virtual void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const;
virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
}
bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
- int *nglyphs, QTextEngine::ShaperFlags flags) const
+ int *nglyphs, QFontEngine::ShaperFlags flags) const
{
if (m_directWriteFontFace != 0) {
QVarLengthArray<UINT32> codePoints(len);
for (int i=0; i<len; ++i) {
codePoints[i] = getChar(str, i, len);
- if (flags & QTextEngine::RightToLeft)
+ if (flags & QFontEngine::RightToLeft)
codePoints[i] = QChar::mirroredChar(codePoints[i]);
}
*nglyphs = len;
- if (!(flags & QTextEngine::GlyphIndicesOnly))
+ if (!(flags & GlyphIndicesOnly))
recalcAdvances(glyphs, 0);
return true;
return false;
}
-void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const
+void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
{
if (m_directWriteFontFace == 0)
return;
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
QFixed emSquareSize() const;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
- void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const;
void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
QPainterPath *path, QTextItem::RenderFlags flags);