Text wrapping bugfixes

This commit is contained in:
Henrik Rydgård
2024-05-25 09:14:03 +02:00
parent e552ba0b1e
commit 5d8560e379
4 changed files with 12 additions and 6 deletions
+5 -2
View File
@@ -463,12 +463,15 @@ float AtlasWordWrapper::MeasureWidth(std::string_view str) {
uint32_t c = utf.next();
if (c == '&') {
// Skip ampersand prefixes ("&&" is an ampersand.)
if (utf.end()) {
break;
}
c = utf.next();
}
const AtlasChar *ch = atlasfont_.getChar(c);
if (!ch)
if (!ch) {
ch = atlasfont_.getChar('?');
}
w += ch->wx * scale_;
}
return w;