I hate to re-hash a topic that has been done to death, but nothing I do gets my custom font working. The font file is in the same directory as the main.lua, my build.settings reads like this:
settings = {
orientation = {
default = "landscapeRight",
supported = { "landscapeRight", "landscapeLeft", }
},
iphone = {
plist = {
UIPrerenderedIcon = true, -- set to false for "shine" overlay
UIApplicationExitsOnSuspend = false,
UIStatusBarHidden = true,
UIAppfonts =
{
"SFSlapstickComic.ttf",
},
}
},
-- For Android:
android = {
versionCode = "1.3.1",
versionName = "1.3.1",
},
androidPermissions = {
"android.permission.INTERNET",
"android.permission.READ\_EXTERNAL\_STORAGE",
"android.permission.WRITE\_EXTERNAL\_STORAGE",
"android.permission.READ\_PHONE\_STATE",
},
}
and i call the font with:
local fontName = "SFSlapstickComic" -- matches terminal output when I print native.getFontNames()
local fontSize = 32
-- if on Android or non-iOS device
if (platformName == "Android" and not onSimulator) or (platformName ~= "iPhone OS" and not onSimulator) then
fontName = "SFSlapstickComic.ttf"
fontSize = 32
end
-- if on older device (and not on simulator) ...
if not onSimulator and olderVersion then
if string.sub( platformVersion, 1, 3 ) ~= "3.2" then
fontName = "Helvetica"
fontSize = 30
end
end
and text items:
local lifeString = (moduleVariables.gameLives - init) .. " x"
lifeText = display.newText( lifeString, 0, 0, fontName, (fontSize \* 0.9375 ))
lifeText:setTextColor( textColor, textColor, textColor, 255 )
lifeText.xScale = 0.5; lifeText.yScale = 0.5 --\> for clear retina display text
lifeText.x = 25
lifeText.y = 17
hudGroup:insert( lifeText )
But still only system fonts will display when specified. The thing is though, I don’t get an error or a fall back to a system font, I just get blank spaces where the text should display.
The font is also installed in Font Book and I’ve tried multiple custom fonts, including ‘Harrowprint’ in the Corona custom font example, but all to no avail.
Aside from giving up and using something as visually stimulating as Helvetica, can anybody point me in any new directions? Just FYI, I’m using build 2012.935 and at this point I’m just focusing on iOS, I haven’t done any testing in the Android environment.
I should mention that fonts work no problems in Coronas simulator. But xCode simulator and iOS devices don’t. [import]uid: 157954 topic_id: 32353 reply_id: 332353[/import]