freetype-devel
[Top][All Lists]
Advanced

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

Re: Calculating the maximum size of a rendered bitmap


From: David Turner
Subject: Re: Calculating the maximum size of a rendered bitmap
Date: Mon, 21 Aug 2000 22:46:44 +0200

Hi Sven,

> 
> I have to second that question. I'm in the progress of porting the Gimp
> FreeType plug-in to freetype2-beta8 and tried to follow the updated
> tutorials. I really like the idea to only load the glyphs while calculating
> the layout, then convert them into a bitmap when rendering. The problem is
> that FT_Glyph_Get_CBox (glyph->image, ft_glyph_bbox_pixels, &glyph_bbox)
> returns a wrong bounding box since converting to bitmap using
> FT_Glyph_To_Bitmap () introduces slight offsets (bitmap->top and
> bitmap->left) which often cause the rendered string to be drawn beyond
> the precalculated bounding box. The code examples from the tutorials might
> be accurate enough to render a centered string, but to allocate the
> correctly sized drawable I need the result to always fit into my bounding
> box. The code we use right now is pretty ugly and I'd like to know if
> there's a more elegant way to do it.
> 

This is a bug, not a feature !! Sven, you should have told us about this
before doing any ugly things in your source code, because these two
methods should theorically give you the exact same results !!

I have fixed the bug yesterday, it should be available in the CVS as
well as the current snapshots if you want to try it. You'll need to
re-compile your code because the values of the "ft_glyph_bbox_XXXX"
constants has been changed.. it has been tested with a few tests
in "ftstring", please have a look and tell me if it solves your
woes..

Thanks a lot for spotting this..

Cheers,

- David



reply via email to

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