Custom Fonts in iOS 3.1?

Do custom fonts work in 3.1? I have some users saying that they see no text on the screen. I googled around and found out that custom fonts are in 3.2 and up. Would this be causing the problem for these users?

They players say “I don’t see any text” and I’ve got quite a few of them saying that. Any idea what could be causing this? [import]uid: 51654 topic_id: 14122 reply_id: 314122[/import]

Yes, 3.1 doesn’t like custom fonts.

You could use the default font or images instead, perhaps? [import]uid: 52491 topic_id: 14122 reply_id: 52097[/import]

I have a little function which I can call with several fonts in order of preference, similar to how you’d do it in CSS, and the function will fallback to a system font if it can’t find any of the included fonts.

[code]
appSetFont( {'FooFont', 'BarFont', 'Helvetica'} )
function appSetFont(fontNames)
 fontNames = misc.toTable(fontNames)
 app.defaultFont = nil

 if fontNames ~= nil then
 local availableFontNames = native.getFontNames()
 for i = 1, #fontNames do
 if misc.inArray(availableFontNames, fontNames[i]) then
 app.defaultFont = fontNames[i]
 break
 end
 end
 end
 if app.defaultFont == nil then app.defaultFont = native.systemFontBold end
end

[snip]
function inArray(array, value)
 local is = false
 for i, thisValue in ipairs(array) do
 if thisValue == value then is = true; break end
 end
 return is
end
[/code]

[import]uid: 10284 topic_id: 14122 reply_id: 52764[/import]

Sorry, that was my intended implication - system on 3.1

That said I should probably have offered a more detailed solution on how to do so - thanks for sharing your very nice code, Philipp :slight_smile: [import]uid: 52491 topic_id: 14122 reply_id: 52853[/import]