[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] bug? Rendering glyphs twice
From: |
David Turner |
Subject: |
Re: [Devel] bug? Rendering glyphs twice |
Date: |
Mon, 27 Aug 2001 11:58:14 +0200 |
Hello Gustavo,
Gustavo J A M Carneiro a écrit :
>
> I'm not sure, but this could be a bug in freetype. My program renders
> a
> text using freetype this way:
> 1- A list o outline glyphs is obtained with their rendering positions.
> This list of glyphs and positions forms a text line;
> 2- The rendering position of text line is adjusted to achieve
> alignment;
> 3- Finally, the list of glyphs is rendered to a pixel buffer. The
> original outline glyphs are preserved, because I convert them to bitmaps
> with:
> error = FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, NULL, 0);
>
> I keep the outline glyphs around and later, when I need to render the
> same text again, I use the same glyphs. Unfortunately, at the second and
> subsequent renders the glyphs are rendered at wrong positions. A
> attached two screenshots of the results of first and second rendering.
>
> This seems like a bug in freetype (btw, I using freetype 2.0.4), but
> it
> seems like a common programming error I'd appreciate a hint on what I
> may be doing wrong. Thanks.
>
It's difficult to tell wether this is a FreeType or programming error.
Could you try creating your bitmaps a bit differently, as in:
FT_Glyph glyph_copy;
error = FT_Glyph_Copy( glyph, &glyph_copy );
if (error) ...
error = FT_Glyph_To_Bitmap( &glyph_copy, ft_render_mode_normal, NULL, 0 );
FT_Done_Glyph( glyph_copy );
if (error) ...
and also try:
FT_Glyph glyph_copy;
error = FT_Glyph_Copy( glyph, &glyph_copy );
if (error) ...
error = FT_Glyph_To_Bitmap( &glyph_copy, ft_render_mode_normal, NULL, 1 );
if (error) ...
to see if this makes a difference. Normally, FT_Glyph_To_Bitmap shouldn't
change the content of the original glyph, which is why I'm surprised by
your results..
Regards,
- David
> --
> Gustavo João Alves Marques Carneiro <address@hidden>
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
> Name: ft2_1st_render.png
> ft2_1st_render.png Type: PNG Image (image/png)
> Encoding: base64
>
> Name: ft2_2nd_render.png
> ft2_2nd_render.png Type: PNG Image (image/png)
> Encoding: base64