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?

Yes, 3.1 doesn't like custom fonts.

You could use the default font or images instead, perhaps?

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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

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 :)

views:1439 update:2011/10/5 8:48:05
corona forums © 2003-2011