freetype
[Top][All Lists]
Advanced

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

Re: [ft] Calculating the height of the rectangle when selecting text whi


From: suzuki toshiya
Subject: Re: [ft] Calculating the height of the rectangle when selecting text while using Freetype
Date: Mon, 19 Jan 2015 23:57:11 +0900
User-agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)

Hi,

The values face->ascender, face->descender are what declared in a few
"summarization" tables (head, OS/2, etc). Unfortunately, the real
ascender & descender values are sometimes not exactly equal to the
the highest pixel & lowest pixel of the glyph outlines.
Some font designers say as they are intentionally changed to take the
human factor into account.

There might be other methods to the bounding box for the selected
text, but I cannot provide a sample immediately...

Regards,
mpsuzuki


Diederick Huijbers wrote:
> Hi,
> 
> I'm using Freetype + Harfbuzz to create a text input field for an OpenGL
> application and
> I'm trying to figure out what metrics I should use to calculate the height
> of the rectangle
> you see when you select text in a text input field.
> 
> For clarity, I'm trying to calculate the height of the blue rectangle
> underneath the text
> in this screenshot:
> 
> https://farm9.staticflickr.com/8584/16131613639_3665fcc9d9_o.png
> 
> From the docs I would think it's the ascender and descender I need to use
> as they
> give me max displacement above and below the baseline. Though, when I use
> these
> I'm getting a height which is not correct.  To debug this I drew the
> descender and ascender
> (from face->ascender and face->descender) in my OpenGL application as you
> can see
> in this image:
> 
> Red: ascender
> Blue: baseline
> Green: descender
> 
> https://farm8.staticflickr.com/7520/16131925067_2e051793d8_o.png
> 
> Because the values of the ascender and descender don't seem to be correct
> (or at least not what I would expect) I'm wondering what I'm doing wrong
> and if I
> should use other metrics?
> 
> Thanks
> roxlu
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Freetype mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/freetype




reply via email to

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