samedi 2 juillet 2016

Typesetting a font in small caps on iOS

On iOS, I load a custom font in my project by adding its file name (an .otf file) to the info.plist file and then using this line of code:

UIFont myFont * = [UIFont fontWithName:titleFontName size:titleFontSize];

I obtain the font that I can use in UILabels and UITextViews.

How could I obtain that this font is displayed only in small caps? If I use it in Photoshop, it's possible to turn on the small caps switch to have all words typeset in small caps (and so, I conclude that there is nothing missing with the font). How could I obtain a similar effect on iOS?

Converting my strings to uppercase is not a viable option for other reasons.

Further information : the font has only one member in its family, as I could understand by using the following code, there is no standalone small caps member in the family.

 for (NSString * familyName in [UIFont familyNames]) {

        NSLog(@"---------------- %@ ---------------", familyName);
        for (NSString * fontName in[UIFont fontNamesForFamilyName:familyName] )
           NSLog(@"- %@", fontName);
   }

Aucun commentaire:

Enregistrer un commentaire