nanogui: Thread: Font usage/setup


[<<] [<] Page 2 of 3 [>] [>>]
Subject: RE: [nanogui] Font usage/setup
From: "Martin Kajdas" ####@####.####
Date: 10 Jan 2006 20:59:51 +0000
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC229149C@mkmail.MKPROD.COM>

I believe that the nxlib-0.45, specifically XLoadFont() in LoadFont.c will not work with truetype fonts.
It does the straight font name comparison in _nxFindX11Font(), but it should do something similar (parsing font names) to ListFonts.c and use requested font size in GrCreateFont() call.

Am I confusing something?
Did anyone make freetype 1.3.1 work with nxlib and nano-X (using FLTK and X11 calls)?
My program works perfectly well with X11.
Martin


-----Original Message-----
From: Martin Kajdas 
Sent: Tuesday, January 10, 2006 9:23 AM
To: Greg Haerr; ####@####.####
Subject: RE: [nanogui] Font usage/setup


I enabled debug mode to see what is going on and the problem became obvious.

The nano-X server (actually nxlib in LoadFont.c) searches for:
'-adobe-helvetica-medium-r-normal--12-0-0-0-p-0-iso8859-1'
which my application requires and the truetype font available is described as:
'-adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1'

They do not match and the server does not find the font correctly.
The only difference is in the font size (the app wants size 12).
However, this being the truetype font, does not specify size (equals to 0).

How can I tell/configure the server/nxlib to match these properly?
Martin


-----Original Message-----
From: Martin Kajdas ####@####.####
Sent: Monday, January 09, 2006 4:00 PM
To: Greg Haerr; ####@####.####
Subject: RE: [nanogui] Font usage/setup


Another problem: truetype fonts.
I have the fonts working and I can see the truetype fonts in the list of fonts (with my application on my target system), but I cannot make them work.
The other ones work fine.

I compiled nano-X with HAVE_FREETYPE_SUPPORT enabled and linked with freetype 1.3.1 library.
I added the font files to the fonts directory and added them to the fonts.dir file.
- is there anything else that needs to be done to get them working?
- does nxlib-0.45 support truetype fonts?
- anything else I need to know?

Regards,
Martin
Subject: Re: [nanogui] Font usage/setup
From: "Greg Haerr" ####@####.####
Date: 11 Jan 2006 00:43:48 +0000
Message-Id: <0bfd01c61647$5287fa10$0300a8c0@RDP>

> The nano-X server (actually nxlib in LoadFont.c) searches for:
'-adobe-helvetica-medium-r-normal--12-0-0-0-p-0-iso8859-1'
which my application requires and the truetype font available is described
as:
'-adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1'

> They do not match and the server does not find the font correctly.
The only difference is in the font size (the app wants size 12).
However, this being the truetype font, does not specify size (equals to 0).

Looks like the second line above should be changed to:
'-adobe-helvetica-medium-r-normal--*-0-0-0-p-0-iso8859-1'.
The _nxFindX11Font() should match the pattern here, and
at least get the font.  However, code will have to be written to
substitute the requested font size into the GrCreateFont().

A quick thought suggests the way to do this would be:
1. Change the pattern matcher to remember a *-matched field.
2. If the text size matched was originally '0', substitute
the passed value ('12'), instead in GrCreateFont().

It appears we've never supported truetype fonts in NXLIB.
Actually, I think the behaviour changed when I changed
the default height param of GrCreateFont() to be 0,
rather than a hard-coded 12 that used to be there.  Thus,
non-truetype started working properly, and truetype fails,
because we never parsed the requested size (always used 12
instead).

Regards,

Greg


Subject: RE: [nanogui] Font usage/setup
From: "Martin Kajdas" ####@####.####
Date: 12 Jan 2006 16:16:50 +0000
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC229149D@mkmail.MKPROD.COM>

I already tried substituting -0- size parameter to -*- but that caused other problems:
- a font list showed only true type fonts and skipped the fixed ones with the same name,
- I still could not get the fonts to open

But I agree with your conclusion (that was the reason for my emails in the first place) that the true type fonts do not work with nxlib.
I also came to the similar conclusion about the fix for it.
I will modify _nxFindX11Font() to match -0- size to any size requested (1-63) and send the requested size to GrCreateFont().
This fix (if works) will be specific to my application and may not be generic enough for others but at least it will be documented here and will give some direction.

