B4J Question loadfont

Fabrice La

Active Member
Licensed User
Longtime User
in Class_Globals
Dim f As Font

in Initialize
f = fx.LoadFont(File.DirAssets,"alpha.ttf",12)

B4X:
Sub bttest_Click
    Log(f.FamilyName) 'Chess Alpha
    
    bttest.Font = f
    bttest.Text = "azertyui"
    

    lb.Font = f
    'lb.TextSize = 10
    lb.Text = Chr(98)
End Sub

Nothing display in button and label .....

the font cheatsheet in https://www.dafont.com/chess-alpha.font
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Tested Horse White using snippet:

B4X:
Private AlphaFont As Font
Private Label_Horse_White As Label

'Ensure to copy the file alpha.ttf to the dirassets (=Files) folder of the project.
AlphaFont = fx.LoadFont(File.DirAssets, "alpha.ttf", 48)
Label_Horse_White.Font = AlphaFont
Label_Horse_White.Text = "H"

upload_2018-7-19_20-26-30.png
 
Upvote 0

Fabrice La

Active Member
Licensed User
Longtime User
still nothing on my label ....

This is my test attached
 

Attachments

  • testFont.zip
    32.4 KB · Views: 259
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Try with another alph ttf file. Check attached = the one I used for testing.
 

Attachments

  • x.zip
    12.9 KB · Views: 239
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It looks like the font file may be corrupted (or not compatible with java) in some way, I couldn't find a validator so I downloaded a different version of the file from here: https://fonts2u.com/chess-alpha.font which works here.
 
Last edited:
Upvote 0
Top