freetype
[Top][All Lists]
Advanced

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

[ft] Calculating the height of the rectangle when selecting text while u


From: Diederick Huijbers
Subject: [ft] Calculating the height of the rectangle when selecting text while using Freetype
Date: Mon, 19 Jan 2015 15:41:08 +0100

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



reply via email to

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