freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Possible implementation error of function FT_Bitmap_Embol


From: Werner LEMBERG
Subject: Re: [ft-devel] Possible implementation error of function FT_Bitmap_Embolden()
Date: Sat, 27 Dec 2008 22:48:19 +0100 (CET)

> The specification for FT_Bitmap_Embolden() stated that:
>
> "Embolden a bitmap. The new bitmap will be about `xStrength' pixels
> wider and `yStrength' pixels higher. The left and bottom borders are
> kept unchanged."

This works as specified.

> However, after we called this function to embolden a character, the
> bottom border is not kept unchanged. As a result the top border is
> unchanged.
>
> There is an inconsistency between the spec and the implementation.

No, there isn't.  In your program, you do this:

  err_ebd = FT_Bitmap_Embolden(library, &emb_bitmap,
                               xStrength, yStrength);
  ((FT_BitmapGlyph)glyph)->bitmap = emb_bitmap;
  FT_Glyph_Get_CBox(glyph, 0, &cbox);

Assigning the emboldened bitmap back to the FT_Glyph structure.  While
`width' and `row' are part of an FT_Bitmap structure, the `left' and
`top' values are not.  The computation within FT_Glyph_Get_CBox thus
returns the values you've observed.

Either update the `top' value in `FT_BitmapGlyph' by yourself or reuse
the code from `FT_GlyphSlot_Embolden' (in `ftsynth.c'), which adjusts
the `bitmap_top' field in the FT_GlyphSlot structure.


    Werner




reply via email to

[Prev in Thread] Current Thread [Next in Thread]