Skip to content

Commit

Permalink
Fixed bug in the font renderer which failed to consider multiple newline
Browse files Browse the repository at this point in the history
character sequences with no printable characters seperating them.
  • Loading branch information
danij-deng committed Jul 26, 2011
1 parent de6bd8d commit dbde124
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions doomsday/engine/portable/src/rend_font.c
Expand Up @@ -1197,8 +1197,7 @@ void FR_DrawText3(const char* text, int x, int y, int alignFlags, short textFlag

for(end = str; *end && *end != '{';)
{
boolean newline = false;
int fragmentAlignFlags;
int newlines = 0, fragmentAlignFlags;
float alignx = 0;

// Find the end of the next fragment.
Expand Down Expand Up @@ -1230,10 +1229,10 @@ void FR_DrawText3(const char* text, int x, int y, int alignFlags, short textFlag
fragment = buffer;
}

if(end && *end == '\n')
while(*end == '\n')
{
newline = true;
++end;
newlines++;
end++;
}

// Continue from here.
Expand Down Expand Up @@ -1278,7 +1277,7 @@ void FR_DrawText3(const char* text, int x, int y, int alignFlags, short textFlag
charCount += strlen(fragment);

// Advance the current position?
if(!newline)
if(newlines == 0)
{
cx += ((float) textFragmentWidth(fragment) + currentAttribs()->tracking) * state.scaleX;
}
Expand All @@ -1288,7 +1287,7 @@ void FR_DrawText3(const char* text, int x, int y, int alignFlags, short textFlag
state.lastLineHeight = textFragmentHeight(fragment);

cx = (float) x;
cy += (float) state.lastLineHeight * (1+FR_Leading());
cy += newlines * (float) state.lastLineHeight * (1+FR_Leading());
}

glMatrixMode(GL_MODELVIEW);
Expand Down

0 comments on commit dbde124

Please sign in to comment.