DSL Tips and Tricks :: customizing murgaLua



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.

Still have not been able to set font system wide for murgaLua scripts.
mikshaw, can you give an example to use, say, 7x14 ?

When I use the dynamic build of murgaLua, I don't seem to have "plastic" scheme?
According to the fonts.dir file (misc), 7x14 is -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1

Fl:set_font(0,"-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1")
Fl:set_font(1,"-misc-fixed-bold-r-normal--14-130-75-75-c-70-iso10646-1")

Keep in mind that the font will not scale if you specify an exact font rather than a font face, Fl:set_font(0,"fixed") for example.

I have no idea about the scheme...haven't used the dynamic build.

Thanks. Yes, it does work in 4.x. I should have tried that first. I was trying dsl v5.x with dynamic murgaLua. Still having issues there.
Next Page...
original here.