Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 955
Xavi Gil Avatar asked Jun 12 '13 11:06

Xavi Gil


2 Answers

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.

like image 190
Javier Chávarri Avatar answered Sep 18 '22 10:09

Javier Chávarri


Easy and best solution.

  1. Select the button in the interface
  2. In the attribute inspector, change the vertical alignment as shown in the image.

like image 20
Ghulam Rasool Avatar answered Sep 18 '22 10:09

Ghulam Rasool