mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
reduce the allocations for glyph arrays
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
3edd93fac4
commit
4b3f715561
4 changed files with 11 additions and 11 deletions
|
@ -67,8 +67,8 @@ QFixed QFontEngine::underlinePosition() const
|
|||
|
||||
QFixed QFontEngine::xHeight() const
|
||||
{
|
||||
QGlyphLayoutArray<8> glyphs;
|
||||
int nglyphs = 7;
|
||||
QGlyphLayoutArray<2> glyphs;
|
||||
int nglyphs = 1;
|
||||
QChar x((ushort)'x');
|
||||
stringToCMap(&x, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
|
||||
|
||||
|
@ -78,8 +78,8 @@ QFixed QFontEngine::xHeight() const
|
|||
|
||||
QFixed QFontEngine::averageCharWidth() const
|
||||
{
|
||||
QGlyphLayoutArray<8> glyphs;
|
||||
int nglyphs = 7;
|
||||
QGlyphLayoutArray<2> glyphs;
|
||||
int nglyphs = 1;
|
||||
QChar x((ushort)'x');
|
||||
stringToCMap(&x, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
|
||||
|
||||
|
|
|
@ -445,8 +445,8 @@ int QFontMetrics::width(QChar ch) const
|
|||
QFontEngine *engine = d->engineForScript(script);
|
||||
Q_ASSERT(engine != 0);
|
||||
|
||||
QGlyphLayoutArray<8> glyphs;
|
||||
int nglyphs = 7;
|
||||
QGlyphLayoutArray<2> glyphs;
|
||||
int nglyphs = 1;
|
||||
engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0);
|
||||
return qRound(glyphs.advances_x[0]);
|
||||
}
|
||||
|
@ -1035,8 +1035,8 @@ qreal QFontMetricsF::width(QChar ch) const
|
|||
QFontEngine *engine = d->engineForScript(script);
|
||||
Q_ASSERT(engine != 0);
|
||||
|
||||
QGlyphLayoutArray<8> glyphs;
|
||||
int nglyphs = 7;
|
||||
QGlyphLayoutArray<2> glyphs;
|
||||
int nglyphs = 1;
|
||||
engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0);
|
||||
return glyphs.advances_x[0].toReal();
|
||||
}
|
||||
|
|
|
@ -328,10 +328,10 @@ QVector<int> QFontSubset::getReverseMap() const
|
|||
reverseMap.resize(0x10000);
|
||||
for (uint i = 0; i < 0x10000; ++i)
|
||||
reverseMap[i] = 0;
|
||||
QGlyphLayoutArray<10> glyphs;
|
||||
QGlyphLayoutArray<2> glyphs;
|
||||
for (uint uc = 0; uc < 0x10000; ++uc) {
|
||||
QChar ch(uc);
|
||||
int nglyphs = 10;
|
||||
int nglyphs = 1;
|
||||
fontEngine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
|
||||
int idx = glyph_indices.indexOf(glyphs.glyphs[0]);
|
||||
if (idx >= 0 && !reverseMap.at(idx))
|
||||
|
|
|
@ -980,7 +980,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
|
|||
|
||||
QFontEngine *fe = fnt.d->engineForScript(QUnicodeTables::Common);
|
||||
|
||||
QGlyphLayoutArray<1> ellipsisGlyph;
|
||||
QGlyphLayoutArray<2> ellipsisGlyph;
|
||||
{
|
||||
if (fe->canRender(&ellipsisChar, 1)) {
|
||||
int nGlyphs = 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue