Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/moaicore/MOAIFreeTypeFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ USRect MOAIFreeTypeFont::DimensionsOfLine(cc8 *text, float fontSize, FT_Vector *
// Gather up the positions of each glyph
FT_Int penX = 0, penY = 0;

for (size_t n = 0; n < maxGlyphs; ) {
for (size_t n = 0; numGlyphs < maxGlyphs; numGlyphs++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This for loop feels really weird. I'm seeing how trying to clean it up expands into a much larger task. How would you feel about just switching it to a while loop until that cleanup happens, since it might make it a little more readable?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Does the value of n ever change in this loop?

FT_UInt glyphIndex;

int idx = (int)n;
Expand Down Expand Up @@ -625,7 +625,6 @@ USRect MOAIFreeTypeFont::DimensionsOfLine(cc8 *text, float fontSize, FT_Vector *
penX += glyphXAdvance;

previousGlyphIndex = glyphIndex;
numGlyphs++;
}

// compute the bounding box of the glyphs
Expand Down Expand Up @@ -1650,7 +1649,7 @@ MOAITexture* MOAIFreeTypeFont::RenderTextureSingleLine(cc8 *text, float fontSize
FT_UInt numGlyphs;
FT_Error error;

const size_t maxGlyphs = strlen(text);
const size_t maxGlyphs = glyphsInText(text);

FT_Int maxDescender;
FT_Int maxAscender;
Expand Down