How to move a label in lemur?

look at this:

   // Create a simple container for our elements
    Container myWindow = new Container();
    app.getGuiNode().attachChild(myWindow);

    // Put it somewhere that we will see it.
    // Note: Lemur GUI elements grow down from the upper left corner.
    myWindow.setLocalTranslation(300, 300, 0);

    // Add some elements
    Label lb = new Label(p("این یک متن نمونه است"));
    lb.setLocalTranslation(0, 100, 0);
    lb.setFont(app.getAssetManager().loadFont("Interface/Fonts/yek-18.fnt"));
    lb.setName("lb");

    myWindow.addChild(lb);

    Button clickMe = myWindow.addChild(new Button("Click Me"));
    clickMe.addClickCommands(new Command<Button>() {
        @Override
        public void execute(Button source) {
            System.out.println("The world is yours.");
        }
    });
 
   lb.setLocalTranslation(0, 30, 0);

and my font have some problem I know it.
I really need to move label upper …
but lb.setLocalTranslation(0, 30, 0); not working :frowning:

As soon as you add the label to the container the container’s layout takes over its positioning. That’s what containers and layouts do. So the label likely IS positioned above the button but for some reason the text is drawn in a strange location. Lemur wouldn’t stick it down there.

I suspect if you put a regular font on it you will see that the label is actually in the right place. Not sure how to fix the actual issue, though. Even if the text had weird carriage returns in it then the label would be sized to contain it. So something strange is going on.

all right…
I fixed persian BitmapFontCreator probelms and now its created fonts can use in lemur gui too …

Lemur is not doing anything special with fonts. It’s using JME’s BitmapText just like everyone else.

The fonts before must have had something wrong with them for the glyphs to be positioned so far in the wrong direction.

1 Like