M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 13,6 13,7 @@
* Fixed problem with long Relaxation loading when titles were too long
* Fixed backlight behavior after returning to the main window
* Fixed settings frontlight intensity in on demand mode
+* Fixed problem that UI could be occasionally broken
### Added
M module-gui/gui/core/RawFont.cpp => module-gui/gui/core/RawFont.cpp +5 -5
@@ 114,17 114,17 @@ namespace gui
std::uint32_t RawFont::getCharCountInSpace(const UTF8 &str, const std::uint32_t space) const
{
std::uint32_t availableSpace = space;
+ std::uint32_t textSpace = 0;
std::uint32_t count = 0;
std::uint32_t current = 0;
std::uint32_t previous = none_char_id;
for (std::uint32_t i = 0; i < str.length(); ++i, ++count) {
- current = str[i];
- const auto char_pixel_width = getCharPixelWidth(current, previous);
- if (availableSpace < char_pixel_width) {
- return count;
+ current = str[i];
+ textSpace += getCharPixelWidth(current, previous);
+ if (availableSpace < textSpace) {
+ return count - 1;
}
- availableSpace -= char_pixel_width;
previous = current;
}
return count;