Question

I've used a custom TTF font (Gotham) when implementing the layout of an app on iOS 6. I've noticed its baseline was always a bit higher than regular fonts, but just nudged things around to fit.

Now that I've updated to the iOS 7 SDK, the font placement is closer to that of regular fonts when running on iOS 7 devices, but still looks nudged on iOS 6 devices.

So it looks like Apple fixed what caused that vertical shifting on the baseline when interpreting the font metrics for iOS 7, but left iOS 6 untouched.

I've already tried modifying the actual TTF ascender, descender and line gap properties using Apple's Font Tools suits according to this blog post and many answers here on stackoverflow, it does help on iOS 6 but doesn't change much on iOS 7.

My question is: is there something I can do to use a custom font on iOS 6 and 7 without needing to tweak each label depending on the running iOS version?

I know this has been mentioned on the iOS 7 release notes, but I don't want to add tons of conditional clauses on my code to nudge the labels differently for iOS 6 or iOS 7 devices.

Était-ce utile?

La solution

Editing the TTF file was the solution.

I've followed the suggestion from this answer and opened my TTF files on Glyphs and exported them again. Glyphs adjusted the ascender and lineGap values to something which is probably correct and the fonts behave pretty much identically on iOS 6 and IOS 7. The baseline now is even very close to the system fonts.

There are still some minor vertical differences, but apparently this happens with every font on iOS 7, even on system fonts, but it's much less noticeable.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top