By the way, the -0- size specification comes directly from my Linux X11 fonts.dir file from my development system where my application works correctly with X11 server (instead of nano-X + nxlib on my target system)
Martin



-----Original Message-----
From: Greg Haerr ####@####.####
Sent: Tuesday, January 10, 2006 4:38 PM
To: Martin Kajdas; ####@####.####
Subject: Re: [nanogui] Font usage/setup


> The nano-X server (actually nxlib in LoadFont.c) searches for:
'-adobe-helvetica-medium-r-normal--12-0-0-0-p-0-iso8859-1'
which my application requires and the truetype font available is described
as:
'-adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1'

> They do not match and the server does not find the font correctly.
The only difference is in the font size (the app wants size 12).
However, this being the truetype font, does not specify size (equals to 0).

Looks like the second line above should be changed to:
'-adobe-helvetica-medium-r-normal--*-0-0-0-p-0-iso8859-1'.
The _nxFindX11Font() should match the pattern here, and
at least get the font.  However, code will have to be written to
substitute the requested font size into the GrCreateFont().

A quick thought suggests the way to do this would be:
1. Change the pattern matcher to remember a *-matched field.
2. If the text size matched was originally '0', substitute
the passed value ('12'), instead in GrCreateFont().

It appears we've never supported truetype fonts in NXLIB.
Actually, I think the behaviour changed when I changed
the default height param of GrCreateFont() to be 0,
rather than a hard-coded 12 that used to be there.  Thus,
non-truetype started working properly, and truetype fails,
because we never parsed the requested size (always used 12
instead).

Regards,

Greg


Subject: RE: [nanogui] Font usage/setup
From: "Martin Kajdas" ####@####.####
Date: 12 Jan 2006 18:34:34 +0000
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC229149E@mkmail.MKPROD.COM>

Well, it is almost working.
I modified _nxFindX11Font() to parse the font names correctly and fixed the call to GrCreateFont() with the proper size, but I still could not see the fonts.
Then by accident, I marked some text where it should have been and the right text appeared in the right font (with blue background of course).

This means that it works except the color is wrong.
Because I display my strings on different backgrounds, it makes me think that the font color is set to 'transparent' color instead of requested font color.
Any ideas where to fix that?

Martin



-----Original Message-----
From: Martin Kajdas 
Sent: Thursday, January 12, 2006 8:16 AM
To: 'Greg Haerr'; ####@####.####
Subject: RE: [nanogui] Font usage/setup


I already tried substituting -0- size parameter to -*- but that caused other problems:
- a font list showed only true type fonts and skipped the fixed ones with the same name,
- I still could not get the fonts to open

But I agree with your conclusion (that was the reason for my emails in the first place) that the true type fonts do not work with nxlib.
I also came to the similar conclusion about the fix for it.
I will modify _nxFindX11Font() to match -0- size to any size requested (1-63) and send the requested size to GrCreateFont().
This fix (if works) will be specific to my application and may not be generic enough for others but at least it will be documented here and will give some direction.

By the way, the -0- size specification comes directly from my Linux X11 fonts.dir file from my development system where my application works correctly with X11 server (instead of nano-X + nxlib on my target system)
Martin



-----Original Message-----
From: Greg Haerr ####@####.####
Sent: Tuesday, January 10, 2006 4:38 PM
To: Martin Kajdas; ####@####.####
Subject: Re: [nanogui] Font usage/setup


> The nano-X server (actually nxlib in LoadFont.c) searches for:
'-adobe-helvetica-medium-r-normal--12-0-0-0-p-0-iso8859-1'
which my application requires and the truetype font available is described
as:
'-adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1'

> They do not match and the server does not find the font correctly.
The only difference is in the font size (the app wants size 12).
However, this being the truetype font, does not specify size (equals to 0).

Looks like the second line above should be changed to:
'-adobe-helvetica-medium-r-normal--*-0-0-0-p-0-iso8859-1'.
The _nxFindX11Font() should match the pattern here, and
at least get the font.  However, code will have to be written to
substitute the requested font size into the GrCreateFont().

A quick thought suggests the way to do this would be:
1. Change the pattern matcher to remember a *-matched field.
2. If the text size matched was originally '0', substitute
the passed value ('12'), instead in GrCreateFont().

