mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 03:12:56 +00:00
advance counter in case glyph cannot be rendered in QPainterPath::addText()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c782725682
commit
f0d1db9188
1 changed files with 2 additions and 7 deletions
|
@ -1100,11 +1100,10 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
|
||||||
for (int i = 0; i < text.size(); i++) {
|
for (int i = 0; i < text.size(); i++) {
|
||||||
QChar textchar = text.at(i);
|
QChar textchar = text.at(i);
|
||||||
uint ucs4 = textchar.unicode();
|
uint ucs4 = textchar.unicode();
|
||||||
bool issurogate = false;
|
|
||||||
if (textchar.isHighSurrogate() && (i + 1) < text.size() && text.at(i + 1).isLowSurrogate()) {
|
if (textchar.isHighSurrogate() && (i + 1) < text.size() && text.at(i + 1).isLowSurrogate()) {
|
||||||
issurogate = true;
|
|
||||||
ucs4 = QChar::surrogateToUcs4(ucs4, text.at(i + 1).unicode());
|
ucs4 = QChar::surrogateToUcs4(ucs4, text.at(i + 1).unicode());
|
||||||
textchar = QChar(ucs4);
|
textchar = QChar(ucs4);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QUnicodeTables::Script script = QUnicodeTables::script(ucs4);
|
const QUnicodeTables::Script script = QUnicodeTables::script(ucs4);
|
||||||
|
@ -1120,16 +1119,12 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
|
||||||
}
|
}
|
||||||
|
|
||||||
int nglyphs = 1;
|
int nglyphs = 1;
|
||||||
QGlyphLayoutArray<2> glyphs;
|
QGlyphLayoutArray<1> glyphs;
|
||||||
engine->stringToCMap(&textchar, nglyphs, &glyphs, &nglyphs, shaperflags);
|
engine->stringToCMap(&textchar, nglyphs, &glyphs, &nglyphs, shaperflags);
|
||||||
engine->addOutlineToPath(point.x() + xoffset, point.y() + yoffset, glyphs, this);
|
engine->addOutlineToPath(point.x() + xoffset, point.y() + yoffset, glyphs, this);
|
||||||
|
|
||||||
xoffset += glyphs.advances_x[0].toReal();
|
xoffset += glyphs.advances_x[0].toReal();
|
||||||
yoffset += glyphs.advances_y[0].toReal();
|
yoffset += glyphs.advances_y[0].toReal();
|
||||||
|
|
||||||
if (issurogate) {
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QFontEngine* engine = f.d->engineForScript(QUnicodeTables::Common);
|
QFontEngine* engine = f.d->engineForScript(QUnicodeTables::Common);
|
||||||
|
|
Loading…
Add table
Reference in a new issue