Search code examples
iphoneiosobjective-cuibuttoncustom-font

Custom font not showing diaeresis in capital letters


I have a subclass of UIButton that uses a custom font. The problem is that capital letters don't show diaeresis.

Below there are images of the same button sample with and without the custom font. I set the title's background color to red to see what is going on.

Without custom font

without custom font

With custom font

with custom font

My UIButton subclass overrides awakeFromNib

- (void)awakeFromNib
{
    [super awakeFromNib];
    UIFont *font = [UIFont fontWithName:@"TitilliumText22L-Bold" size:self.titleLabel.font.pointSize];
    self.titleLabel.font = font;
}

Can anyone tell me what to do in order to show the diaeresis on top of capital letters?

Thanks.


Solution

  • I solved this problem by following this answer on the question shared by Bob https://stackoverflow.com/a/8314197/617787

    The only thing to be aware of this solution (changing the "ascender" of the font file) is that the space between lines on multiline UILabels using this modified font will change as well, so you might use NSAttributedString to modify it in a per case basis.