StaticTextFont - how to extend distance between characters

I am using egg-mkfont and StaticTextFont.
I can’t find method to change distance beetwen characters.
I can change setLineHeight(), setSpaceAdvance() but most interesting for me not this moment.

Seems that multiply PointLight from egg by ‘distance factor’ could be solution but I can’t do it in code.
Any hint how to resolve it?

Thanks in advance.

There’s nothing built-in to do this, but you could load the resulting egg file with the EggData interface, find all the PointLights and change them, then write it out to a new egg file and load that egg file as your font.


Thx for hint.
I can do it temporary that way but can you please confirm that I am thinking correctly.
Both eggs refer to the same textures, then loading two font eggs do not increase memory consumption twice.

Main problem is that I have to display many text boxes with the same font but different line height and character spacing.
Each text box should be adjustable on fly. Creating separate font for each textbox because of line_h or char_spacing change is not best choice.

I thing that the best solution would be extending options of TextProperties - not TextFont props itself to avoid creating copy for each

textbox with different line height or chars spacing.


That way we have one font and can manipulate font props for each textbox

Is it good idea?

If yes:
is it possible to extend official Panda with this feature
If yes:
I will try to do it myself


In the case of a static font (which is what you get when you load a font from an egg file), then all font files that reference the same texture do indeed share the same memory. So you could reasonably create a different font for each different character spacing, and it wouldn’t be outrageous.

However, it’s also reasonable to extend TextProperties as you suggest. I would suggest the name “setCharacterSpacing” instead of “setCharsSpacing” to be a little more consistent with existing non-abbreviated names.

Patches are welcome. :wink:


This moment I am rather ‘beggainer’ but when I collect enough power and time to compile Panda I will try to implement it and send a patch.