nanogui: Thread: Freetype2 position Y problem


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Freetype2 position Y problem
From: Teemu Keskinarkaus ####@####.####
Date: 29 Dec 2006 11:23:13 +0000
Message-Id: <FB4B49604ADFD949A9F32F2D8E6C4D470197DE94@alban.ccs.local>

Hi,

 

I recently posted here about problem with TTF fonts. That was solved, but
then I had new problem that the fonts were too high.

 

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 get the text
where I want them to be. Except that now I'm using fixed value for baseline
so it works only for one font. With some other font it might be wrong so I
need to calculate the baseline for each fonts or save that value in
font-struct.

 

I'm using NanoX version 0.91. Is this known bug or am I just using some
fonts that are different that NanoX was tested? Same problems occurs on
multiple fonts so it's not one font's problem. There are no problems with
'built-in' fonts.

 

Teemu Keskinarkaus

CC-Systems

 

Subject: Re: [nanogui] Freetype2 position Y problem
From: "Uwe Klatt" ####@####.####
Date: 29 Dec 2006 13:24:30 +0000
Message-Id: <01a501c72b4c$a1cc5420$081710ac@arnstein.miwe.de>

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

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

Subject: Re: [nanogui] Freetype2 position Y problem
From: "max xiayi" ####@####.####
Date: 26 Oct 2007 14:12:46 +0100
Message-Id: <afda14700710260612j19e778bdnfabe65c93018bdef@mail.gmail.com>

Hi Teemu Keskinarkaus,
I also found these problem, I need to figure out the basest line for a line
of text, I think things should not be like that.  Only us two complain this
problem, what's the wrong thing we have done? Anybody know?

Max


2007/1/2, Teemu Keskinarkaus ####@####.####
>
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>
>
Subject: Re: [nanogui] Freetype2 position Y problem
From: "Greg Haerr" ####@####.####
Date: 27 Oct 2007 05:04:25 +0100
Message-Id: <003001c8184e$700e4c00$6401a8c0@winXP>

I have fixed various issues with freetype 1 and 2, including
the y position problem.  The fixes are in the nano-X CVS,
or the microwindows-src-snapshot.tar.gz on the website.

Regards,

Greg



: I also found these problem, I need to figure out the basest line for a 
line
: of text, I think things should not be like that.  Only us two complain 
this
: problem, what's the wrong thing we have done? Anybody know?
:
: Max
:
:
: 2007/1/2, Teemu Keskinarkaus ####@####.####
: >
: > 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
: >
: >
: > ---------------------------------------------------------------------
: > To unsubscribe, e-mail: ####@####.####
: > For additional commands, e-mail: ####@####.####
: >
: >
: 

Subject: Re: [nanogui] Freetype2 position Y problem
From: Christian Boon ####@####.####
Date: 29 Oct 2007 08:20:22 +0000
Message-Id: <47259795.5020505@praxis-automation.nl>

Greg Haerr wrote:
> I have fixed various issues with freetype 1 and 2, including
> the y position problem.  The fixes are in the nano-X CVS,
> or the microwindows-src-snapshot.tar.gz on the website.
>   
Are they in  the snapshot of 8 sept because i don't see a newer snapsnot?

Chris

[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.