load fonts

salanmar

Member
Licensed User
Longtime User
Is it possible to load a font to a typeface variable from internal or external sd instead of using LoadFromAssets?
 

stevel05

Expert
Licensed User
Longtime User
You can use reflection something like this:

B4X:
Sub FontFromFile(Dir As String, FileName As String) As Typeface
   
   Dim R As Reflector
   Return R.RunStaticMethod("android.graphics.Typeface","createFromFile",Array As String(File.Combine(Dir,FileName)),Array As String("java.lang.String"))
End Sub
 
Upvote 0
Top