Weird font displaying on iOS

Hi,

I was trying to use display.newText() to display text with a custom font and in the simulator it was all right but when I intalled my app on an iPad it displayed only the higher half of the word. So I tried to install it even on a tablet with Android and it worked all fine. After that I tried to change font using another font and it worked fine even on the iPad! So I would ask you, what I should do? Is there any “trick” to bipass this issue?

This is the code that calls the display.newText() :

local text = display.newText("Hello", 70, 330, "myfont", 32)

Thank you,

Andrea [import]uid: 63063 topic_id: 35752 reply_id: 335752[/import]

I deleted the duplicate post. Can you show us a screen shot? Also post your config.lua file as well.

[import]uid: 199310 topic_id: 35752 reply_id: 142219[/import]

it shows me something like this http://i45.tinypic.com/akzbee.png [import]uid: 63063 topic_id: 35752 reply_id: 142225[/import]

this is my build.settings file [code]settings =
{

orientation =
{
default = “portrait”,

},
iphone =
{
plist =
{
CFBundleIconFile = “Icon.png”,
CFBundleIconFiles = {
“Icon.png”,
“Icon@2x.png”,
“Icon-72.png”,
},
UIAppFonts =
{
“Komika Axis.ttf”,
“MyriadPro-Bold.otf”,
“MyFont.ttf”
}
},
},

}[/code] [import]uid: 63063 topic_id: 35752 reply_id: 142226[/import]

What about your config.lua file?
[import]uid: 199310 topic_id: 35752 reply_id: 142228[/import]

[code]-- config.lua

if (system.getInfo(“platformName”) == “Android”) then
application =
{
content =
{
width = 640,
height = 960,
scale = “zoomEven”
},
}
elseif ((system.getInfo(“model”) == “iPhone”) and display.pixelHeight > 960) then
application =
{
content =
{
–zoom
width = 640,
height = 1136,
scale = “zoomEven”
},
}
elseif (system.getInfo(“model”) == “iPhone”) then
application =
{
content =
{
–zoom
width = 640,
height = 960,
scale = “zoomEven”
},
}
elseif (system.getInfo(“model”) == “iPad”) then

application =
{
content =
{
–zoom
width = 768,
height = 1024,
scale = “zoomEven”
},
}

end
[/code] [import]uid: 63063 topic_id: 35752 reply_id: 142231[/import]

Solved the issue!! :slight_smile:
I just had to set a width and height as arguments in display.newText() function! It’s a little bit strange, but now it works!!

Thanks anyway for your help,

Andrea [import]uid: 63063 topic_id: 35752 reply_id: 142234[/import]

If its only happening with that one font, perhaps iOS is having trouble rendering that font. OS-X, iOS, Android and Windows will all render fonts differently. I would try finding a different font, or perhaps, use the additional parameters to display.newText() that lets you set the width of the box and the height (for wrapping text) and maybe try to make the box double the font size. In other words try:

local text = display.newText("Hello", 70, 330, 200, 64, "myfont", 32) [import]uid: 199310 topic_id: 35752 reply_id: 142236[/import]

I deleted the duplicate post. Can you show us a screen shot? Also post your config.lua file as well.

[import]uid: 199310 topic_id: 35752 reply_id: 142219[/import]

it shows me something like this http://i45.tinypic.com/akzbee.png [import]uid: 63063 topic_id: 35752 reply_id: 142225[/import]

this is my build.settings file [code]settings =
{

orientation =
{
default = “portrait”,

},
iphone =
{
plist =
{
CFBundleIconFile = “Icon.png”,
CFBundleIconFiles = {
“Icon.png”,
“Icon@2x.png”,
“Icon-72.png”,
},
UIAppFonts =
{
“Komika Axis.ttf”,
“MyriadPro-Bold.otf”,
“MyFont.ttf”
}
},
},

}[/code] [import]uid: 63063 topic_id: 35752 reply_id: 142226[/import]

What about your config.lua file?
[import]uid: 199310 topic_id: 35752 reply_id: 142228[/import]

[code]-- config.lua

if (system.getInfo(“platformName”) == “Android”) then
application =
{
content =
{
width = 640,
height = 960,
scale = “zoomEven”
},
}
elseif ((system.getInfo(“model”) == “iPhone”) and display.pixelHeight > 960) then
application =
{
content =
{
–zoom
width = 640,
height = 1136,
scale = “zoomEven”
},
}
elseif (system.getInfo(“model”) == “iPhone”) then
application =
{
content =
{
–zoom
width = 640,
height = 960,
scale = “zoomEven”
},
}
elseif (system.getInfo(“model”) == “iPad”) then

application =
{
content =
{
–zoom
width = 768,
height = 1024,
scale = “zoomEven”
},
}

end
[/code] [import]uid: 63063 topic_id: 35752 reply_id: 142231[/import]

Solved the issue!! :slight_smile:
I just had to set a width and height as arguments in display.newText() function! It’s a little bit strange, but now it works!!

Thanks anyway for your help,

Andrea [import]uid: 63063 topic_id: 35752 reply_id: 142234[/import]

If its only happening with that one font, perhaps iOS is having trouble rendering that font. OS-X, iOS, Android and Windows will all render fonts differently. I would try finding a different font, or perhaps, use the additional parameters to display.newText() that lets you set the width of the box and the height (for wrapping text) and maybe try to make the box double the font size. In other words try:

local text = display.newText("Hello", 70, 330, 200, 64, "myfont", 32) [import]uid: 199310 topic_id: 35752 reply_id: 142236[/import]