mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 04:17:00 +00:00
ImFont: ignoring \r
This commit is contained in:
parent
d31cf1af5d
commit
20088303e9
61
imgui.cpp
61
imgui.cpp
@ -9714,12 +9714,20 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
|||||||
if (c == 0)
|
if (c == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (c == '\n')
|
if (c < 32)
|
||||||
{
|
{
|
||||||
line_width = word_width = blank_width = 0.0f;
|
if (c == '\n')
|
||||||
inside_word = true;
|
{
|
||||||
s = next_s;
|
line_width = word_width = blank_width = 0.0f;
|
||||||
continue;
|
inside_word = true;
|
||||||
|
s = next_s;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == '\r')
|
||||||
|
{
|
||||||
|
s = next_s;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance;
|
const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance;
|
||||||
@ -9825,12 +9833,17 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '\n')
|
if (c < 32)
|
||||||
{
|
{
|
||||||
text_size.x = ImMax(text_size.x, line_width);
|
if (c == '\n')
|
||||||
text_size.y += line_height;
|
{
|
||||||
line_width = 0.0f;
|
text_size.x = ImMax(text_size.x, line_width);
|
||||||
continue;
|
text_size.y += line_height;
|
||||||
|
line_width = 0.0f;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == '\r')
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance;
|
const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance;
|
||||||
@ -9872,12 +9885,17 @@ ImVec2 ImFont::CalcTextSizeW(float size, float max_width, const ImWchar* text_be
|
|||||||
{
|
{
|
||||||
const unsigned int c = (unsigned int)(*s++);
|
const unsigned int c = (unsigned int)(*s++);
|
||||||
|
|
||||||
if (c == '\n')
|
if (c < 32)
|
||||||
{
|
{
|
||||||
text_size.x = ImMax(text_size.x, line_width);
|
if (c == '\n')
|
||||||
text_size.y += line_height;
|
{
|
||||||
line_width = 0.0f;
|
text_size.x = ImMax(text_size.x, line_width);
|
||||||
continue;
|
text_size.y += line_height;
|
||||||
|
line_width = 0.0f;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == '\r')
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance;
|
const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance;
|
||||||
@ -9971,11 +9989,16 @@ void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_re
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '\n')
|
if (c < 32)
|
||||||
{
|
{
|
||||||
x = pos.x;
|
if (c == '\n')
|
||||||
y += line_height;
|
{
|
||||||
continue;
|
x = pos.x;
|
||||||
|
y += line_height;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == '\r')
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
float char_width = 0.0f;
|
float char_width = 0.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user