From 51657e10769faa2617d546a06c42e4c62a19bb50 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 30 Jan 2022 17:41:24 +0100 Subject: Removed trailing whitespace all over the place --- Stars45/Font.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'Stars45/Font.cpp') diff --git a/Stars45/Font.cpp b/Stars45/Font.cpp index 83f0430..13380bd 100644 --- a/Stars45/Font.cpp +++ b/Stars45/Font.cpp @@ -166,7 +166,7 @@ Font::Load(const char* name) } } - return true; + return true; } void @@ -300,7 +300,7 @@ Font::LoadDef(char* defname, char* imgname) if (k < 100) kern_tweak[a[0]][b[0]] = k; } - + else { Print("WARNING: unknown object '%s' in '%s'\n", def->name()->value().data(), defname); @@ -334,7 +334,7 @@ Font::GlyphOffset(BYTE c) const if (islower(c)) c = toupper(c); - return (c/row_items * row_size * scale * scale + + return (c/row_items * row_size * scale * scale + c%row_items * char_width * scale); } @@ -728,7 +728,7 @@ Font::DrawTextSingle(const char* text, int count, const Rect& text_rect, Rect& c if (flags & DT_RIGHT) align = DT_RIGHT; else if (flags & DT_CENTER) - align = DT_CENTER; + align = DT_CENTER; int max_width = 0; @@ -800,7 +800,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli if (flags & DT_RIGHT) align = DT_RIGHT; else if (flags & DT_CENTER) - align = DT_CENTER; + align = DT_CENTER; int nlines = 0; int max_width = 0; @@ -821,7 +821,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli // repeat for each line of text: while (count_remaining > 0) { int length = 0; - + // find the end of the last whole word that fits on the line: for (;;) { next_word_end = find_next_word_end(text, curr_word_end+1); @@ -833,14 +833,14 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli eol_index = curr_word_end = next_word_end; break; } - + int word_len = next_word_end - line_start + 1; length = StringWidth(text+line_start, word_len); - + if (length < text_rect.w) { curr_word_end = next_word_end; - + // check for a newline in the next block of white space: eol_index = 0; const char* eol = &text[curr_word_end+1]; @@ -878,7 +878,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli case DT_CENTER: xoffset = (text_rect.w - length)/2; break; } } - + if (length > max_width) max_width = length; if (eol_index > 0) @@ -911,7 +911,7 @@ Font::DrawTextWrap(const char* text, int count, const Rect& text_rect, Rect& cli } } } - + nlines++; yoffset += Height(); if (eol_index > 0) @@ -939,7 +939,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl if (flags & DT_RIGHT) align = DT_RIGHT; else if (flags & DT_CENTER) - align = DT_CENTER; + align = DT_CENTER; int max_width = 0; int line_start = 0; @@ -953,7 +953,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl while (count_remaining > 0) { int length = 0; int line_count = 0; - + // find the end of line: while (line_count < count_remaining) { char c = text[line_start+line_count]; @@ -976,7 +976,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl case DT_CENTER: xoffset = (text_rect.w - length)/2; break; } } - + if (length > max_width) max_width = length; if (length && !nodraw) { @@ -985,7 +985,7 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl DrawString(text+line_start, line_count, x1, y1, text_rect); } - + nlines++; yoffset += Height(); @@ -1033,14 +1033,14 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit if ((flags & FONT_ALL_CAPS) && islower(c)) c = toupper(c); - + int cw = glyph[c].width + interspace; int ch = height; int k = 0; if (i < len-1) k = kern[c][str[i+1]]; - + // horizontal clip: if (x1 < clip.x) { if (isspace(c) && (c < PIPE_NBSP || c > ARROW_RIGHT)) { @@ -1098,7 +1098,7 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit x1 += cw + k; maxw -= cw + k; } - + count++; } } @@ -1144,13 +1144,13 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit if ((flags & FONT_ALL_CAPS) && islower(c)) c = toupper(c); - + int cw = glyph[c].width + interspace; int k = 0; if (i < len-1) k = kern[c][str[i+1]]; - + // horizontal clip: if (x1 < clip.x) { if (isspace(c) && (c < PIPE_NBSP || c > ARROW_RIGHT)) { @@ -1215,7 +1215,7 @@ Font::DrawString(const char* str, int len, int x1, int y1, const Rect& clip, Bit } if (count) { - // this small hack is an optimization to reduce the + // this small hack is an optimization to reduce the // size of vertex buffer needed for font rendering: int old_nverts = vset->nverts; -- cgit v1.1