summaryrefslogtreecommitdiff
path: root/src/font.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/font.cpp')
-rw-r--r--src/font.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/font.cpp b/src/font.cpp
index 9b38d69..d368b5a 100644
--- a/src/font.cpp
+++ b/src/font.cpp
@@ -217,6 +217,7 @@ bool FontType_Inner_CalcTransforms(const FontType *ft, FontRender *fr, FontInsta
FontGlyphChar *fgc, *fgc2;
FontInstanceBufferItem *buf_item;
bool new_word = true;
+ bool first_word_of_line = true;
uint32_t i, ii;
float font_glyph_spacing;
float cursor_head, line_index, line_height, line_length, line_offset;
@@ -274,6 +275,7 @@ bool FontType_Inner_CalcTransforms(const FontType *ft, FontRender *fr, FontInsta
}
line_index += 1;
new_word = true;
+ first_word_of_line = true;
cursor_head = 0;
line_length = FontType_Inner_LookAheadLineLength(ft, fr, i+1, font_glyph_spacing);
if (PK_HAS_FLAG(fr->settings.surface_area_type_flags, FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_CENTER_HORIZONTAL)) {
@@ -305,7 +307,7 @@ bool FontType_Inner_CalcTransforms(const FontType *ft, FontRender *fr, FontInsta
}
if (new_word == true) {
float word_width = FontType_Inner_LookAheadWordLength(ft, fr, i, font_glyph_spacing);
- if (cursor_head + word_width > fr->settings.surface_area_size.x) {
+ if (first_word_of_line == false && cursor_head + word_width > fr->settings.surface_area_size.x) {
line_index += 1;
cursor_head = 0;
line_length = FontType_Inner_LookAheadLineLength(ft, fr, i, font_glyph_spacing);
@@ -314,8 +316,9 @@ bool FontType_Inner_CalcTransforms(const FontType *ft, FontRender *fr, FontInsta
cursor_head = (fr->settings.surface_area_size.x - line_length) / 2.0;
}
}
- new_word = false;
}
+ first_word_of_line = false;
+ new_word = false;
// left, bottom, right, top
// x, y, z, w