nanogui: TrueType not using specified background


Previous by date: 13 Jun 2008 16:28:59 -0000 DoubleBuffering, mohanreddy.b
Next by date: 13 Jun 2008 16:28:59 -0000 Re: DoubleBuffering, Junior
Previous in thread: 13 Jun 2008 16:28:59 -0000 Re: TrueType not using specified background, Greg Haerr
Next in thread: 13 Jun 2008 16:28:59 -0000 Re: TrueType not using specified background, Junior

Subject: Re: [nanogui] TrueType not using specified background
From: Junior ####@####.####
Date: 13 Jun 2008 16:28:59 -0000
Message-Id: <B46A3653B34.0000028Fejr@inbox.com>

> -----Original Message-----
> From: ####@####.####
> Sent: Thu, 12 Jun 2008 19:54:19 -0600
> To: ####@####.#### ####@####.####
> 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?

Thanks,
Jr.

Previous by date: 13 Jun 2008 16:28:59 -0000 DoubleBuffering, mohanreddy.b
Next by date: 13 Jun 2008 16:28:59 -0000 Re: DoubleBuffering, Junior
Previous in thread: 13 Jun 2008 16:28:59 -0000 Re: TrueType not using specified background, Greg Haerr
Next in thread: 13 Jun 2008 16:28:59 -0000 Re: TrueType not using specified background, Junior


Powered by ezmlm-browse 0.20.