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

_______________________________________________
Freetype mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to