It appears we've never supported truetype fonts in NXLIB.
Actually, I think the behaviour changed when I changed
the default height param of GrCreateFont() to be 0,
rather than a hard-coded 12 that used to be there.  Thus,
non-truetype started working properly, and truetype fails,
because we never parsed the requested size (always used 12
instead).

Regards,

Greg


Subject: RE: [nanogui] Font usage/setup
From: "Martin Kajdas" ####@####.####
Date: 12 Jan 2006 23:05:48 +0000
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC229149F@mkmail.MKPROD.COM>

One more clue:
it does not like foreground color=0 (background color is also 0 (actually 0xFFFF0000) but it is ignored; transparent).
The color=0 should print black and it works correctly with fixed fonts on nano-X and on X11 (all fonts).

When I forced the foreground color (in Text.c of nxlib) to be something else it displayed correctly.
It must be a bug in nxlib, but where?

Martin



-----Original Message-----
From: Martin Kajdas 
Sent: Thursday, January 12, 2006 10:34 AM
To: 'Greg Haerr'; ####@####.####
Subject: RE: [nanogui] Font usage/setup


Well, it is almost working.
I modified _nxFindX11Font() to parse the font names correctly and fixed the call to GrCreateFont() with the proper size, but I still could not see the fonts.
Then by accident, I marked some text where it should have been and the right text appeared in the right font (with blue background of course).

This means that it works except the color is wrong.
Because I display my strings on different backgrounds, it makes me think that the font color is set to 'transparent' color instead of requested font color.
Any ideas where to fix that?

Martin



-----Original Message-----
From: Martin Kajdas 
Sent: Thursday, January 12, 2006 8:16 AM
To: 'Greg Haerr'; ####@####.####
Subject: RE: [nanogui] Font usage/setup


I already tried substituting -0- size parameter to -*- but that caused other problems:
- a font list showed only true type fonts and skipped the fixed ones with the same name,
- I still could not get the fonts to open

But I agree with your conclusion (that was the reason for my emails in the first place) that the true type fonts do not work with nxlib.
I also came to the similar conclusion about the fix for it.
I will modify _nxFindX11Font() to match -0- size to any size requested (1-63) and send the requested size to GrCreateFont().
This fix (if works) will be specific to my application and may not be generic enough for others but at least it will be documented here and will give some direction.

By the way, the -0- size specification comes directly from my Linux X11 fonts.dir file from my development system where my application works correctly with X11 server (instead of nano-X + nxlib on my target system)
Martin



-----Original Message-----
From: Greg Haerr ####@####.####
Sent: Tuesday, January 10, 2006 4:38 PM
To: Martin Kajdas; ####@####.####
Subject: Re: [nanogui] Font usage/setup


> The nano-X server (actually nxlib in LoadFont.c) searches for:
'-adobe-helvetica-medium-r-normal--12-0-0-0-p-0-iso8859-1'
which my application requires and the truetype font available is described
as:
'-adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1'

> They do not match and the server does not find the font correctly.
The only difference is in the font size (the app wants size 12).
However, this being the truetype font, does not specify size (equals to 0).

Looks like the second line above should be changed to:
'-adobe-helvetica-medium-r-normal--*-0-0-0-p-0-iso8859-1'.
The _nxFindX11Font() should match the pattern here, and
at least get the font.  However, code will have to be written to
substitute the requested font size into the GrCreateFont().

A quick thought suggests the way to do this would be:
1. Change the pattern matcher to remember a *-matched field.
2. If the text size matched was originally '0', substitute
the passed value ('12'), instead in GrCreateFont().

It appears we've never supported truetype fonts in NXLIB.
Actually, I think the behaviour changed when I changed
the default height param of GrCreateFont() to be 0,
rather than a hard-coded 12 that used to be there.  Thus,
non-truetype started working properly, and truetype fails,
because we never parsed the requested size (always used 12
instead).

Regards,

Greg


Subject: Re: [nanogui] Font usage/setup
From: "Greg Haerr" ####@####.####
Date: 12 Jan 2006 23:19:58 +0000
Message-Id: <108801c617ce$9f6b77c0$0300a8c0@RDP>

> it does not like foreground color=0 (background color is also 0 (actually
0xFFFF0000) but it is ignored; transparent).
The color=0 should print black and it works correctly with fixed fonts on
nano-X and on X11 (all fonts).

