[Top][All Lists]
[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:51:08 +0200 |
Hi Kevin,
> Kevin Dance a écrit :
>
> I am using the function calls "FT_Load_Glyph(Face,Index,FT_LOAD_DEFAULT)" and
> "FT_Render_Glyph(Face->glyph, ft_render_mode_normal)" to render a
> given glyph into a bitmap of type "FT_Bitmap". However, what I need to do is
> to know the maximum possible size that the bitmap can be before hand.
> Can this be achieved without simply looping throught all of the glyphs and
> rendering them during the initialisation phase of my program, since this
> will obviously take time. Is there a quick was to do this calculation?
>
There is no simple way to do that other than parsing all glyphs.
Note that you could however use, for scalable formats, the face's
global bounding box to obtain an _idea_ of the largest "character cell".
I'm using the word _idea_ because you cannot simply scale the bbox to
the current pixel size because of hinting. Maybe if you add a one pixel
border to it, you would have something meaningful, but there is no
guarantee.
> Alternatively, if I have to loop through all of the glyphs then I can
> determine the total number of glyphs by using "Face->num_glyphs". However, I
> have tried to render all glyphs from 0 to "Face->num_glyphs - 1" but my
> program crashes. How can I tell whether I can render a given glyph index and
> has anyone got any code to do this calculation successfully?
>
I suppose you're using Beta8. It contains a bug in the auto-hinter that causes
crashes when certain fonts are used. Please use the current snapshot, it believe
it is rock-solid :-)
Cheers,
- David