I’m not picking on your solution. I’m just trying to understand why… your explanation is pretty good.
The thing is that the existing bitmap text sucks pretty badly. I want to move some functionality into the BitmapFont because it bugs me that there are two different loops that calculate where letters should be and they are both very different. If you fix a bug in one place then you have to fix it again a completely different way somewhere else. For example, if we want to fix the padding problem (which gets me with some of my Mythruna fonts) then we will have to change two places and the changes won’t be the same.
To me, BitmapFont should provide some kind of glyph iterator that can be used to calculate size or create letter quads, etc…
The letter quad linked list is kind of also not great… I don’t see a reason for it and it makes the code a lot more complicated.
It could be that as part of these other refactorings that we centralize other things that different font implementations might want. BitmapText could become an implementation of a new Text interface that has the common set/getText/alpha/color, etc… on it. Then we could have another implementation for TTF one for distance fields, etc… Using or not using the other shared classes as required.
The only thing that has stopped me in the past is how fragile this code is and how few test cases we have. If we could develop a small suite of some really good font test cases, maybe with side-by-side views of the way swing would render the real font with the way JME is rendering it, different alignments, etc… then 1) we could see all of the current bugs (which there definitely are some), and 2) it would be really easy to write a new jme.font package that shed itself of all of the old code.
(Another pet peeve is that fonts don’t use j3m materials so if you want to fix alpha masking or any of that you have to perform traversal surgery on the font.)
Anyway, it would be nice to have a code base that is easier to maintain because the current jme.font package is nearly impossible. I think I’m the only one that has ever managed to make a change there without breaking five other things… and I’m not patting myself on the back because I broke things plenty of times also. It’s super-fragile.