nanogui: Freetype2 position Y problem
Subject:
RE: [nanogui] Freetype2 position Y problem
From:
Teemu Keskinarkaus ####@####.####
Date:
2 Jan 2007 09:59:14 +0000
Message-Id: <FB4B49604ADFD949A9F32F2D8E6C4D470197DED3@alban.ccs.local>
Hi,
I got the things working ok. Had to add the baseline handling and after that
the fonts appeared on the right places. At the moment this is enough for me.
Thanks.
Teemu Keskinarkaus
CC-Systems
-----Original Message-----
From: Uwe Klatt ####@####.####
Sent: 29. joulukuuta 2006 15:24
To: Teemu Keskinarkaus; Nano-X
Subject: Re: [nanogui] Freetype2 position Y problem
Hello,
> I debugged the problem and found out that in engine/font_freetype2.c
> in function freetype2_drawtext there is a bug in code that counts
> value for pos.y. It doesn't count the baseline in pos.y thus the text
> is baseline amount too high. If I add the baseline value to the pos.y
I use the following code (not in 0.91 but allready in cvs):
====================== font_truetype2.c ===============
/*
* Offset the starting point if necessary,
* FreeType always aligns at baseline
*/
if (flags & MWTF_BOTTOM) {
pos.y = (abs(size->metrics.descender) + 63) & ~63;
/* descent */
} else if (flags & MWTF_TOP) {
pos.y = (size->metrics.ascender + 63) & ~63;
/* -ascent */
} else {
pos.y = 0;
}
Bye
Uwe