Variable sized fonts

Hello everyone, first post from me, so first off thanks for jME!



Currently font rendering is fixed to 10 pixel wide characters. I would propose that the Text object keep a list of character widths, such as the ones produced by the font building tool by LMNOpc. (I would also propose that the display list be built based on the text rather than one for each character, but this is less important).



The thing that makes me most nervous, however, is that the text object relies on the creator of the scene graph to ensure that the correct font texture is applied. This seems to me to be error prone. (because I think that the widths & the font texture should be logically grouped somehow)



Hint: As a general point of reference, I would recommend having a look at OpenSceneGraph (www.openscenegraph.org). It is a solidly tested, well designed scene graph.



Some of the nice features of osg (OpenSceneGraph) are:

  • automatically sets the near & far clipping planes (which maximises the z buffer resolution)
  • uses state sets (which are a combination of all applicable states), which are easily compared.
  • supports all opengl states (including things like point size etc)
  • allows arbitrary number of bins
  • bins are collected into a renderstage, allowing multi-pass rendering





    anyway, i’m about to modify the way text works, so let me know if you want the code.

The widget classes have a text class that has more functions then the other two. It may do what you want, but I am not shoure.

Thanks for the tip.



I just had a look and the widget text classes do support variable sized fonts. I think I will still stick with my implementation though - my system will make use of the VBO etc, whereas the text widget does its own custom drawing.



I’ll post more code as I improve it.

It would be better to get that functionality into the Text object or something similar as the old Widget package will be dropped in the future in any case.

"renanse" wrote:
It would be better to get that functionality into the Text object or something similar as the old Widget package will be dropped in the future in any case.
mojo seams to disagree.

No, in that thread he’s talking about Guurk’s gui stuff which is different from the OLD widget gui stuff.

Guruk’s GUI is under com.jme.ui while the OLD GUI is under com.jme.widget



However, I dont think that the com.jme.widget library should be removed until the com.jme.ui GUI package reaches the functionality of the widget library.



But thats another argument for another day.



DP

://