aboutsummaryrefslogtreecommitdiff
path: root/src/cguittfont
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-06-19 23:02:09 +0200
committersapier <Sapier at GMX dot net>2014-06-19 23:02:09 +0200
commit3a9cf216641aeb4f16570c69e3df760108b7c9e8 (patch)
treedd038d76b1bd700d1821c14ed8b9b62cdc3a4b22 /src/cguittfont
parent1c7cc2665bfacbee8d0fa3a00bca640f02620892 (diff)
downloadminetest-3a9cf216641aeb4f16570c69e3df760108b7c9e8.tar.gz
minetest-3a9cf216641aeb4f16570c69e3df760108b7c9e8.tar.bz2
minetest-3a9cf216641aeb4f16570c69e3df760108b7c9e8.zip
Fix newline not handled to to interpreting it as invisible char
Diffstat (limited to 'src/cguittfont')
-rw-r--r--src/cguittfont/CGUITTFont.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/cguittfont/CGUITTFont.cpp b/src/cguittfont/CGUITTFont.cpp
index 9a702cad7..73a126a9f 100644
--- a/src/cguittfont/CGUITTFont.cpp
+++ b/src/cguittfont/CGUITTFont.cpp
@@ -568,32 +568,32 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
uchar32_t currentChar = *iter;
n = getGlyphIndexByChar(currentChar);
bool visible = (Invisible.findFirst(currentChar) == -1);
- if (n > 0 && visible)
+ bool lineBreak=false;
+ if (currentChar == L'\r') // Mac or Windows breaks
{
- bool lineBreak=false;
- if (currentChar == L'\r') // Mac or Windows breaks
- {
- lineBreak = true;
- if (*(iter + 1) == (uchar32_t)'\n') // Windows line breaks.
- currentChar = *(++iter);
- }
- else if (currentChar == (uchar32_t)'\n') // Unix breaks
- {
- lineBreak = true;
- }
+ lineBreak = true;
+ if (*(iter + 1) == (uchar32_t)'\n') // Windows line breaks.
+ currentChar = *(++iter);
+ }
+ else if (currentChar == (uchar32_t)'\n') // Unix breaks
+ {
+ lineBreak = true;
+ }
- if (lineBreak)
- {
- previousChar = 0;
- offset.Y += font_metrics.ascender / 64;
- offset.X = position.UpperLeftCorner.X;
+ if (lineBreak)
+ {
+ previousChar = 0;
+ offset.Y += font_metrics.ascender / 64;
+ offset.X = position.UpperLeftCorner.X;
- if (hcenter)
- offset.X += (position.getWidth() - textDimension.Width) >> 1;
- ++iter;
- continue;
- }
+ if (hcenter)
+ offset.X += (position.getWidth() - textDimension.Width) >> 1;
+ ++iter;
+ continue;
+ }
+ if (n > 0 && visible)
+ {
// Calculate the glyph offset.
s32 offx = Glyphs[n-1].offset.X;
s32 offy = (font_metrics.ascender / 64) - Glyphs[n-1].offset.Y;