-
When I zoom in on the font I can see the black block behind it,Was that expected?
-
Lemur fonts use bitmap images and when I zoom in the fonts get fuzzy what’s the best way to fix it?
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package GUI;
import CameraAndMouse.CamAndMouseCur;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import static com.jme3.app.SimpleApplication.INPUT_MAPPING_EXIT;
import com.jme3.app.state.BaseAppState;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.input.InputManager;
import com.jme3.math.ColorRGBA;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Command;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.GuiGlobals;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.TextField;
import com.simsilica.lemur.style.BaseStyles;
import com.simsilica.lemur.style.Styles;
import java.util.logging.Logger;
/**
*
* @author Icyboxs
*/
public class UI extends BaseAppState{
private static Logger log =Logger.getLogger(UI.class.toString());
private InputManager inputManager;
private AssetManager assetManager;
private SimpleApplication simpleApp;
private BitmapFont font;
@Override
protected void initialize(Application aplctn) {
simpleApp = (SimpleApplication) aplctn;
assetManager = aplctn.getAssetManager();
inputManager = aplctn.getInputManager();
inputManager.deleteMapping(INPUT_MAPPING_EXIT);
GuiGlobals.initialize(simpleApp);
BaseStyles.loadGlassStyle();
GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");
font = assetManager.loadFont("Textures/font/yahei/test.fnt");
System.err.println(font.toString());
GuiGlobals.getInstance().getStyles().setDefault(font);
}
@Override
protected void cleanup(Application app) {
}
@Override
protected void onEnable() {
// Create a simple container for our elements
Container myWindow = new Container();
simpleApp.getGuiNode().attachChild(myWindow);
// Put it somewhere that we will see it.
// Note: Lemur GUI elements grow down from the upper left corner.
myWindow.setLocalTranslation(0, 1070, 0);
TextField textField = new TextField("这是一段测试文本");
textField.setFontSize(50f);
// Add some elements
Label label=new Label("Hello, World.");
label.setFont(font);
label.setFontSize(500f);
label.setColor(ColorRGBA.Blue);
myWindow.addChild(label);
myWindow.addChild(textField);
Button clickMe = myWindow.addChild(new Button("中文"));
clickMe.addClickCommands(new Command<Button>() {
@Override
public void execute(Button source) {
System.out.println("中文");
//simpleApp.stop();
}
});
}
@Override
protected void onDisable() {
}
}