mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
text: fix is_whitespace() assertion when invalid chars are included
This commit is contained in:
parent
95eee0cab2
commit
5c90f64182
@ -1626,11 +1626,12 @@ assemble_row(TextAssembler::TextRow &row,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (first_glyph != (TextGlyph *)NULL) {
|
if (first_glyph != (TextGlyph *)NULL) {
|
||||||
assert(!first_glyph->is_whitespace());
|
|
||||||
advance = first_glyph->get_advance() * advance_scale;
|
advance = first_glyph->get_advance() * advance_scale;
|
||||||
|
if (!first_glyph->is_whitespace()) {
|
||||||
swap(placement._glyph, first_glyph);
|
swap(placement._glyph, first_glyph);
|
||||||
placed_glyphs.push_back(placement);
|
placed_glyphs.push_back(placement);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if there is a second glyph to create a hacky ligature or some
|
// Check if there is a second glyph to create a hacky ligature or some
|
||||||
// such nonsense.
|
// such nonsense.
|
||||||
|
7
tests/text/test_text_assemble.py
Normal file
7
tests/text/test_text_assemble.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from panda3d import core
|
||||||
|
|
||||||
|
def test_text_assemble_null():
|
||||||
|
# Tests that no is_whitespace() assert occurs
|
||||||
|
assembler = core.TextAssembler(core.TextEncoder())
|
||||||
|
assembler.set_wtext(u"\0test")
|
||||||
|
assembler.assemble_text()
|
Loading…
x
Reference in New Issue
Block a user