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: Thu, 11 Jun 2015 10:41:35 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

> > 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.

What I meant is: the height of the bitmap in the face structure is
bigger than the size given to set_char_size.

I looked at your example and I literally copied your set_char_size
(which is not that different from what I had). The result is that when
I set size to 10, I get bitmaps that are 11 pixels in height.

Then there's this in your code:

pix = qah.ImageSurface.create(CAIRO.FORMAT_RGB24, (round(width),
round(height)))
(qah.Context.create(pix)
    .set_source_colour(Colour.grey(1))
    .set_operator(CAIRO.OPERATOR_SOURCE)
    .paint()
    .set_source_colour(Colour.grey(0))
    .set_font_face(qah.FontFace.create_for_ft_face(face))
    .set_font_size(textsize)
    .translate((0, max_ascender))
    .show_glyphs(glyphs)
)

I have no idea what this is doing. Is it rendering the character
itself and thus scaling it to the correct height?


Folkert



reply via email to

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