jME-TrueTypeFont Rendering Library

Okay, actually I just went and replaced the vecmath stuff, wasn’t hard. Wasn’t much to replace, but I’m not too familiar with what this algorithm is supposed to do, so… I guess it’s working? (I didn’t bother to test what it looks like when using javax.vecmath, but honestly there wasn’t anything complex to replace - only 3 classes needed.)

If that doesn’t look obviously screwed up, I could put a fork on Github, or just post replacement classes here if that helps at all.

1 Like

That’s what it should look like yes.

1 Like

Well, hopefully this fixes any potential license issues and more importantly, works for this TTF lib…

1 Like

How complex would it be to replace a BitmapText class by this implementation?

@louhy Thanks for doing that for me, I will get started swapping out the old library with this new one. I’ll need to make a few minor changes to jmescher, namely because it doesn’t, out of the box, provide a means to keep track of the constraint edges and I’ll need to be able to do that. In addition I’ll re-combine jME-TrueTypeFont and jME-TrueType3d into one library and clean up the code a bit, I never really finished jME-TrueType3d since there wasn’t a whole lot of interest in it given the GPL issue.

@n3cr0 I don’t know if it would be such a good idea to ‘replace’ BitmapText with this library. This library would be a good supplement I think, but ultimately I think there are still plenty of cases where BitmapText would be useful.

2 Likes

I mean can i use this to make a floating text in the air to replace the bitmap text with billboard and on the GuiNode. With the actual Bitmap text i would need to make a better quality bitmap text if i want a nice render in 4k resolution sadly.

Yeah you can do that with this and I don’t think it’s particularly complicated to replace BitmapText in your project with jME-TrueTypeFont text.

I’m re-writing a few things so there might be a few changes that would effect code that works with this library so you might want to hold off until I release the new library, shouldn’t be long. Otherwise when I release the new library I’ll keep the old libraries available for those that don’t want to go about re-writing some of their code.

Yeah I figured it might not be a simple drop-in replacement for a reason like that, but that’s a great update. Let us know if we can help out with anything.

Thanks tebriel, I should be able to get this all taken care of though. Right now I’m cleaning up the project so that things are more organized and updating a few things with new features. I updated the getText methods so, similar to the getFormattedText methods, you can supply vertical and horizontal alignments. Obviously you’ll still want to use getFormattedText if you want to constrain your text for word wrapping and clipping, but if you’re just putting some un-constrained text in the scene now you can add line-breaks and basic formatting.

Still just texture atlas text, haven’t done anything with mesh text yet, but it should support all the same methods.

4 Likes

Nice then i should be waiting for the future version :slight_smile:
Thank you for working on this, it as been a huge problem for me.

This is a great project. I personally don’t need much text right now, but I clearly see limitations of basic text tools implemented in JME, and can recognize amount of effort you’ve put in yours. Thank you!

1 Like

Thanks @n3cr0 and @Torsion

Showing signs of life:

6 Likes

Is it rendered in it own thread?

If you mean the triangulation, no it is not, although you could start your own thread and cache up the characters there. When a character is requested it is triangulated and then the resulting mesh is cached for later use so it doesn’t need to be triangulated again. Generally I would recommend pre-caching whatever characters you want to use during a loading sequence by using the getGlyphs method, this will triangulate and cache whatever characters are requested.

1 Like

oh yea thats true,

This library should seriously end up in the core IMHO. Bitmaps are very annoying to work with.

Almost there:

2 Likes

This is looking great, thanks for all the work on this.

My pleasure tebriel. Fixing up a few nuances here and there.

I’ve decided to stick with Sfntly for this so it should be compatible with Android.

3 Likes

Got the shader based anti-aliasing working on straight edges now.

In the original paper I read on this they kept a transparent border around the glyph and split each triangle down the middle, cutting an edge through the middle of each triangle splitting each triangle into one new triangle and one new quad tripling the amount of geometry. I came up with a different solution that doesn’t involve splitting the triangles or keeping the border triangles. :slight_smile:

10 Likes