nanogui: Font usage/setup


Previous by date: 17 Jan 2006 17:47:26 +0000 NOFONTSORCLIPPING, Manav Kataria
Next by date: 17 Jan 2006 17:47:26 +0000 Re: Font usage/setup, Peter Barada
Previous in thread: 17 Jan 2006 17:47:26 +0000 Re: Font usage/setup, Greg Haerr
Next in thread: 17 Jan 2006 17:47:26 +0000 Re: Font usage/setup, Peter Barada

Subject: RE: [nanogui] Font usage/setup
From: "Martin Kajdas" ####@####.####
Date: 17 Jan 2006 17:47:26 +0000
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914A4@mkmail.MKPROD.COM>

I got my fonts working and I would like to summarize my findings/fixes for others to use.
Because, my application is FLTK based and uses nxlib to communicate with nano-X, many problems are mostly nxlib based and FLTK + X11 specific and will not show up with other applications.
That is why I tried to put my fixes into nxlib when possible instead of nano-X so not to break other people's code which is working.

Summary of what I found:

1. font_pcf.c in nano-X (engine) needs to be updated with patched file from microwindows web site which is still not included in CVS. This was necessary in order to use X11 fonts without GrCreateFont() hanging up.

2. font_freetype.c and font_t1lib.c in nano-X (engine) need to be fixed to work properly with gr_foreground == gr_background. The recommended fix (commented out) will not work as block outlines of letters are only printed. The background color must stay transparent and it does not with the fix.

3. Text.c in nxlib (XDrawString()) I modified to check foreground and background colors of the string and if they are the same, I increase the foreground color by 1. I did it here instead of modifying font_freetype.c and font_t1lib.c in nano-X.

4. LoadFont.c in nxlib needs to be fixed (_nxFindX11Font()) to properly match TTF font names (i.e. ...12-0-0...==...0-0-0... and size=12) and call GrCreateFont() with proper font size.

Once, the fonts are properly created, the main problem is with nano-X's Area draw function.
When foreground==background color, it is assumed that the background is already drawn and the foreground need not be.
This is a problem when the background is transparent and is not drawn and so is the foreground, resulting in nothing being drawn.
The nano-X's drawing algorithm needs to be fixed so this case is handled properly.
I will get into this next because I am having some problems with some images not being drawn (which I believe it is related to this) but I will start a separate email thread.

Martin



-----Original Message-----
From: Greg Haerr ####@####.####
Sent: Monday, January 16, 2006 9:13 AM
To: Martin Kajdas; ####@####.####
Subject: Re: [nanogui] Font usage/setup


> I checked the font_freetype.c code and there (line 352) is a statement:
FIXME: GdArea problem if fg == bg
This certainly would qualify when they are both zero.
I guess the magic is not really when foreground==0 but when
foreground==background (which I never tried other than zero).

The if statement is there to optimize and not draw anything if the
fg and bg colors are the same.  The bg was already drawn earlier,
so there wouldn't be any need to draw the fg color.

Start by commenting out the if statement, just leaving the GdArea call.
Let me know if that makes things work.

Regards,

Greg


Previous by date: 17 Jan 2006 17:47:26 +0000 NOFONTSORCLIPPING, Manav Kataria
Next by date: 17 Jan 2006 17:47:26 +0000 Re: Font usage/setup, Peter Barada
Previous in thread: 17 Jan 2006 17:47:26 +0000 Re: Font usage/setup, Greg Haerr
Next in thread: 17 Jan 2006 17:47:26 +0000 Re: Font usage/setup, Peter Barada


Powered by ezmlm-browse 0.20.