nanogui: calling freetype2_drawtext with GR_TFTOP
Subject:
calling freetype2_drawtext with GR_TFTOP
From:
####@####.####
Date:
3 Sep 2004 02:43:41 +0100
Message-Id: <006901c49157$436c4d90$b61e17ac@MilkM>
I use Microwindows 0.90 on a RISC CPU. When I called GrText(wid, gc, 10, 80, "This is a test", -1, GR_TFASCII | GR_TFTOP) with freetype2 fonts, the string "This is a test" was drawed much higher than (10, 80). I think it is a bug of engine\font_freetype2.c.
Now I modified the 1184th line of engine\font_freetype2.c (in the functione freetype2_drawtext) as follows:
the original code:
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;
}
modified code:
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;
}
Regards,
Kao