[Ffmpeg-devel] [PATCH] drawtext.c: 08 fix process measure and cache code

Michael Niedermayer michaelni
Sun Sep 24 01:13:37 CEST 2006


Hi

On Sun, Sep 10, 2006 at 04:05:49PM -0300, Gustavo Sverzut Barbieri wrote:
> This fix one of most broken code present in drawtext: measure and
> cache of glyphs in order to draw them on picture. This also fix
> background drawing for single-line strings and avoid out-of-buffer
> drawing.
> 
> It defines 2 extra functions to help code readability:
> 
> - get_kerning() given 2 char index (current and previous) get the
> pixel offset for kerning.
> - get_offset_based_on_previous(): given characters and context, check
> if kerning is possible and use get_kerning().

[...]
>  
> +          /* save position */
> +          pos[i].x = x + ci->bitmap_left[c];
> +          pos[i].y = y - ci->bitmap_top[c] + ci->baseline;
> +
> +          x += ci->advance[c];
> +          if (i + 1 < size)
> +            x += get_offset_based_on_previous(ci, c, text[i + 1]);
>  
> -      /* save position */
> -      pos[i].x = x + ci->bitmap_left[c];
> -      pos[i].y = y - ci->bitmap_top[c] + ci->baseline;
> -
> -
> -      x += ci->advance[c];
> -

cosmtics

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list