iOS Tutorial Custom Fonts

In order to add custom font files to your application you need to follow these instructions:
1. Add the font file to the "special" folder: <project>\Files\Special
2. Add the #AppFont attribute for each font file (including the extension):
B4X:
#AppFont: papercuts-2.ttf
#AppFont: vermidirouge 1.0.ttf
3. Find the font name. You can double click on the font file:

SS-2014-11-04_15.13.26.png


4. Create a new font with this font name. The name should not include spaces:
B4X:
Label1.Font = Font.CreateNew2("VermidiRouge", 30)
Label2.Font = Font.CreateNew2("PaperCuts2", 20)

SS-2014-11-04_15.18.22.png



Note that #AppFont and the special folder features are not available in the current beta.
 

Attachments

  • CustomFonts.zip
    54.9 KB · Views: 1,394

GiulioVale

Active Member
Licensed User
Longtime User
HI Erel,
with this example I have
Error occurred on line: 30 (main)
Object was not initialized (UIFont)

Any help?

edit:
ooooppss my fault I not read the message for the current beta. Sorry
 
Last edited:

GiulioVale

Active Member
Licensed User
Longtime User
HI Erel,
with btnSeguente.CustomLabel.Font = Font.CreateNew2("FontAwesome", 20) i want assign a font to a text button.
My text is UnescapeUnicode("\uf061")
How i can assign at runtime this char to button label?
 

susu

Well-Known Member
Licensed User
Longtime User
Your app runs on iPhone 5S (iOS 7.1.2) but there's no change of font? Is it a bug?
 

susu

Well-Known Member
Licensed User
Longtime User
Yes, I just download your code and run as "Debug".
 

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
Hi.
I use custom font and it's work good but still cannot change fontsize.
of course sometime i get error "The file 'J:\Basic4x\Basic4iOS\Chapter 18\Attachment\Project\Objects\src\tahoma' already exists." what it is?
How change font size? (I use label1.Font = Font.CreateNew(30))
 

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
I try change font size from settings.I dont want to change font size in designer.Is there a way?
 
Top