Custom font y offset on iOS device

I’m using the font Josefin Sans in my app.  The fonts appear accordingly and correctly to my assigned x and y values on the Corona simulator, but when I build and launch the app on an iOS device  all  the text objects appear to be shifted 3 pixels upward on the y axis.

The offsetting only occurs on the iOS device (iPhone 5 & iPhone 4) and the Xcode Simulator (all of them) but not on the Corona Simulator.

Any idea how to fix this?

Thanks,

Emerson Hsieh

This is an issue with some fonts in Corona on iOS devices.  Doesn’t happen with all fonts, but does for some.

The widget.newButton works around this with offset parameters you can set to adjust the font position on the button.  For just normal display.newText, you’ll likely need to do that yourself by just adjusting the position manually for any that use that font.  Note that the offset will also likely change depending on the size of the text, so keep that in mind.

A bit disappointed to hear that it is a bug within Corona itself, but thanks for your reply :slight_smile:

I am not sure it is a bug within Corona.  Fonts are always a tricky thing because there are a whole lot of things built into a font file that mobile devices may not always represent correctly.

As an example, in my trivia app, I wanted to have text appear as if it were a script, and I found this great, free Courier Prime font for that.  Worked perfectly on iOS.  On Android, any space ended up being represented like 150 units wide, so couldn’t use it for Android.

I really don’t think it is a Corona issue, but I am not aware of any app that allows you to install fonts and use them to see if it happens there as well to rule out Corona.

In the case of the offset, as I recall from the font that I use in my trivia app, I need to do the offset on iOS, but not on Android.

This is an issue with some fonts in Corona on iOS devices.  Doesn’t happen with all fonts, but does for some.

The widget.newButton works around this with offset parameters you can set to adjust the font position on the button.  For just normal display.newText, you’ll likely need to do that yourself by just adjusting the position manually for any that use that font.  Note that the offset will also likely change depending on the size of the text, so keep that in mind.

A bit disappointed to hear that it is a bug within Corona itself, but thanks for your reply :slight_smile:

I am not sure it is a bug within Corona.  Fonts are always a tricky thing because there are a whole lot of things built into a font file that mobile devices may not always represent correctly.

As an example, in my trivia app, I wanted to have text appear as if it were a script, and I found this great, free Courier Prime font for that.  Worked perfectly on iOS.  On Android, any space ended up being represented like 150 units wide, so couldn’t use it for Android.

I really don’t think it is a Corona issue, but I am not aware of any app that allows you to install fonts and use them to see if it happens there as well to rule out Corona.

In the case of the offset, as I recall from the font that I use in my trivia app, I need to do the offset on iOS, but not on Android.