> -----Original Message----- > From: [EMAIL PROTECTED] > Sent: Fri, 13 Jun 2008 08:28:49 -0800 > To: [EMAIL PROTECTED], nanogui@linuxhacker.org > Subject: Re: [nanogui] TrueType not using specified background > >> -----Original Message----- >> From: [EMAIL PROTECTED] >> Sent: Thu, 12 Jun 2008 19:54:19 -0600 >> To: [EMAIL PROTECTED], nanogui@linuxhacker.org >> Subject: Re: [nanogui] TrueType not using specified background >> >>> Is their some design reason why truetype fonts do not use the >>> background >>> color specified in gc? >> The other bitmap fonts do use it but I'm not sure why not ttf fonts. >> >> Sounds like a bug, although interesting nobody has found it... try >> modifying >> the src/demo/nanox fontdemo?.c app that draws text around a circle, >> lets use a non-white background. Thinking about this I'll bet that >> all TTF drawing occurs without drawing any background... >> >> >>> Is this something the that needs to be done in nano-X devfonts code or >>> is >>> it something that I need to build into the freetype library? >> >> No, this would be done in the devfont.c code. There are two options: >> when the background is set to ON, then you can either clear the >> background with a GdFillRect first, then let the engine draw >> the glyph foreground bits only, or have the engine draw the glyph >> foreground and background bits. I suggest using the former; internal >> builtin fonts are displayed using the latter (its pretty slow drawing >> each bit, TTF uses a blit unlike builtin fonts) >> >> Since TTF allows text to be displayed at an angle, I'm betting that >> this is why its not implemented. The simple case would be to >> implement it only for non-angled text only. > > Hi Greg, > I added the lines to GdDrawAreaInternal since it appears that only > freetype2 uses this function: > > if (gr_usebg) > { > psd->FillRect(psd, x, y, x + width - 1, y + height - 1, > gr_background); > } > > This is a start with two problems: > The first problem here is that the bitmap is not fixed and only where the > fonts are drawn the background is drawn. > If I can use FillRect on the entire string length then I can clear the > area before writing the text. > This is not easy because the space character (0x20) is not written as a > blank space, it onlu advances the cursor. > Is their a way round this? > The other problem is I'll need to define a total height which would be > considering all the characters in the string. > Is their a method already implemented to do this?
Hi Greg, I think I'm almost their. I haven't determing how efficient this patch is yet but so far it seems the best way to do it. I've added this to freetype2_drawtext: freetype2_gettextsize(pfont, text, cc, flags, &fnt_w, &fnt_h, &fnt_b); if (gr_usebg) { psd->FillRect(psd, ax, ay-fnt_b-4, ax+fnt_w, ay+fnt_h-4, gr_background); } I'm trying to iron out some issues with TFTOP, TFBOTTOM & TFBASELINE. The above is for BASELINE and I think when it's done I'll have to add some condition statements to take care of the others. Any comments? Regards,. Jr. > Thanks, > Jr. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] ____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop! Check it out at http://www.inbox.com/marineaquarium --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]