freetype
[Top][All Lists]
Advanced

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

Re: [ft] Fw: [ft-devel] fitting a text


From: folkert
Subject: Re: [ft] Fw: [ft-devel] fitting a text
Date: Sun, 7 Jun 2015 11:45:34 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Hi,

> > I'm trying to draw text to a bitmap. It should fit the height of the
> > bitmap and the width can be extended whenever required.
> > Getting the width right works fine but the height is a problem: a, b, c
> > fit nicely but g, q and _ fall below the bottom. How can I get this to
> > work?

Lawrence:

> You have to add the maximum ascender and the maximum descender of
> allt the glyphs to get the minimum bitmap height. For example:
> <https://github.com/ldo/python_freetype_examples/blob/master/render_text>

I converted it but that seems to fail too.

Now I googled a bit for a picture of how a glyph is setup and I found
this: http://www.freetype.org/freetype2/docs/glyphs/Image3.png
So from that I conclude that I should use the `height' (of
face.glyph.metrics)?
I tried scaling the height-value I give to FT_Set_Pixel_Sizes by
max_ascender / height, by max_ascender + max_descender, and quite a lot
of other variations. But with all the result is that the bitmap
produced by FT_Load_Char(FT_LOAD_RENDER) doesn't fit.

Wouldn't it be more helpful to have a ft_set_total_height_in_pixels or
so?



Folkert van Heusden



reply via email to

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