Skip to content

Commit

Permalink
#2: Minor formatting changes to font API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruskiy69 committed Jul 15, 2013
1 parent 17eec12 commit 43fcfe5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/GUI/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ bool CFont::LoadFromFile(const string_t& filename)
{
m_Log << m_Log.SetSystem("FreeType")
<< m_Log.SetMode(LogMode::ZEN_FATAL)
<< "FreeType2 API is not initialized."
<< CLog::endl;
<< "FreeType2 API is not initialized." << CLog::endl;
return (m_loaded = false);
}

Expand Down Expand Up @@ -62,15 +61,13 @@ bool CFont::LoadFromFile(const string_t& filename)
// otherwise.
if(index == 0)
{
m_Log << m_Log.SetMode(LogMode::ZEN_DEBUG)
<< "Character '" << s
m_Log << m_Log.SetMode(LogMode::ZEN_ERROR) << "Character '" << s
<< "' does not exist for this font." << CLog::endl;
}

this->LoadGlyph(s, (!index) ? space : index);
}

m_loaded = true;
this->SetFilename(filename);

// Cleanup
Expand Down Expand Up @@ -315,7 +312,7 @@ bool CFont::LoadGlyph(const char c, const uint16_t index)
// Store for restoring later.
GLint pack;
GL(glGetIntegerv(GL_UNPACK_ALIGNMENT, &pack));
GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1))
GL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));

gfxcore::CTexture* pTexture = mp_Assets->Create<gfxcore::CTexture>(this->GetOwner());
pTexture->LoadFromRaw(GL_R8, GL_RED, w, h, bitmap.buffer);
Expand All @@ -325,17 +322,18 @@ bool CFont::LoadGlyph(const char c, const uint16_t index)

GL(glPixelStorei(GL_UNPACK_ALIGNMENT, pack));

// Clean up TTF data.
FT_Done_Glyph(g);

// Store the glyph internally.
glyph_t glyph;
glyph.texture = pTexture;
glyph.size = math::vector_t(w, h);
glyph.position = math::vector_t(slot->metrics.horiBearingY >> 6,
slot->metrics.horiBearingX >> 6);
glyph.advance = slot->advance.x >> 6;
m_glyphData[c] = glyph;
m_glyphData[c] = glyph;

// Clean up TTF data.
FT_Done_Glyph(g);

return true;
}

Expand Down

0 comments on commit 43fcfe5

Please sign in to comment.