News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

Post Reply  Post Thread 
Font handling improved in 0.6.8, but...
Author Message
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Smile  Font handling improved in 0.6.8, but...

Recently I started playing with using LUA_INIT to customize the look of murgaLua interfaces (sort of "themeing"). In short, if you have the environment variable LUA_INIT pointing to a lua script, the commands in that script will be run when murgaLua starts.

I noticed that with the release of 0.6.8, font handling has improved quite a bit, at least for X fonts in Linux. Thank you for this, John.

Previous versions would not properly set fonts from a LUA_INIT file using Fl:set_font(font_name,new_font)...I kept getting 'fixed' instead of the desired font. Now it works properly. But there are a couple of odd things that I can't understand.

Below is a post from the DSL forums, so I don't have to bother typing it again:

I tried this script to see what fonts are available:

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:

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.

04-26-2008 12:20 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Font handling improved in 0.6.8, but... - mikshaw - 04-26-2008 12:20 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: