jME-TrueTypeFont Rendering Library

Hi @Tryder
Curious to know if jme-ttf supports right to left text wrapping?

Hi, @Tryder
I have one more question with TrueTypeBMP.

I notice that there are some differences between TrueTypeAWT and TrueTypeSfntly.
In TrueTypeAWT the atlas texture was disposed whenever atlas was resized.

https://github.com/ATryder/jME-TTF/blob/master/src/com/atr/jme/font/TrueTypeAWT.java#L202

but in TrueTypeSfntly it was not.

https://github.com/ATryder/jME-TTF/blob/master/src/com/atr/jme/font/TrueTypeSfntly.java#L275

If I donā€™t lock the atlas neither preload any text, this could happen.

First I use TrueTypeAWT to make a short String, then I use it to make a long enough String. This operation will force TrueTypeAWT to resize atlas, which mean the old atlas (already in use) will be killed.

This is my test case.

How about just create a maxResolution texture, and copy BufferedImage to Image with ImageRaster ?

Iā€™m trying to keep the Texture2D and reset Image.

Also provide an fixedResolution option in TrueTypeKeyBMP.

And use it to change behavior of TrueTypeBMP#resizeAtlas()

This can solve my problem.

Changes to the atlas texture can be handled through an AtlasListener. The notes section on the jME-TTF documentation page discuss this, jttf_notes

Example:

AtlasListener atlasListener = new AtlasListener() {
    @Override
    public void mod(AssetManager assetManager, int oldWidth, int oldHeight,
            int newWidth, int newHeight, TrueTypeBMP font) {
        //The atlas texture has been modified, update the texture on your text materials to the new atlas texture here.

        if (oldWidth != newWidth || oldHeight != newHeight)
            //Update your geometries here as the texture has been resized and the UV coordinates have changed. For example TrueTypeContainer.updateGeometry(); or TrueTypeNode.updateGeometry();
    }
}

((TrueTypeBMP)ttf).addAtlasListener(atlasListener); 

But if you prefer a max resolution feature youā€™re welcomed to make a pull request.

@Ali_RS , jME-TTF does not support support right to left directionality.

3 Likes

Adam:

  1. Iā€™m glad youā€™re still around to answer questions and give advice.
  2. Attempting to browse the documentation webpage gives me a 404 error.
  3. I use JME-TTF in my Maud application, so Iā€™d grateful if youā€™d upload the latest release to bintray.com

Yeah, turns out Iā€™m not so easy to get rid of :grinning_face_with_smiling_eyes:. I fixed the typo in the link, itā€™s jttf. Iā€™ll be starting my winter migration here soon and Iā€™m trying to work up an updated version of my TEdit Android app with some requested new features before I hit the road, but I should be able to squeeze out an updated jME-TTF to bintray in a couple of days.

3 Likes

Thanks for the corrected URL. Safe travels!

1 Like

Thanks for the well wishes. After some dark clouds rolled in I checked the forecast, looks like a solid week or so of rain so Iā€™m going to have to change that couple of days estimate to an indeterminant amount of time.

Hi, @Tryder

I have made a new pull request. Here is what I have done in this pr:

1. Make the project compatible to Maven and Gradle

  • Add build.gradle to the project.
  • Add pom.xml to the project
  • Move src to src/main/java

2. Add fixedResolution feature

3. Add some test cases with Ubuntu fonts

Please check my pr.

2 Likes

I havenā€™t forgotten about this by the way. Itā€™s been too cloudy to bootup my computer and that trend looks to continue for several more days then Iā€™ll spend the next week packing up our gear, loading up the bikes and hittinā€™ the road for winter migration. My girlfriend likes to leave on September 22nd because itā€™s the same day Bilbo and Frodo left on their journeys in The Hobbit and Lord of the Rings :grinning_face_with_smiling_eyes:. Recently picked up some sweet new shades for the trip :sunglasses: to boot. Anyway weā€™re only going about a hundred miles before taking a month long layover so Iā€™ll probably get a bunch of stuff done then.

3 Likes

groupId: com.atr
artifactId: jme-ttf
version: 2.2.1

2 Likes

Thereā€™s an issue with the POM at JCenter:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve com.atr:jme-ttf:2.2.1.
     Required by:
         project :
      > Could not resolve com.atr:jme-ttf:2.2.1.
         > Could not parse POM https://jcenter.bintray.com/com/atr/jme-ttf/2.2.1/jme-ttf-2.2.1.pom
            > Missing required attribute: dependency groupId

Looks like the error is in the final dependency:

    <dependency>
      <artifactId>android</artifactId>
      <scope>compile</scope>
    </dependency>

Should be good to go now. I built the pom file from the new gradle build script provided by Yan and the android dependency in the new build script isnā€™t actually available on jcenter, but was included in the pom file anyway so I removed it.

2 Likes

Confirmed good. Thank you!

1 Like

I received a PM asking for access to my Lemur Dynamo package and figured Iā€™d post an update here.

Many of the files I share on my website and elsewhere are stored on Google Drive using Share Links. Earlier this year I noticed that virtually all of those links stopped working. Well they worked, but instead of linking directly to the shared file on Google Drive people were instead taken to a Google Account login page where they had to login and request access to the files. Apparently, for some unknown reason, the access to all my linked files had been changed to private.

I donā€™t know when this happened as all the requests for access to various files were coming into my Google Mail account which I no longer use and I donā€™t typically go about checking the links I have on my website to make sure they still work because, you know, why wouldnā€™t they?

Anyway I recreated the share links and everything seems to be working last I checked, but now @icyboxs asks me, via PM here, for access to my Lemur Dynamo package stored on Google Drive. So I went and recreated the link which is now https://drive.google.com/file/d/0B6BscJ4Cq-K7ZUlJakxKZFRiTGs/view?usp=sharing&resourcekey=0-6SW8w8yRubusi3X2iICUNg, but it still doesnā€™t work. The link takes me to a page saying that the file is in violation of Googleā€™s ToS, although thereā€™s nothing indicating this when I login and look at the file in my Google Drive account.

Iā€™ll post an updated link here when I find somewhere else to upload the file.

P.S. My website is now hosted at https://www.inventati.org/1337gallery. The weebly address still works, but I donā€™t update the weebly site very often as itā€™s a bit of a pain.

3 Likes

Lemur dynamo on Dropbox: Dropbox - LemurDynamo-v1.02.zip - Simplify your life

Also updated the links on my website which pointed to an older version of jme-ttf: Dropbox - jME-TTF-2.2.2.zip - Simplify your life

1 Like