зеркало из https://github.com/mozilla/pjs.git
Bug 380153 - SetupClusterBoundaries uses unset attrs from pango_break after NUL.
p=Karl Tomlinson <mozbugz@karlt.net> r=roc
This commit is contained in:
Родитель
95cd743e81
Коммит
337f2fc2d7
|
@ -1049,27 +1049,36 @@ SetupClusterBoundaries(gfxTextRun* aTextRun, const gchar *aUTF8, PRUint32 aUTF8L
|
||||||
if (!buffer.AppendElements(aUTF8Length + 1))
|
if (!buffer.AppendElements(aUTF8Length + 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pango_break(aUTF8, aUTF8Length, aAnalysis,
|
|
||||||
buffer.Elements(), buffer.Length());
|
|
||||||
|
|
||||||
const gchar *p = aUTF8;
|
const gchar *p = aUTF8;
|
||||||
const gchar *end = aUTF8 + aUTF8Length;
|
const gchar *end = aUTF8 + aUTF8Length;
|
||||||
const PangoLogAttr *attr = buffer.Elements();
|
|
||||||
gfxTextRun::CompressedGlyph g;
|
gfxTextRun::CompressedGlyph g;
|
||||||
|
|
||||||
while (p < end) {
|
while (p < end) {
|
||||||
if (!attr->is_cursor_position) {
|
PangoLogAttr *attr = buffer.Elements();
|
||||||
aTextRun->SetCharacterGlyph(aUTF16Offset, g.SetClusterContinuation());
|
pango_break(p, end - p, aAnalysis, attr, buffer.Length());
|
||||||
}
|
|
||||||
++aUTF16Offset;
|
while (p < end) {
|
||||||
|
if (!attr->is_cursor_position) {
|
||||||
gunichar ch = g_utf8_get_char(p);
|
aTextRun->SetCharacterGlyph(aUTF16Offset, g.SetClusterContinuation());
|
||||||
NS_ASSERTION(!IS_SURROGATE(ch), "Shouldn't have surrogates in UTF8");
|
}
|
||||||
if (ch >= 0x10000) {
|
|
||||||
++aUTF16Offset;
|
++aUTF16Offset;
|
||||||
|
|
||||||
|
gunichar ch = g_utf8_get_char(p);
|
||||||
|
NS_ASSERTION(!IS_SURROGATE(ch), "Shouldn't have surrogates in UTF8");
|
||||||
|
if (ch >= 0x10000) {
|
||||||
|
++aUTF16Offset;
|
||||||
|
}
|
||||||
|
// We produced this utf8 so we don't need to worry about malformed stuff
|
||||||
|
p = g_utf8_next_char(p);
|
||||||
|
++attr;
|
||||||
|
|
||||||
|
if (ch == 0) {
|
||||||
|
// pango_break (pango 1.16.2) only analyses text before the
|
||||||
|
// first NUL (but sets one extra attr), so call pango_break
|
||||||
|
// again to analyse after the NUL.
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// We produced this utf8 so we don't need to worry about malformed stuff
|
|
||||||
p = g_utf8_next_char(p);
|
|
||||||
++attr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче