Hello wonderful solvers of all things xojo! I’m having a bit of a problem using a custom font in an app and was hoping someone might be able to point me in the right direction…
I’ve been following a couple of how-to’s for this, and , and I think I’ve followed all the steps properly, but I still can’t get the font to show.
The code:
[code] Dim classPtr as Ptr = FoundationFramework.NSClassFromString (“UIFont”)
#if Target64Bit
Declare function fontWithName lib UIKitLibName selector “fontWithName:size:” (id as ptr, Fontname as CFStringRef, Size as double) as Ptr
#elseif Target32Bit
Declare function fontWithName lib UIKitLibName selector “fontWithName:size:” (id as ptr, Fontname as CFStringRef, Size as single) as Ptr
#endif
Dim f as xojo.IO.FolderItem = SpecialFolder.GetResource(“boston.ttf”)
Dim ft As ptr
If f <> Nil And f.Exists Then
ft = fontWithName(classPtr, "boston", 18) // this returns nil
End If[/code]
I’ve tried the fontWithName function with known non-custom fonts and it works for those fine.
My info.plist (copied into resources folder along with the fonts boston.ttf/boston traffic.ttf in build step):
[code]<?xml version="1.0" encoding="UTF-8"?>
UIAppFonts boston.ttf Boston Traffic.ttf [/code]As far as I can see I’ve followed the steps, so I’m pretty stumped on what to try next. Any pointers or tips very much appreciated!
Thanks.