[ft-devel] FT_Set_Char_Size()
Hallo anyone at FreeType, If any one could answer my (silly?) question. I need to use FT_Set_Char_Size() to set my character size at point 7,25 (verdana). Since this function accepts FT_F26dot6 as the char height and width, I am wondering how I can set point 7,25 without losing data if I cast 7,25 to FT_F26dot6. Any help is appreciated. Thanks in advance, Yeshi ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_Set_Char_Size()
If any one could answer my (silly?) question. I need to use FT_Set_Char_Size() to set my character size at point 7,25 (verdana). Since this function accepts FT_F26dot6 as the char height and width, I am wondering how I can set point 7,25 without losing data if I cast 7,25 to FT_F26dot6. As the name says, F26dot6 has 26 bits before the dot, and 6 bits after it. Consequently, you simply multiply by 64 if you want to convert into the F26dot6 format: 7.25 * 64 = 464 Werner ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] [ANN] Freetype/OpenGL (with good rendering quality)
I think you can pack the bin better if you start from the largest size. There is tons of empty space at the bottom that could easily be filled with small glyphs. Or go bottom-up for more natural fill. In other words, I bet you can pack more glyphs into 512x512. I am not sure I understood how you do subpixel positioning from the texture. On Wed, Sep 21, 2011 at 6:55 AM, Nicolas Rougier nicolas.roug...@inria.fr wrote: Hi Folks, You might be interested in the following code that allow to render freetype font using OpenGL with quite good quality (IMHO): http://code.google.com/p/freetype-gl/ There are examples for infinite zoom, subpixel positioning, gamma correction... I got most ideas from the antigrain library: http://www.antigrain.com/research/font_rasterization/ (the demo-atg-agg.c tries to reproduce the truetype_test from this article) Nicolas ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel -- Alexei A. Podtelezhnikov, PhD ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] [ANN] Freetype/OpenGL (with good rendering quality)
Thanks for the tips, I'll give it a try. One problem is that glyphs are loaded on demand and consequently I do not have full control. The subpixel positionning is made using a shader. I display the glyph at a given integer coordinate and send along the float component: If glyph must be displayed at coordinate x=5.4, I display it at x=5 and send m=.4 to the shader. Then depending on m ( 0-.33, .33-.66 and .66-.99), I make a combination with previous pixel for each color channel: // current pixel as r,g,b,a vec4 current = texture2D(texture, uv); // prevous pixel as r,g,b,a vec4 previous= texture2D(texture, uv+vec2(-1,0)*pixel); float r = current.r; float g = current.g; float b = current.b; float a = current.a; if( m = 0.333 ) { float z = m/0.333; r = mix(current.r, previous.b, z); g = mix(current.g, current.r, z); b = mix(current.b, current.g, z); } else if( m = 0.666 ) { float z = (m-0.33)/0.333; r = mix(previous.b, previous.g, z); g = mix(current.r, previous.b, z); b = mix(current.g, current.r, z); } else if( m 1.0 ) { float z = (m-0.66)/0.334; r = mix(previous.g, previous.r, z); g = mix(previous.b, previous.g, z); b = mix(current.r, previous.b, z); } Final color is then r, g, b, a. I compared with direct freetype rendering but obtained small differences. Nicolas On Sep 21, 2011, at 18:07 , Alexei Podtelezhnikov wrote: I think you can pack the bin better if you start from the largest size. There is tons of empty space at the bottom that could easily be filled with small glyphs. Or go bottom-up for more natural fill. In other words, I bet you can pack more glyphs into 512x512. I am not sure I understood how you do subpixel positioning from the texture. On Wed, Sep 21, 2011 at 6:55 AM, Nicolas Rougier nicolas.roug...@inria.fr wrote: Hi Folks, You might be interested in the following code that allow to render freetype font using OpenGL with quite good quality (IMHO): http://code.google.com/p/freetype-gl/ There are examples for infinite zoom, subpixel positioning, gamma correction... I got most ideas from the antigrain library: http://www.antigrain.com/research/font_rasterization/ (the demo-atg-agg.c tries to reproduce the truetype_test from this article) Nicolas ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel -- Alexei A. Podtelezhnikov, PhD ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] [ANN] Freetype/OpenGL (with good rendering quality)
Hi Nicolas, This is great stuff! Humm, may I suggest that you write a PangoRenderer implementation around this? You can then render any language... behdad On 09/21/11 06:55, Nicolas Rougier wrote: Hi Folks, You might be interested in the following code that allow to render freetype font using OpenGL with quite good quality (IMHO): http://code.google.com/p/freetype-gl/ There are examples for infinite zoom, subpixel positioning, gamma correction... I got most ideas from the antigrain library: http://www.antigrain.com/research/font_rasterization/ (the demo-atg-agg.c tries to reproduce the truetype_test from this article) Nicolas ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel