Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislawfortonski committed Mar 20, 2020
1 parent 402ae0f commit 6f506cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 0 additions & 2 deletions effect/PostProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ namespace Engine
{
static Plane quad;
glDisable(GL_DEPTH_TEST);
glDisable(GL_BLEND);

program.use();
program.setMat4("model", model);
Expand All @@ -79,6 +78,5 @@ namespace Engine
quad.render(program);

glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
}
}
12 changes: 10 additions & 2 deletions renderable/font/FontRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,25 @@ namespace Engine

void FontRenderer::getLineWidthAndHeight(float & width, float & height)
{
std::map<char, Font::Character> & characters = font.getCharacters();
height = 0;
width = 0;
std::map<char, Font::Character> & characters = font.getCharacters();
for (auto it = text.cbegin(); it != text.cend(); ++it)
{
Font::Character ch = characters[*it];
width += ch.size.x * scale;

float size;
if (ch.size.x == 0)
size = ch.advance/font.getSize() + 4;
else size = ch.size.x;

width += size + ch.bearing.x*2;

float h = ch.size.y * scale;
if (height < h)
height = h;
}
width *= scale;
height *= scale;
}
};

0 comments on commit 6f506cf

Please sign in to comment.