but on final rendering (using VBO) i got some issues which drive me nuts ...
First i figured out that the Freetype font values of freetype metrics and freetype bitmap are
not the same. During initialization i create for each glyph of a font a glyph entry and set the
follwing values taken from glyph metrics:
m_charcode 114 unsigned int m_advanceX 6.0000000 float m_advanceY -14.000000 float m_width 6 unsigned int m_height 9 unsigned int m_offsetX 1.0000000 float (m_face->glyph->metrics.horiBearingX/64.0f) m_offsetY 9.0000000 float (m_face->glyph->metrics.horiBearingY/64.0f) using FT_Load_Char(m_face, charcode, FT_LOAD_DEFAULT | FT_LOAD_FORCE_AUTOHINT)) to load the glyph without rendering.
When i rasterize the freetype bitmap to my atlas texture i got the following values from the
Freetype FT_bitmap / FT_BitmapGlyph / Slot:
advanceX 5.7500000 float advanceY 0.00000000 float width 4 int (FT_Bitmap) height 8 int (FT_Bitmap) offsetX 1.2656250 float (m_face->glyph->metrics.horiBearingX/64.0f) offsetY 7.8437500 float (m_face->glyph->metrics.horiBearingY/64.0f) Using //Load the Glyph for our character. if(FT_Load_Glyph(m_face, FT_Get_Char_Index( m_face, glyph.getCharcode()), FT_LOAD_DEFAULT )) throw std::runtime_error("FT_Load_Glyph failed"); //Move the face's glyph into a Glyph object. FT_Glyph ft_glyph; if(FT_Get_Glyph( m_face->glyph, &ft_glyph )) throw std::runtime_error("FT_Get_Glyph failed"); //Convert the glyph to a bitmap. FT_Glyph_To_Bitmap( &ft_glyph, ft_render_mode_normal, 0, 1 ); FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph)ft_glyph;
As you can see those values are not equals but i use the equal command to determine
the offset value ...
And if i take the offset values directly from bitmap i got this
offsetX 1.0000000 float (bitmap->left) offsetY 1.0000000 float (bitmap->top)
This confusing me. Why are those values are not the same? I read the freetype documentation
multiple times, but i can't fint a hint what is the difference between those values and which i have
This value differnces creates differnt issues when i try to render a simple text.
It looks like some of those offset values are not correct ...
If I use the metric values and the FT_Bitmap dimensions i got the following output. Here have some
chars (i.e. r) some possition/offset issues:
If I use the second values intstead i got the following output. Which looks better in offset positioning,
but this create some imaging failures (chars look different colored and have some border streaks)
I tried differnt font sizes (12, 14, 16) and resolutions (72, 96, 100). This results also in other issues.
I.e. If i set the resolution for the vera.ttf font size 12 from 96 to 100 i got this text output:
http://s1.directuplo...l4pfzt8_jpg.htm (second values)
http://s14.directupl...ho3pv8w_jpg.htm (first values)
In that case the first values looks more correct in offset positioning, only some chars like the r are
also not correct...
I'am running out of ideas what could be wrong.
Can anyone help?
Thanks in advance,