mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): handle max lines and line height in CSimpleFontString::GetDisplayText
This commit is contained in:
parent
9c6e52fcc3
commit
0a74642732
@ -142,14 +142,18 @@ const char* CSimpleFontString::GetDisplayText(float width, float height) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!this->m_font || width <= 0.0f || /* TODO */ height <= 0.0f) {
|
||||
if (!this->m_font || width <= 0.0f || (this->m_maxLines == 0 && height <= 0.0)) {
|
||||
return this->m_text;
|
||||
}
|
||||
|
||||
auto fontHeight = this->GetFontHeight(true);
|
||||
auto v5 = (CSimpleTop::RoundToPixelHeight(this->m_spacing) + fontHeight) * this->m_layoutScale;
|
||||
auto lineHeight = (CSimpleTop::RoundToPixelHeight(this->m_spacing) + fontHeight) * this->m_layoutScale;
|
||||
|
||||
// TODO
|
||||
if (this->m_maxLines != 0) {
|
||||
height = lineHeight * this->m_maxLines;
|
||||
} else if (lineHeight >= height) {
|
||||
height = lineHeight;
|
||||
}
|
||||
|
||||
auto text = this->m_text;
|
||||
auto textLen = SStrLen(text);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user