Reputation: 2094
I'm trying to set a custom font and, following the last answer to this question, I seem to have the font working in the project.
The only trick is that it's always the same size - too small. I'm trying to set it rather large but it's always small, no matter the size. Here's the line of code I'm using, as per the instructions in the above link.
self.timeLabel.font = [UIFont fontWithName:@"DistProTh" size:48];
I know the line works because I can change the font name (DistProTh) to something another font (say, Didot) and everything's fine. It therefore seems to me to be an issue with the font (which is freely available) but the font works ok in other applications (Stickies for example). Sadly, I'm no font expert..
Upvotes: 0
Views: 135
Reputation: 2094
Turns out it needed what Font Book calls the "PostScript name" which, in the case of District Pro Thin is DistrictPro-Thin
.
Incidentally, either the "PostScript name" or the "full name" (as per Font Book) worked for the font called "Code Light" but not for "District Pro Thin".
Upvotes: 0
Reputation: 726479
The fontName
parameter of the fontWithName:
method is the full name of the font, not its file name. DistProTh
is the file name; the full name of that font is District Pro Thin
.
This should fix the problem:
self.timeLabel.font = [UIFont fontWithName:@"District Pro Thin" size:48];
Font name and file name are often the same, but that's not always the case. To look up the name of the font, locate your font in the Font Book application, and press Command+I to view font's information.
Upvotes: 1