Why does textHeight and getLineMetrics(0).height = 0 when I set embedFonts to true?


#1

When I set a textFeild’s embardFonts=true the height is 0.
I jsut noticed the font isnt loading at all.

I am embeding this way :


#2

I got it to work by putting the font in a folder “fonts” in assets.
then adding this to the project.xml
<assets path="assets/fonts" rename="fonts" />
then getting the font name like this
Assets.getFont("fonts/fontfile.TTF").fontName

interested why I couldnt get your solution to work @singmajesty .
Thanks


#3

When you <assets path="assets/fonts" />, the fonts should be included in your project. If you do a -verbose build, the tools should output the detected font name. As a result, you can use Assets.getFont, but also you can just use the name of the font, such as “Arial Bold”