Try for a while to draw text to a canvas. Issue is the font object. Erel writes in https://www.b4x.com/guides/B4xXUI/?page=20 xLabelFont = xui.CreateDefaultFont(16) But I have no XUI-class, although the XUI-Lib (and XUI Views)is loaded I declared it: Dim fnt As B4XFont fnt=xui... does not...
thanks
i wanted to use an external font
but if it comes with some pain i think i'll drop the idea
i did see an app that uses that external font so i wondered how can i do it myself too
once again - thanks
Add the font into your assets folder, like any other asset.
Then assuming your view is a b4xfont
B4X:
' if your view is a standard view, like label
lbl.typeface = typeface.loadfromAsset("fontname")
'if your view is a b4xview
lbl.font = xui.createfont(typeface.loadfromAsset("fontname"),<size of font>)
Add the font into your assets folder, like any other asset.
Then assuming your view is a b4xfont
B4X:
' if your view is a standard view, like label
lbl.typeface = typeface.loadfromAsset("fontname")
'if your view is a b4xview
lbl.font = xui.createfont(typeface.loadfromAsset("fontname"),<size of font>)
Here is an example where you can use csbuilder and your font file:
B4X:
Dim MyList As List
MyList.Initialize
MyList.AddAll(Array ("Monday","tuesday","Friday","test2", "Zeev"))
Dim myFont As Typeface = Typeface.LoadFromAssets("mtcorsva.ttf") 'use your font file
Dim cs As CSBuilder
For i = 0 To MyList.Size -1
Spinner1.Addall(Array(cs.Initialize.Size(30).color(Colors.Red).Typeface(myFont).Append(MyList.Get(i)).PopAll))
Next
Here is an example where you can use csbuilder and your font file:
B4X:
Dim MyList As List
MyList.Initialize
MyList.AddAll(Array ("Monday","tuesday","Friday","test2", "Zeev"))
Dim myFont As Typeface = Typeface.LoadFromAssets("mtcorsva.ttf") 'use your font file
Dim cs As CSBuilder
For i = 0 To MyList.Size -1
Spinner1.Addall(Array(cs.Initialize.Size(30).color(Colors.Red).Typeface(myFont).Append(MyList.Get(i)).PopAll))
Next
No need to answer until you try it. This way we know whether it helped you or not. This snapshot is based on the font file I used. Yours will of course look differently. Also, don't forget about B4XComboBox a xross platform spinner if you want to venture using it
No need to answer until you try it. This way we know whether it helped you or not. This snapshot is based on the font file I used. Yours will of course look differently. Also, don't forget about B4XComboBox a xross platform spinner if you want to venture using it View attachment 126118