Default font families
Default font sizes
There are 4 font sizes that can be obtained using +[UIFont someSize]. The last 2 are conventional values.
| Name | Value |
|---|---|
| smallSystemFontSize | 12 |
| systemFontSize | 14 |
| labelFontSize | 17 |
| buttonFontSize | 18 |
| Default font size of UIButton | 15 |
| Default font size of UITextField | 12 |
+fontWithFamilyName:traits:size:
| Signature | +(UIFont*)fontWithFamilyName:(NSString*)familyName traits:(GSFontTraitMask)traits size:(CGFloat)fontSize; |
|---|---|
| Available in | 2.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 in | 2.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 in | 2.0 – |
Returns the traits (bold/italic) of the font.
-isFixedPitch
| Signature | -(BOOL)isFixedPitch; |
|---|---|
| Available in | 2.0 – |
Returns whether the font is monospaced or not.
-markupDescription
| Signature | -(NSString*)markupDescription; |
|---|---|
| Available in | 2.0 – |
Returns the CSS rules that can reproduce this font.
Default font families
| Family | Normal | Bold | Italic | Bold-Italic | Example |
|---|---|---|---|---|---|
| American Typewriter | AmericanTypewriter | AmericanTypewriter-Bold | Latin-AMZamz157½ßĽΔΩθφДЫжю | ||
| AppleGothic | AppleGothic | Korean-한국어-韓國語 | |||
| Arial | ArialMT | Arial-BoldMT | Arial-ItalicMT | Arial-BoldItalicMT | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| Arial Hebrew | ArialHebrew | ArialHebrew-Bold | Hebrew-עִבְרִית | ||
| Arial Rounded MT Bold | ArialRoundedMTBold | Latin-AMZamz157½ßĽΔΩθφДЫжю | |||
| Arial Unicode MS | ArialUnicodeMS | Unicode-AMZamz157½ßĽΔΩθφДЫжю | |||
| Courier | Courier | Courier-Bold | Courier-Oblique | Courier-BoldOblique | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| Courier New | CourierNewPSMT | CourierNewPS-BoldMT | CourierNewPS-ItalicMT | CourierNewPS-BoldItalicMT | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| DB LCD Temp | DBLCDTempBlack | 0123456789abcdef | |||
| Geeza Pro | GeezaPro | GeezaPro-Bold | Arabic-العربية/Farsi-فارسی | ||
| Georgia | Georgia | Georgia-Bold | Georgia-Italic | Georgia-BoldItalic | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| Heiti J | STHeitiJ-Light | STHeitiJ-Medium | Japanese-にほんご-ニヒンゴ-日本語 | ||
| Heiti K | STHeitiK-Light | STHeitiK-Medium | Korean-한국어-韓國語 | ||
| Heiti SC | STHeitiSC-Light | STHeitiSC-Medium | Simplified Chinese-简体中文 | ||
| Heiti TC | STHeitiTC-Light | STHeitiTC-Medium | Traditional Chinese-繁體中文 | ||
| Helvetica | Helvetica | Helvetica-Bold | Helvetica-Oblique | Helvetica-BoldOblique | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| Helvetica Neue | HelveticaNeue | HelveticaNeue-Bold | Latin-AMZamz157½ßĽΔΩθφДЫжю | ||
| Hiragino Kaku Gothic ProN | HiraKakuProN-W3 | HiraKakuProN-W6 | Japanese-にほんご-ニヒンゴ-日本語 | ||
| Marker Felt | MarkerFelt-Thin | Latin-AMZamz157½ßĽΔΩθφДЫжю | |||
| Thonburi | Thonburi | Thonburi-Bold | Thai-ภาษาไทย | ||
| Times New Roman | TimesNewRomanPSMT | TimesNewRomanPS-BoldMT | TimesNewRomanPS-ItalicMT | TimesNewRomanPS-BoldItalicMT | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| Trebuchet MS | TrebuchetMS | TrebuchetMS-Bold | TrebuchetMS-Italic | Trebuchet-BoldItalic | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| Verdana | Verdana | Verdana-Bold | Verdana-Italic | Verdana-BoldItalic | Latin-AMZamz157½ßĽΔΩθφДЫжю |
| Zapfino | Zapfino | Latin-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