Fix drawing single character text format

This commit is contained in:
Wojciech Figat
2022-08-04 14:42:52 +02:00
parent 142d81065a
commit 4c280ef015
2 changed files with 4 additions and 4 deletions

View File

@@ -1145,7 +1145,7 @@ void Render2D::DrawText(Font* font, const StringView& text, const Color& color,
// Check if there is no need to do anything
if (font == nullptr ||
text.IsEmpty() ||
text.Length() < 0 ||
(customMaterial && (!customMaterial->IsReady() || !customMaterial->IsGUI())))
return;
@@ -1249,7 +1249,7 @@ void Render2D::DrawText(Font* font, const StringView& text, const Color& color,
void Render2D::DrawText(Font* font, const StringView& text, const TextRange& textRange, const Color& color, const Float2& location, MaterialBase* customMaterial)
{
DrawText(font, StringView(text.Get() + textRange.StartIndex, textRange.Length()), color, location, customMaterial);
DrawText(font, textRange.Substring(text), color, location, customMaterial);
}
void Render2D::DrawText(Font* font, const StringView& text, const Color& color, const TextLayoutOptions& layout, MaterialBase* customMaterial)
@@ -1362,7 +1362,7 @@ void Render2D::DrawText(Font* font, const StringView& text, const Color& color,
void Render2D::DrawText(Font* font, const StringView& text, const TextRange& textRange, const Color& color, const TextLayoutOptions& layout, MaterialBase* customMaterial)
{
DrawText(font, StringView(text.Get() + textRange.StartIndex, textRange.Length()), color, layout, customMaterial);
DrawText(font, textRange.Substring(text), color, layout, customMaterial);
}
FORCE_INLINE bool NeedAlphaWithTint(const Color& color)

View File

@@ -165,7 +165,7 @@ namespace FlaxEngine.GUI
Range = new TextRange
{
StartIndex = tag.StartPosition,
EndIndex = tag.StartPosition,
EndIndex = tag.StartPosition - 1,
},
Style = context.StyleStack.Peek(),
Bounds = new Rectangle(context.Caret, new Float2(64.0f)),