mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 03:12:56 +00:00
optimize QFontMetrics::inFontUcs4() and QFontMetricsF::inFontUcs4()
upstream commit:
09bc8e2cb8
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
cdace38489
commit
bcd73f3852
1 changed files with 16 additions and 4 deletions
|
@ -419,8 +419,14 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const
|
||||||
Q_ASSERT(engine != 0);
|
Q_ASSERT(engine != 0);
|
||||||
if (engine->type() == QFontEngine::Box)
|
if (engine->type() == QFontEngine::Box)
|
||||||
return false;
|
return false;
|
||||||
QString utf16 = QString::fromUcs4(&ucs4, 1);
|
if (QChar::requiresSurrogates(ucs4)) {
|
||||||
return engine->canRender(utf16.data(), utf16.length());
|
QChar utf16[2];
|
||||||
|
utf16[0] = QChar::highSurrogate(ucs4);
|
||||||
|
utf16[1] = QChar::lowSurrogate(ucs4);
|
||||||
|
return engine->canRender(utf16, 2);
|
||||||
|
}
|
||||||
|
QChar utf16(ucs4);
|
||||||
|
return engine->canRender(&utf16, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1285,8 +1291,14 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const
|
||||||
Q_ASSERT(engine != 0);
|
Q_ASSERT(engine != 0);
|
||||||
if (engine->type() == QFontEngine::Box)
|
if (engine->type() == QFontEngine::Box)
|
||||||
return false;
|
return false;
|
||||||
QString utf16 = QString::fromUcs4(&ucs4, 1);
|
if (QChar::requiresSurrogates(ucs4)) {
|
||||||
return engine->canRender(utf16.data(), utf16.length());
|
QChar utf16[2];
|
||||||
|
utf16[0] = QChar::highSurrogate(ucs4);
|
||||||
|
utf16[1] = QChar::lowSurrogate(ucs4);
|
||||||
|
return engine->canRender(utf16, 2);
|
||||||
|
}
|
||||||
|
QChar utf16(ucs4);
|
||||||
|
return engine->canRender(&utf16, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Add table
Reference in a new issue