Tuesday, 14 June 2016

Default font families



Default font families



Default font sizes

There are 4 font sizes that can be obtained using +[UIFont someSize]. The last 2 are conventional values.
NameValue
smallSystemFontSize12
systemFontSize14
labelFontSize17
buttonFontSize18
Default font size of UIButton15
Default font size of UITextField   12



+fontWithFamilyName:traits:size:

Signature+(UIFont*)fontWithFamilyName:(NSString*)familyName traits:(GSFontTraitMask)traits size:(CGFloat)fontSize;
Available in2.0 –
Returns a font with specific family name, traits (bold/italic) and font size. For example:
// Equivalent to [UIFont fontWithName:@"Arial-BoldMT" size:24]
UIFont* font = [UIFont fontWithFamilyName:@"Arial" traits:GSBoldFontMask size:24];

+fontWithMarkupDescription:

Signature+(UIFont*)fontWithMarkupDescription:(NSString*)markupDescription;
Available in2.0 —
Create a font using a CSS font description, e.g.
// Equivalent to [UIFont fontWithName:@"Arial-BoldMT" size:24]
UIFont* font = [UIFont fontWithMarkupDescription:@"font-family: Arial; font-size: 24px; font-weight: bold;"];
Unlike real CSS rules there are heavy restrictions on the "markup description":
  • The font-family rule must be exact. A list of fonts like Arial, Helvetica, sans-serif will not be supported by UIKit, and will always return nil regardless whether any font in the list is available.
  • The unit of font-size will always be interpreted as px. Names such as font-size: large will be considered as 0px.
  • font-weight can only be bold or not.
  • font-style can only be italic or not. In particular, oblique is not recognized and treated as normal.

-traits

Signature-(GSFontTraitMask)traits;
Available in2.0 –
Returns the traits (bold/italic) of the font.

-isFixedPitch

Signature-(BOOL)isFixedPitch;
Available in2.0 –
Returns whether the font is monospaced or not.

-markupDescription

Signature-(NSString*)markupDescription;
Available in2.0 –
Returns the CSS rules that can reproduce this font.



Default font families

FamilyNormalBoldItalicBold-ItalicExample
American TypewriterAmericanTypewriterAmericanTypewriter-BoldLatin-AMZamz157½ßĽΔΩθφДЫжю
AppleGothicAppleGothicKorean-한국어-韓國語
ArialArialMTArial-BoldMTArial-ItalicMTArial-BoldItalicMTLatin-AMZamz157½ßĽΔΩθφДЫжю
Arial HebrewArialHebrewArialHebrew-BoldHebrew-עִבְרִית
Arial Rounded MT BoldArialRoundedMTBoldLatin-AMZamz157½ßĽΔΩθφДЫжю
Arial Unicode MSArialUnicodeMSUnicode-AMZamz157½ßĽΔΩθφДЫжю
CourierCourierCourier-BoldCourier-ObliqueCourier-BoldObliqueLatin-AMZamz157½ßĽΔΩθφДЫжю
Courier NewCourierNewPSMTCourierNewPS-BoldMTCourierNewPS-ItalicMTCourierNewPS-BoldItalicMTLatin-AMZamz157½ßĽΔΩθφДЫжю
DB LCD TempDBLCDTempBlack0123456789abcdef
Geeza ProGeezaProGeezaPro-BoldArabic-العربية/Farsi-فارسی
GeorgiaGeorgiaGeorgia-BoldGeorgia-ItalicGeorgia-BoldItalicLatin-AMZamz157½ßĽΔΩθφДЫжю
Heiti JSTHeitiJ-LightSTHeitiJ-MediumJapanese-にほんご-ニヒンゴ-日本語
Heiti KSTHeitiK-LightSTHeitiK-MediumKorean-한국어-韓國語
Heiti SCSTHeitiSC-LightSTHeitiSC-MediumSimplified Chinese-简体中文
Heiti TCSTHeitiTC-LightSTHeitiTC-MediumTraditional Chinese-繁體中文
HelveticaHelveticaHelvetica-BoldHelvetica-ObliqueHelvetica-BoldObliqueLatin-AMZamz157½ßĽΔΩθφДЫжю
Helvetica NeueHelveticaNeueHelveticaNeue-BoldLatin-AMZamz157½ßĽΔΩθφДЫжю
Hiragino Kaku Gothic ProNHiraKakuProN-W3HiraKakuProN-W6Japanese-にほんご-ニヒンゴ-日本語
Marker FeltMarkerFelt-ThinLatin-AMZamz157½ßĽΔΩθφДЫжю
ThonburiThonburiThonburi-BoldThai-ภาษาไทย
Times New RomanTimesNewRomanPSMTTimesNewRomanPS-BoldMTTimesNewRomanPS-ItalicMTTimesNewRomanPS-BoldItalicMTLatin-AMZamz157½ßĽΔΩθφДЫжю
Trebuchet MSTrebuchetMSTrebuchetMS-BoldTrebuchetMS-ItalicTrebuchet-BoldItalicLatin-AMZamz157½ßĽΔΩθφДЫжю
VerdanaVerdanaVerdana-BoldVerdana-ItalicVerdana-BoldItalicLatin-AMZamz157½ßĽΔΩθφДЫжю
ZapfinoZapfinoLatin-AMZamz157½ßĽΔΩθφДЫжю

Default font sizes






-(void)AllFont
{
                       

    NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    NSArray *fontNames;
    NSInteger indFamily, indFont;
    NSInteger fontsCount = [familyNames count];
    
    for (indFamily = 0; indFamily < fontsCount; ++indFamily) {
        NSLog (@"Family name: %@", [familyNames objectAtIndex:indFamily]);
        fontNames = [[NSArray alloc] initWithArray:
                     [UIFont fontNamesForFamilyName:
                      [familyNames objectAtIndex:indFamily]]];
        for (indFont = 0; indFont < [fontNames count]; ++indFont) {
            NSLog (@"    Font name: %@", [fontNames objectAtIndex:indFont]);
        }
        
    }
    
}

No comments:

Post a Comment