Android Question font

Silkowner

New Member
java.io.FileNotFoundException: /data/user/0/farzin.com.app/files/virtual_assets/shabnam.ttf: open failed: ENOENT (No such file or directory)

I want to put a ttf file in the assets file and then use it, but it gives an error.


a:
    Dim shabnam As Typeface
    shabnam = Typeface.LoadFromAssets("Shabnam.ttf")
 

pixet

Active Member
Licensed User
Longtime User
Find the .ttf file at the link below.
Place the .ttf file in the Assets (Files) folder.
If your project is a B4XPages project, add
it to the B4XMainPage module.
You must configure it similarly to use your custom fonts.

Custom Fonts B4XPages:
' B4XMainPage'
'
' Modify your B4XMainPage as shown in this example.
'
Private Sub B4XPage_created (Root1 As B4XView)
    Root = Root1
    Root.loadLayout(MainPage")
    '
    ' Code to add
    Dim BF As B4XFont
    BF = xui.CreateFont(Typeface.LoadFromAssets("shabnam.ttf"), 38)
   
    lbl1.TextColor = xui.Color_Red
    lbl1.Font = BF
    lbl1.Text = "My text"
End Sub
 

Attachments

  • Test_CustomFonts_Assets.zip
    58.3 KB · Views: 0
Last edited:
Upvote 0

teddybear

Well-Known Member
Licensed User
java.io.FileNotFoundException: /data/user/0/farzin.com.app/files/virtual_assets/shabnam.ttf: open failed: ENOENT (No such file or directory)

I want to put a ttf file in the assets file and then use it, but it gives an error.


a:
    Dim shabnam As Typeface
    shabnam = Typeface.LoadFromAssets("Shabnam.ttf")
Did you put the Shabnam.ttf into Files folder?
 
Upvote 0
Top