mikshaw
Group: Members
Posts: 4856
Joined: July 2004 |
|
Posted: April 25 2008,13:06 |
|
Found a very odd thing while running some tests. I'll need to ask JohnMurga if he knows anything about it...
I tried this script to see what fonts are available:
Code Sample | numfonts=Fl:set_fonts() for i=0,numfonts do print(Fl:get_font_name(i)) end |
Every font that had been set in LUA_INIT printed what appears to be garbage. After fooling around a little more I found that using the command Fl:get_font_name(0) in LUA_INIT would cause FL_HELVETICA to print the appropriate name of the font I had set.
However, if I moved that command from LUA_INIT to the script, it didn't work anymore.
So apparently, in order for scripts to retrieve the appropriate font name, you must retrieve in within LUA_INIT, after the font has been set:
Code Sample | Fl:set_font(4,"terminus") Fl:set_font(0,"smooth") for i=0,15 do Fl:get_font_name(i) end |
I did it for all 16 fonts in one go just so I don't have to bother with it again in the future.
A couple more notes: Regardless of the above issue, murgaLua 0.6.8 now handles X font names much better than it did before. In the fonts-system demo in the murgaLua demos package the X font names would be rather messy (-*-fixed-medium-r-normal--*, for example). Now it simply uses the name "fixed". If you attempt to use "-*-terminus-*" now, instead of just "terminus", the result can be a bit unpredictable.
Also, murgaLua *tries* to apply bold/italic using the same custom font, apparently, but if you don't have bold/normal versions of that font installed you also get unpredictible results. It seems that FLTK just picks something that it thinks resembles what you want.
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|