> When I forced the foreground color (in Text.c of nxlib) to be something
else it displayed correctly.
It must be a bug in nxlib, but where?

What version of Microwindows are you running, 0.90?  There
is a bug in all but CVS (possibly 0.91) where transparent
colors aren't handled properly.  The bottom line is that with
images, when the image bits were all 1's, nano-X thought
this was the same as -1, and then didn't draw the color.  usually
this was for white (all 1s).  however, for certain reasons NXLIB
inverts the fg and bg and thus this could occur for the bg color.

Is there a way you can run the CVS version of Microwindows
to test this?

Regards,

Greg


Subject: Re: [nanogui] Font usage/setup
From: "Greg Haerr" ####@####.####
Date: 12 Jan 2006 23:23:28 +0000
Message-Id: <10a601c617ce$ee1911c0$0300a8c0@RDP>

> By the way, the -0- size specification comes directly from my Linux X11
fonts.dir file from my development system where my application works
correctly with X11 server (instead of nano-X + nxlib on my target system)
Martin

That's not surprising: we wrote only the minimal font code to
emulate X11 in NXLIB, and obviously, not enough yet!

We want to keep fonts.dir compatibility with X11 of course.

Regards,

Greg


Subject: RE: [nanogui] Font usage/setup
From: "Martin Kajdas" ####@####.####
Date: 12 Jan 2006 23:23:32 +0000
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914A0@mkmail.MKPROD.COM>

I am running the latest CVS (0.92) from couple of days ago.
I believe the problem is in nxlib and I am running 0.45
Martin

-----Original Message-----
From: Greg Haerr ####@####.####
Sent: Thursday, January 12, 2006 3:19 PM
To: Martin Kajdas; ####@####.####
Subject: Re: [nanogui] Font usage/setup


> it does not like foreground color=0 (background color is also 0 (actually
0xFFFF0000) but it is ignored; transparent).
The color=0 should print black and it works correctly with fixed fonts on
nano-X and on X11 (all fonts).

> When I forced the foreground color (in Text.c of nxlib) to be something
else it displayed correctly.
It must be a bug in nxlib, but where?

What version of Microwindows are you running, 0.90?  There
is a bug in all but CVS (possibly 0.91) where transparent
colors aren't handled properly.  The bottom line is that with
images, when the image bits were all 1's, nano-X thought
this was the same as -1, and then didn't draw the color.  usually
this was for white (all 1s).  however, for certain reasons NXLIB
inverts the fg and bg and thus this could occur for the bg color.

Is there a way you can run the CVS version of Microwindows
to test this?

Regards,

Greg


Subject: Re: [nanogui] Font usage/setup
From: "Greg Haerr" ####@####.####
Date: 12 Jan 2006 23:28:47 +0000
Message-Id: <10b601c617cf$4fe2f1a0$0300a8c0@RDP>

> Because I display my strings on different backgrounds, it makes me think
that the font color is set to 'transparent' color instead of requested font
color.
Any ideas where to fix that?

Like I said in the previous email, this may very well be the
transparent color bug in 0.90 nano-X.

A horrible hack could be (at least for testing) to change the
define of TRANSCOLOR (I think that's right), to something
other than -1....  like perhaps -3, or some hex pattern unlikely
to be used as a bit pattern color on your display.

Regards,

Greg

Subject: Re: [nanogui] Font usage/setup
From: "Greg Haerr" ####@####.####
Date: 13 Jan 2006 00:02:34 +0000
Message-Id: <01c301c617d4$864b1150$6401a8c0@winXP>

> it does not like foreground color=0 (background color is also 0 (actually
0xFFFF0000) but it is ignored; transparent).
The color=0 should print black and it works correctly with fixed fonts on
nano-X and on X11 (all fonts).

Hmmm..  0xFFFF0000 isn't 0, are hw color format are you running, RGB or 565?
I'm confused by these values.


> When I forced the foreground color (in Text.c of nxlib) to be something
else it displayed correctly.
It must be a bug in nxlib, but where?

Since you're running CVS, it isn't the transparent color bug then, since
that's
known fixed.  Look for usage of GrSetGCUseBackground, that should probably
always be set to TRUE.

Does this happen only with TTF fonts, and not with fixed?  Always works
on X11 but not on your target?

Regards,

Greg

[<<] [<] Page 2 of 3 [>] [>>]


Powered by ezmlm-browse 0.20.