Closed buivanlan closed 3 years ago
Hi! Can you add more details about?
If you have copied the font manually into asset folder then hyperlap can't recognize it until you explicit tells to load into ResourceManager
Hi @fgnm
The first thing I did was: copy the font to my project(asset/freetypefonts/Bodoni MT.tff and assets/Bodoni MT.tf) according to the above link and copy the code lable and call. but it is showing error.
Sorry, because I'm a new developer :(
You've two ways to load font in hyperlap:
ResourceManager
will load required font-size pair automatically.ResourceManager
needs to be informed that has to load a new font-size pair, in order to do that, you first need to place the font into assets/freetypefonts/
folder of your game/libGDX project (not hyperlap project) and then tells ResourceManager
to load it with: resourceManager.loadFont(new FontSizePair("Bodoni MT", 26));
.Note that if you need the same font but with different size you've to call loadFont
multiple times.
hi @fgnm, thank you.. String fontTest="Bodoni MT"; mAsyncResourceManager.loadFont(new FontSizePair(fontTest, 26)); LabelVO labelVO = new LabelVO(); labelVO.itemIdentifier = "labeltutorial"; labelVO.text = "This is a runtime label"; labelVO.style = fontTest; labelVO.size = 26; labelVO.layerName = "Default"; labelVO.x = 10; labelVO.y = 10; labelVO.width = 100; labelVO.height = 100;
Entity label = mSceneLoader.getEntityFactory().createEntity(mSceneLoader.getRoot(), labelVO);
mSceneLoader.getEngine().addEntity(label);
LabelVO labelVO = new LabelVO(); labelVO.itemIdentifier = "labeltutorial"; labelVO.text = "This is a runtime label"; labelVO.style = "Bodoni MT"; labelVO.size = 26; labelVO.layerName = "Default"; labelVO.x = 10; labelVO.y = 10; labelVO.width = 100; labelVO.height = 100;