fix baseline offset calculation
This commit is contained in:
parent
35f1eee2a7
commit
9ddbf64b87
@ -55,14 +55,13 @@ bool Font::preload_glyphs()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (m_face->glyph->bitmap_top > max_top)
|
||||
if (g->get_top() > max_top)
|
||||
{
|
||||
max_top = m_face->glyph->bitmap_top;
|
||||
max_top = g->get_top();
|
||||
}
|
||||
int bitmap_bottom = m_face->glyph->bitmap_top - m_face->glyph->bitmap.rows;
|
||||
if (bitmap_bottom < min_bottom)
|
||||
if (g->get_bottom() < min_bottom)
|
||||
{
|
||||
min_bottom = bitmap_bottom;
|
||||
min_bottom = g->get_bottom();
|
||||
}
|
||||
if (g->get_advance() > m_advance)
|
||||
{
|
||||
|
@ -62,6 +62,9 @@ bool Glyph::load(FT_Library library, FT_Face face, FT_ULong char_code, int outli
|
||||
(GLfloat)(left + width), (GLfloat)top, s_max, t_max,
|
||||
});
|
||||
|
||||
m_top = top;
|
||||
m_bottom = top - height;
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
|
||||
|
@ -16,9 +16,13 @@ public:
|
||||
m_texture->bind(GL_TEXTURE_2D);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
int get_top() { return m_top; }
|
||||
int get_bottom() { return m_bottom; }
|
||||
|
||||
protected:
|
||||
int m_advance;
|
||||
int m_top;
|
||||
int m_bottom;
|
||||
std::shared_ptr<glcxx::Texture> m_texture;
|
||||
std::shared_ptr<glcxx::Buffer> m_buffer;
|
||||
std::shared_ptr<glcxx::Array> m_array;
|
||||
|
Loading…
x
Reference in New Issue
Block a user