Custom UIFont baseline shifted

Here or even here you can find the solutions for you.
It’s all about baseline.

Note
There’s a problem with installing Apple Fonts Utility on El Capitan. See https://apple.stackexchange.com/questions/211138/apple-font-tools-cannot-install-in-macbook-pro-el-capitan for a workaround.

To edit these in the font you will need to download the Apple Font
Tool Suite. Once you’ve installed this you need to open Terminal and
navigate to the directory that contains your font. After that enter
the following command:

  1. ftxdumperfuser -t hhea -A d font.ttf This will create a file
    called font.hhea.xml, open this new file into a text editor and adjust
    the values for ascender and descender. Generally if you font sits too
    low you want to decrease ascender and increase descender. After
    editing and saving enter the following command into terminal to
    reconstruct your Font file:

  2. ftxdumperfuser -t hhea -A f font.ttf You can now use the font.ttf
    file in your application. If the font still isn’t right just repeat
    the above procedure until you are happy.

OR you can easily change NSBaselineAttributeName as follows:

NSAttributedString *attrStr = [[NSAttributedString alloc] initWithString:@"a string"
                              attributes:@{ NSBaselineOffsetAttributeName : @-13 }];

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)