Richstring and typeface from assets

IamBot

Member
Licensed User
Longtime User
Hi,

How do I use external typefaces for RichStrings?
Below code did not seem to work.


B4X:
Dim myfont As Typeface
Dim cdTitle As RichString

myfont = Typeface.LoadFromAssets("font2.ttf")

cdTitle.Initialize(Stage & " - Stage Info")
cdTitle.Typeface(myfont, 0, 9)

ret = cd.Show(cdTitle,"","Back","",Null)

This gives the CustomDialog3 title default typface.
 

IamBot

Member
Licensed User
Longtime User
Nope, it did not seem to work either. If I just use "serif" for example instead of myfont, then both works. Any other suggestion?
 
Upvote 0

IamBot

Member
Licensed User
Longtime User
Can you upload this font file?

Please find the file attached. Note that I'm using this font for all the other labels etc. in my program and it works fine. The problem occurs when I started to use RichString.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
RichString Typeface method doesn't support external typefaces. You will need to set the typeface of the target.

SS-2012-10-07_12.50.28.png
 
Upvote 0

IamBot

Member
Licensed User
Longtime User
RichString Typeface method doesn't support external typefaces. You will need to set the typeface of the target.

SS-2012-10-07_12.50.28.png

Not sure what that means entirely, I can only use the standard "MONOSPACE", "SERIF" and "SANS-SERIF" for RichStrings?

Thanks for your time.
 
Upvote 0
Top