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: Lawrence D'Oliveiro
Subject: Re: [ft] Fw: [ft-devel] fitting a text
Date: Thu, 11 Jun 2015 21:08:24 +1200

On Thu, 11 Jun 2015 10:41:35 +0200, folkert wrote:

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

Are you rounding sizes to integers? Remember that fractional font sizes
and metrics are allowed.

My code prints out the computed bitmap dimensions (including
fractions); do the numbers agree with what you calculate?

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

That’s a series of calls using Cairo graphics to do the text rendering.
After setting the font, it sets the text size, moves the origin to the
text baseline, and draws the glyphs.



reply via email to

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