iOS Question CustomView with integrated custom font

Filippo

Expert
Licensed User
Longtime User
Hi,

I would like to integrate a custom font into a CustomView (B4xlib-library) without having to use the “#AppFont:” attribute in the main module.
The custom font is available in the B4xlib-library under “..\File\Special”.
Is this possible? If so, how?

Thank you for the answer
Filippo
 

Filippo

Expert
Licensed User
Longtime User
The library name should be Files\Special. I think that it will be copied correctly. Check it.
Yes, that is correct. The library is copied twice, once under “..\File” for Android and once under “..\File\Special” for iOS.

But you will need to add the #AppFont attribute.
I would find it better if this attribute were only added in the library, that would avoid errors.

It would be great if you could make it possible. ;-)
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
I have no programming experience with B4I, but in B4J and B4A I load a font via XUI program code from the assets file folder. See also [B4X] MaterialIcons Web Font Chooser
Possible B4X solution:
' Declare a variable for the custom font
Private CustomFont As B4XFont

' Initialize the font from the assets directory
CustomFont = xui.CreateFont(File.OpenInput(File.DirAssets, "CustomFont.ttf"), 16)

' Apply the font to a label
Label1.Font = CustomFont
 
Upvote 0
Top