[Solved] Compile error when building my project related to JME-TTF + LemurDynamo

Hi

here is where error happens : (happens when I clean/build my project)

    TrueTypeFont ttf = GuiGlobals.getInstance().loadFont("Interface/Fonts/Times.ttf", truetypefont.util.Style.Plain, 20, 0);`

I am getting this error :

Compiling 11 source files to /media/idea/01D0ABF282E1DD20/Java/jME_NB-PW-11-6-2015/TestGameCore/build/classes
/media/idea/01D0ABF282E1DD20/Java/jME_NB-PW-11-6-2015/TestGameCore/src/com/overthemoon/test/gamecore/all/appstate/TestAI.java:67: error: incompatible types: Style cannot be converted to int
        TrueTypeFont ttf = GuiGlobals.getInstance().loadFont("Interface/Fonts/Times.ttf", truetypefont.util.Style.Plain, 20, 0);
/media/idea/01D0ABF282E1DD20/Java/jME_NB-PW-11-6-2015/TestGameCore/src/com/overthemoon/test/gamecore/all/appstate/TestBiDirectionalText.java:51: error: incompatible types: Style cannot be converted to int
        TrueTypeFont ttf = GuiGlobals.getInstance().loadFont("Interface/Fonts/BNazanin.ttf", truetypefont.util.Style.Plain, 20, 0);
/media/idea/01D0ABF282E1DD20/Java/jME_NB-PW-11-6-2015/TestGameCore/src/com/overthemoon/test/gamecore/all/appstate/TestNotificationGUI.java:60: error: incompatible types: Style cannot be converted to int
        TrueTypeFont ttf = GuiGlobals.getInstance().loadFont("Interface/Fonts/Times.ttf", truetypefont.util.Style.Plain, 20, 0);
/media/idea/01D0ABF282E1DD20/Java/jME_NB-PW-11-6-2015/TestGameCore/src/com/overthemoon/test/gamecore/all/appstate/TestPathFinding.java:76: error: incompatible types: Style cannot be converted to int
        TrueTypeFont ttf = GuiGlobals.getInstance().loadFont("Interface/Fonts/Times.ttf", truetypefont.util.Style.Plain, 20, 0);

@Tryder can you please help me with this issue ?

info:
LemurDynamo-beta9
JME-TTF library 1.27
snfntly.jar
android-3.2.jar

Thanks

I just checked and this is not an issue for me. I’ve tested using NetBeans 8.1 and SDK 3.1.0-beta1_xbuf-SNAPSHOT. I have an Android project in the 3.1 SDK and using clean and build does not produce errors. I just put Beta10 up, give that a try, although it doesn’t actually change anything about loading fonts.

When running my app it runs ok error happens when i try to build my project (Note : It is not an Android project , just simple JME project)

I changed

TrueTypeFont ttf = GuiGlobals.getInstance().loadFont("Interface/Fonts/Times.ttf", truetypefont.util.Style.Plain, 20, 0);`

to

TrueTypeKey ttk = new TrueTypeKey("Interface/Fonts/Times.ttf",
                    truetypefont.util.Style.Plain, 40);
        TrueTypeFont ttf = (TrueTypeFont) this.app.getAssetManager().loadAsset(ttk);

and it solved problem.

My bad, I just assumed you were doing an Android project since you said you had android-3.2.jar and sfntly.jar included in your project. You only need the sfntly library for Android projects.

I did do clean and build when I tested it and didn’t have any troubles. I don’t know what IDE you’re using, once, not long ago, I had a problem in NetBeans where when building a project it was throwing a class not found error from an included library of mine and when looking at the library the class was clearly present. Eventually I shut down NetBeans, rebooted my computer, started up NetBeans and it worked without error…

1 Like