9

I have created a number of different applications with custom fonts. I've used about six different ones, all from different sources. Each of them had problems when displayed in iOS. With some of them they drew in UILabels either higher or lower than a system font of the same size. Others drew differently in UILabels when compared to how they drew in UITextFields, drawing smaller and lower in UITextFields. Virtually all of them draw differently in UITextFields when they are being edited vs when they are not, giving an effect of the text jumping downwards when the UITextField enters edit mode. For someone doing fine detail work that needs to be pixel-perfect this is pretty bad.

My question is simply this--what in these fonts specifically causes these types of issues? Is there some specific attribute that the system font has that these other fonts do not?

For extra credit, I would love to hear any general purpose solutions that can solve these issues for every font, if such a thing is possible. My hope is that if I can understand why this is happening I can create a script to preprocess the font before packaging it with the application so that it works correctly.

These problems are easy to reproduce, but since I know someone will ask, I will list a few specific fonts that have produced problems for me:

  • PT Sans Bold
  • Avenir Next LT Pro Medium Condensed
  • Korolev Condensed Medium
Micah Hainline
  • 14,367
  • 9
  • 52
  • 85
  • You mention in comparison to the system font - can you reproduce any of these complaints with other standard iOS fonts apart from the system defaults? – Freney Oct 15 '12 at 00:36
  • None of the standard iOS fonts that I have looked at exhibit any of these behaviors. – Micah Hainline Oct 16 '12 at 13:25
  • Could the fonts themselves be defective? The metric data in the font, which govern the positioning and size of the text, could be incorrect. Maybe you could try using these fonts in other systems and see if they exhibit the same problem. – wschang Oct 18 '12 at 05:44
  • ii experienced similar font anomalies, in the end ii simply positioned my labels slightly lower or higher... – manitu Dec 05 '12 at 10:50
  • if you download the Font Tool Suite in my answer below, it will help you with many of the custom font baseline issues you have – NSTJ Dec 06 '12 at 15:27
  • It look like custom fonts will look correct on iOS 7, but if you run the same app on iOS 6, they will look shifted, so if you fixed the layout manually, you will need to fix it again for iOS 7. – leolobato Sep 26 '13 at 14:42

1 Answers1

1

Have you tried using the Apple Font Tool Suite command line utilities? You can adjust the baseline properties of fonts with it (I acknowledge this doesn't answer the 'why' component of your question, however the tools may make the question moot). The accepted answer here does a terrific job of explaining their usage.

Community
  • 1
  • 1
NSTJ
  • 3,858
  • 2
  • 27
  • 34