UI: Measure text with & in it properly.

This commit is contained in:
Unknown W. Brackets 2016-08-14 14:56:09 -07:00
parent 53cc4524b1
commit da7a42a957

View File

@ -349,7 +349,12 @@ protected:
float AtlasWordWrapper::MeasureWidth(const char *str, size_t bytes) {
float w = 0.0f;
for (UTF8 utf(str); utf.byteIndex() < (int)bytes; ) {
const AtlasChar *ch = atlasfont_.getChar(utf.next());
uint32_t c = utf.next();
if (c == '&') {
// Skip ampersand prefixes ("&&" is an ampersand.)
c = utf.next();
}
const AtlasChar *ch = atlasfont_.getChar(c);
if (!ch)
ch = atlasfont_.getChar('?');