nanogui: Font usage/setup


Previous by date: 22 Sep 2006 01:04:37 +0100 Re: GUI design tool for Nano-X?, Paul Long
Next by date: 22 Sep 2006 01:04:37 +0100 Re: GUI design tool for Nano-X?, Greg Haerr
Previous in thread: 22 Sep 2006 01:04:37 +0100 Re: Font usage/setup, Martin Kajdas
Next in thread:

Subject: Re: [nanogui] Font usage/setup
From: "Greg Haerr" ####@####.####
Date: 22 Sep 2006 01:04:37 +0100
Message-Id: <09f301c6ddda$af22f2b0$6401a8c0@winXP>

Hi Martin -

Here's your email solving the TTF (and PCF) font problems in
nano-X, last January.

I've finally figured the reason this isn't fixed in CVS is that I never
received (or at least, can't find or didn't find) a patch from
you for the NXLIB changes.  Can you please resend a patch against
the current CVS for NXLIB?  I'll then apply it and that will solve
Kiran's problems.

Also, if you could diff your font_pcf.c with my CVS version, I thought
I applied a fix there, but don't have any outstanding patches from you
on my system.

Regards,

Greg


----- Original Message ----- 
From: "Martin Kajdas" ####@####.####
To: "Greg Haerr" ####@####.#### ####@####.####
Sent: Tuesday, January 17, 2006 11:47 AM
Subject: RE: [nanogui] Font usage/setup


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


---------------------------------------------------------------------
To unsubscribe, e-mail: ####@####.####
For additional commands, e-mail: ####@####.####



Previous by date: 22 Sep 2006 01:04:37 +0100 Re: GUI design tool for Nano-X?, Paul Long
Next by date: 22 Sep 2006 01:04:37 +0100 Re: GUI design tool for Nano-X?, Greg Haerr
Previous in thread: 22 Sep 2006 01:04:37 +0100 Re: Font usage/setup, Martin Kajdas
Next in thread:


Powered by ezmlm-browse 0.20.