fix(ui): fix CSimpleFontString to use the FixedColor flag only if the string does not contain color tags

This commit is contained in:
VDm 2025-04-08 01:58:04 +04:00
parent 665b8862fd
commit a2e1dc98a2
2 changed files with 13 additions and 5 deletions

View File

@ -348,7 +348,7 @@ int32_t CGxString::Initialize(float fontHeight, const C3Vector& position, float
face->m_strings.LinkToTail(this);
float requestedFontHeight = this->m_flags & 0x4 && !(this->m_flags & 0x80)
float requestedFontHeight = ((this->m_flags & 0x4) && !(this->m_flags & 0x80))
? GxuFontGetOneToOneHeight(face)
: fontHeight;
this->m_requestedFontHeight = requestedFontHeight;
@ -382,7 +382,7 @@ void CGxString::InitializeTextLine(const char* currentText, uint32_t numBytes, C
float stepGlyph = 0.0f;
float stepScreen = 0.0f;
uint32_t prevCode = 0;
CImVector color;
CImVector color = this->m_fontColor;
while (numBytes && *currentText) {
int32_t advance;

View File

@ -876,9 +876,17 @@ void CSimpleFontString::UpdateString() {
uint32_t styleFlags = this->m_styleFlags;
if (!(this->m_styleFlags & 0x400)) {
// TODO
styleFlags |= 0x400;
// Set FixedColor flag if the text does not contain color tags
bool found = false;
for (size_t i = 0; displayText && displayText[i]; ++i) {
if (displayText[i] == '|' && (displayText[i + 1] == 'C' || displayText[i + 1] == 'c')) {
found = true;
break;
}
}
if (!found) {
styleFlags |= 0x400u;
}
}
CImVector color = { 0xFF, 0xFF, 0xFF, 0xFF };