iOS Question [solved] Font uninitialized


Licensed User
Longtime User
Hi all,
at the start of my app I have this code (it works ok on Android)
    Public xFontBase As B4XFont                        'Font per le B4xView
    Public xFontLight As B4XFont

    xFontBase = CreateB4XFont("AppleGaramond.ttf", 14, 14)                        'per b4xview
    xFontLight = CreateB4XFont("AppleGaramond-Light.ttf", 14, 14)

'NativeFontSize is needed only for B4J or B4I.
Public Sub CreateB4XFont(FontFileName As String, FontSize As Float, NativeFontSize As Float) As B4XFont
    #If B4A
        Return xui.CreateFont(Typeface.LoadFromAssets(FontFileName), FontSize)
    #Else If B4i
        Return xui.CreateFont(Font.CreateNew2(FontFileName, NativeFontSize), FontSize)
    'B4J - unused
        Return xui.CreateFont(fx.LoadFont(File.DirAssets, FontFileName, NativeFontSize), FontSize)
    #End If
End Sub
ERROR: Object was not initialized (UIFont)

What am I missing? TIA


Licensed User
Longtime User
Thnk you again, Filippo.
Inspired by your suggestion, I modified my code like this
    xFontBase = Font.CreateNew2("Apple Garamond", 14)
    xFontLight = Font.CreateNew2("Apple Garamond Light", 14)
No more calling to CreateB4xFont.

It works (well, at least it doesn't bomb out for the fonts anymore).

New "error" is about httpjob..
Upvote 0