Can not load custom font in iOs

   Hi everyone.

   In my game, I use two custom fonts: “King Of The Hill.ttf” and “King Of The Hill 2_0.ttf” ( the font names are : ‘King Of The Hill’ and ‘King Of The Hill 2_0’, same as the file names ). I built my game and they displayed perfect on Android devices. But when I tested on an Ipad4 or Iphone4, those fonts didn’t show   :frowning:

 Here’s my build.setting file:

settings = { orientation = { default = "landscapeRight", supported = { "landscapeLeft", "landscapeRight" } }, android = { usesExpansionFile = true, usesPermissions = { "android.permission.INTERNET", "com.android.vending.CHECK\_LICENSE", "android.permission.WRITE\_EXTERNAL\_STORAGE" }, }, iphone = { plist = { UIStatusBarHidden = true, CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIAppFonts = { "King Of The Hill 2\_0.ttf", "King Of The Hill.ttf", } }, }, }

    Here’s my code to create text:

local text = display.newText("message",0,0,"King Of The Hill",20)

     And more, Corona Simulator shows them on Windows, but not on Mac Os :frowning:

Hi @khanh.dq,

I assume you’ve followed every detail within the guide on using custom fonts?

https://docs.coronalabs.com/guide/system/customFont/index.html

If you have, it’s possible that the fonts are corrupted somehow. Can you test another custom font and see if it works?

Best regards,

Brent

  Hi Brent. Sorry for my late answer, last week was too busy.

 I used this following code to check:

local systemFonts = native.getFontNames() -- Set the string to query for (part of the font name to locate) local searchString = "king" -- Display each font in the Terminal/console for i, fontName in ipairs( systemFonts ) do local j, k = string.find( string.lower(fontName), string.lower(searchString) ) if ( j ~= nil ) then print( "Font Name = " .. tostring( fontName ) ) end end

 and found out that Mac Os did something with fonts’ name. This code brought out two names: “KingOfTheHill” and “KingOfTheHill2”

( I look at Mac Os Font Manager, it still named them as “King Of The Hill” and “King Of The Hill 2_0” )

    Guess the next time using custom fonts, I must get their true names in Mac Os by above code.

Hi @khanh.dq,

Yes, as the guide specifies, you need to use that “internal” font name for iOS or OS X.

Best regards,

Brent

Hi @khanh.dq,

I assume you’ve followed every detail within the guide on using custom fonts?

https://docs.coronalabs.com/guide/system/customFont/index.html

If you have, it’s possible that the fonts are corrupted somehow. Can you test another custom font and see if it works?

Best regards,

Brent

  Hi Brent. Sorry for my late answer, last week was too busy.

 I used this following code to check:

local systemFonts = native.getFontNames() -- Set the string to query for (part of the font name to locate) local searchString = "king" -- Display each font in the Terminal/console for i, fontName in ipairs( systemFonts ) do local j, k = string.find( string.lower(fontName), string.lower(searchString) ) if ( j ~= nil ) then print( "Font Name = " .. tostring( fontName ) ) end end

 and found out that Mac Os did something with fonts’ name. This code brought out two names: “KingOfTheHill” and “KingOfTheHill2”

( I look at Mac Os Font Manager, it still named them as “King Of The Hill” and “King Of The Hill 2_0” )

    Guess the next time using custom fonts, I must get their true names in Mac Os by above code.

Hi @khanh.dq,

Yes, as the guide specifies, you need to use that “internal” font name for iOS or OS X.

Best regards,

Brent