关闭

(iPhone/iPad开发)在iOS系统中动态设置文本字体

标签: iosappleiphone文档
3445人阅读 评论(0) 收藏 举报
分类:

想单独指定某段文本字体类型,但是sdk文档中似乎没有iphone可用字体列表 ,找到一种方法,可以查看当前sdk可用字体类型

NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    NSArray *fontNames;
    NSInteger indFamily, indFont;
    for (indFamily=0; indFamily<[familyNames count]; ++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]);
        }
        [fontNames release];
    }
    [familyNames release];


sdk3.0下输出字体列表是:

2012-03-21 17:10:57.337 JustArrived[431:707] Family name: Thonburi
2012-03-21 17:10:57.347 JustArrived[431:707]     Font name: Thonburi-Bold
2012-03-21 17:10:57.358 JustArrived[431:707]     Font name: Thonburi
2012-03-21 17:10:57.363 JustArrived[431:707] Family name: Snell Roundhand
2012-03-21 17:10:57.368 JustArrived[431:707]     Font name: SnellRoundhand-Bold
2012-03-21 17:10:57.374 JustArrived[431:707]     Font name: SnellRoundhand-Black
2012-03-21 17:10:57.384 JustArrived[431:707]     Font name: SnellRoundhand
2012-03-21 17:10:57.394 JustArrived[431:707] Family name: Academy Engraved LET
2012-03-21 17:10:57.400 JustArrived[431:707]     Font name: AcademyEngravedLetPlain
2012-03-21 17:10:57.406 JustArrived[431:707] Family name: Marker Felt
2012-03-21 17:10:57.410 JustArrived[431:707]     Font name: MarkerFelt-Wide
2012-03-21 17:10:57.413 JustArrived[431:707]     Font name: MarkerFelt-Thin
2012-03-21 17:10:57.416 JustArrived[431:707] Family name: Geeza Pro
2012-03-21 17:10:57.419 JustArrived[431:707]     Font name: GeezaPro-Bold
2012-03-21 17:10:57.422 JustArrived[431:707]     Font name: GeezaPro
2012-03-21 17:10:57.425 JustArrived[431:707] Family name: Arial Rounded MT Bold
2012-03-21 17:10:57.428 JustArrived[431:707]     Font name: ArialRoundedMTBold
2012-03-21 17:10:57.432 JustArrived[431:707] Family name: Trebuchet MS
2012-03-21 17:10:57.435 JustArrived[431:707]     Font name: TrebuchetMS
2012-03-21 17:10:57.438 JustArrived[431:707]     Font name: TrebuchetMS-Bold
2012-03-21 17:10:57.442 JustArrived[431:707]     Font name: TrebuchetMS-Italic
2012-03-21 17:10:57.445 JustArrived[431:707]     Font name: Trebuchet-BoldItalic
2012-03-21 17:10:57.448 JustArrived[431:707] Family name: Arial
2012-03-21 17:10:57.451 JustArrived[431:707]     Font name: Arial-BoldMT
2012-03-21 17:10:57.454 JustArrived[431:707]     Font name: ArialMT
2012-03-21 17:10:57.457 JustArrived[431:707]     Font name: Arial-ItalicMT
2012-03-21 17:10:57.460 JustArrived[431:707]     Font name: Arial-BoldItalicMT
2012-03-21 17:10:57.463 JustArrived[431:707] Family name: Marion
2012-03-21 17:10:57.466 JustArrived[431:707]     Font name: Marion-Regular
2012-03-21 17:10:57.469 JustArrived[431:707]     Font name: Marion-Bold
2012-03-21 17:10:57.473 JustArrived[431:707]     Font name: Marion-Italic
2012-03-21 17:10:57.476 JustArrived[431:707] Family name: Gurmukhi MN
2012-03-21 17:10:57.479 JustArrived[431:707]     Font name: GurmukhiMN
2012-03-21 17:10:57.482 JustArrived[431:707]     Font name: GurmukhiMN-Bold
2012-03-21 17:10:57.485 JustArrived[431:707] Family name: Malayalam Sangam MN
2012-03-21 17:10:57.488 JustArrived[431:707]     Font name: MalayalamSangamMN-Bold
2012-03-21 17:10:57.491 JustArrived[431:707]     Font name: MalayalamSangamMN
2012-03-21 17:10:57.494 JustArrived[431:707] Family name: Bradley Hand
2012-03-21 17:10:57.497 JustArrived[431:707]     Font name: BradleyHandITCTT-Bold
2012-03-21 17:10:57.501 JustArrived[431:707] Family name: Kannada Sangam MN
2012-03-21 17:10:57.504 JustArrived[431:707]     Font name: KannadaSangamMN
2012-03-21 17:10:57.507 JustArrived[431:707]     Font name: KannadaSangamMN-Bold
2012-03-21 17:10:57.510 JustArrived[431:707] Family name: Bodoni 72 Oldstyle
2012-03-21 17:10:57.513 JustArrived[431:707]     Font name: BodoniSvtyTwoOSITCTT-Book
2012-03-21 17:10:57.516 JustArrived[431:707]     Font name: BodoniSvtyTwoOSITCTT-Bold
2012-03-21 17:10:57.519 JustArrived[431:707]     Font name: BodoniSvtyTwoOSITCTT-BookIt
2012-03-21 17:10:57.522 JustArrived[431:707] Family name: Cochin
2012-03-21 17:10:57.526 JustArrived[431:707]     Font name: Cochin
2012-03-21 17:10:57.529 JustArrived[431:707]     Font name: Cochin-BoldItalic
2012-03-21 17:10:57.532 JustArrived[431:707]     Font name: Cochin-Italic
2012-03-21 17:10:57.535 JustArrived[431:707]     Font name: Cochin-Bold
2012-03-21 17:10:57.539 JustArrived[431:707] Family name: Sinhala Sangam MN
2012-03-21 17:10:57.543 JustArrived[431:707]     Font name: SinhalaSangamMN
2012-03-21 17:10:57.546 JustArrived[431:707]     Font name: SinhalaSangamMN-Bold
2012-03-21 17:10:57.549 JustArrived[431:707] Family name: Hiragino Kaku Gothic ProN
2012-03-21 17:10:57.552 JustArrived[431:707]     Font name: HiraKakuProN-W6
2012-03-21 17:10:57.555 JustArrived[431:707]     Font name: HiraKakuProN-W3
2012-03-21 17:10:57.558 JustArrived[431:707] Family name: Papyrus
2012-03-21 17:10:57.561 JustArrived[431:707]     Font name: Papyrus-Condensed
2012-03-21 17:10:57.564 JustArrived[431:707]     Font name: Papyrus
2012-03-21 17:10:57.567 JustArrived[431:707] Family name: Verdana
2012-03-21 17:10:57.570 JustArrived[431:707]     Font name: Verdana
2012-03-21 17:10:57.573 JustArrived[431:707]     Font name: Verdana-Bold
2012-03-21 17:10:57.576 JustArrived[431:707]     Font name: Verdana-BoldItalic
2012-03-21 17:10:57.579 JustArrived[431:707]     Font name: Verdana-Italic
2012-03-21 17:10:57.582 JustArrived[431:707] Family name: Zapf Dingbats
2012-03-21 17:10:57.585 JustArrived[431:707]     Font name: ZapfDingbatsITC
2012-03-21 17:10:57.588 JustArrived[431:707] Family name: Courier
2012-03-21 17:10:57.591 JustArrived[431:707]     Font name: Courier-Bold
2012-03-21 17:10:57.593 JustArrived[431:707]     Font name: Courier
2012-03-21 17:10:57.596 JustArrived[431:707]     Font name: Courier-BoldOblique
2012-03-21 17:10:57.599 JustArrived[431:707]     Font name: Courier-Oblique
2012-03-21 17:10:57.602 JustArrived[431:707] Family name: Hoefler Text
2012-03-21 17:10:57.605 JustArrived[431:707]     Font name: HoeflerText-Black
2012-03-21 17:10:57.608 JustArrived[431:707]     Font name: HoeflerText-Italic
2012-03-21 17:10:57.611 JustArrived[431:707]     Font name: HoeflerText-Regular
2012-03-21 17:10:57.614 JustArrived[431:707]     Font name: HoeflerText-BlackItalic
2012-03-21 17:10:57.617 JustArrived[431:707] Family name: Euphemia UCAS
2012-03-21 17:10:57.620 JustArrived[431:707]     Font name: EuphemiaUCAS-Bold
2012-03-21 17:10:57.623 JustArrived[431:707]     Font name: EuphemiaUCAS
2012-03-21 17:10:57.626 JustArrived[431:707]     Font name: EuphemiaUCAS-Italic
2012-03-21 17:10:57.629 JustArrived[431:707] Family name: Helvetica
2012-03-21 17:10:57.633 JustArrived[431:707]     Font name: Helvetica-LightOblique
2012-03-21 17:10:57.636 JustArrived[431:707]     Font name: Helvetica
2012-03-21 17:10:57.639 JustArrived[431:707]     Font name: Helvetica-Oblique
2012-03-21 17:10:57.642 JustArrived[431:707]     Font name: Helvetica-BoldOblique
2012-03-21 17:10:57.645 JustArrived[431:707]     Font name: Helvetica-Bold
2012-03-21 17:10:57.647 JustArrived[431:707]     Font name: Helvetica-Light
2012-03-21 17:10:57.650 JustArrived[431:707] Family name: Hiragino Mincho ProN
2012-03-21 17:10:57.653 JustArrived[431:707]     Font name: HiraMinProN-W3
2012-03-21 17:10:57.656 JustArrived[431:707]     Font name: HiraMinProN-W6
2012-03-21 17:10:57.659 JustArrived[431:707] Family name: Bodoni Ornaments
2012-03-21 17:10:57.662 JustArrived[431:707]     Font name: BodoniOrnamentsITCTT
2012-03-21 17:10:57.665 JustArrived[431:707] Family name: Apple Color Emoji
2012-03-21 17:10:57.667 JustArrived[431:707]     Font name: AppleColorEmoji
2012-03-21 17:10:57.670 JustArrived[431:707] Family name: Optima
2012-03-21 17:10:57.673 JustArrived[431:707]     Font name: Optima-ExtraBlack
2012-03-21 17:10:57.676 JustArrived[431:707]     Font name: Optima-Italic
2012-03-21 17:10:57.679 JustArrived[431:707]     Font name: Optima-Regular
2012-03-21 17:10:57.682 JustArrived[431:707]     Font name: Optima-BoldItalic
2012-03-21 17:10:57.685 JustArrived[431:707]     Font name: Optima-Bold
2012-03-21 17:10:57.688 JustArrived[431:707] Family name: Gujarati Sangam MN
2012-03-21 17:10:57.691 JustArrived[431:707]     Font name: GujaratiSangamMN
2012-03-21 17:10:57.694 JustArrived[431:707]     Font name: GujaratiSangamMN-Bold
2012-03-21 17:10:57.697 JustArrived[431:707] Family name: Devanagari Sangam MN
2012-03-21 17:10:57.700 JustArrived[431:707]     Font name: DevanagariSangamMN
2012-03-21 17:10:57.703 JustArrived[431:707]     Font name: DevanagariSangamMN-Bold
2012-03-21 17:10:57.706 JustArrived[431:707] Family name: Times New Roman
2012-03-21 17:10:57.709 JustArrived[431:707]     Font name: TimesNewRomanPS-ItalicMT
2012-03-21 17:10:57.712 JustArrived[431:707]     Font name: TimesNewRomanPS-BoldMT
2012-03-21 17:10:57.714 JustArrived[431:707]     Font name: TimesNewRomanPSMT
2012-03-21 17:10:57.717 JustArrived[431:707]     Font name: TimesNewRomanPS-BoldItalicMT
2012-03-21 17:10:57.720 JustArrived[431:707] Family name: Kailasa
2012-03-21 17:10:57.723 JustArrived[431:707]     Font name: Kailasa
2012-03-21 17:10:57.726 JustArrived[431:707]     Font name: Kailasa-Bold
2012-03-21 17:10:57.729 JustArrived[431:707] Family name: Telugu Sangam MN
2012-03-21 17:10:57.733 JustArrived[431:707]     Font name: TeluguSangamMN-Bold
2012-03-21 17:10:57.736 JustArrived[431:707]     Font name: TeluguSangamMN
2012-03-21 17:10:57.739 JustArrived[431:707] Family name: Heiti SC
2012-03-21 17:10:57.742 JustArrived[431:707]     Font name: STHeitiSC-Medium
2012-03-21 17:10:57.745 JustArrived[431:707]     Font name: STHeitiSC-Light
2012-03-21 17:10:57.748 JustArrived[431:707] Family name: Futura
2012-03-21 17:10:57.751 JustArrived[431:707]     Font name: Futura-Medium
2012-03-21 17:10:57.754 JustArrived[431:707]     Font name: Futura-CondensedExtraBold
2012-03-21 17:10:57.757 JustArrived[431:707]     Font name: Futura-CondensedMedium
2012-03-21 17:10:57.760 JustArrived[431:707]     Font name: Futura-MediumItalic
2012-03-21 17:10:57.763 JustArrived[431:707] Family name: Bodoni 72
2012-03-21 17:10:57.766 JustArrived[431:707]     Font name: BodoniSvtyTwoITCTT-BookIta
2012-03-21 17:10:57.769 JustArrived[431:707]     Font name: BodoniSvtyTwoITCTT-Book
2012-03-21 17:10:57.772 JustArrived[431:707]     Font name: BodoniSvtyTwoITCTT-Bold
2012-03-21 17:10:57.775 JustArrived[431:707] Family name: Baskerville
2012-03-21 17:10:57.778 JustArrived[431:707]     Font name: Baskerville-SemiBoldItalic
2012-03-21 17:10:57.781 JustArrived[431:707]     Font name: Baskerville-Bold
2012-03-21 17:10:57.784 JustArrived[431:707]     Font name: Baskerville-Italic
2012-03-21 17:10:57.787 JustArrived[431:707]     Font name: Baskerville-BoldItalic
2012-03-21 17:10:57.791 JustArrived[431:707]     Font name: Baskerville-SemiBold
2012-03-21 17:10:57.793 JustArrived[431:707]     Font name: Baskerville
2012-03-21 17:10:57.796 JustArrived[431:707] Family name: Chalkboard SE
2012-03-21 17:10:57.799 JustArrived[431:707]     Font name: ChalkboardSE-Regular
2012-03-21 17:10:57.802 JustArrived[431:707]     Font name: ChalkboardSE-Bold
2012-03-21 17:10:57.805 JustArrived[431:707]     Font name: ChalkboardSE-Light
2012-03-21 17:10:57.808 JustArrived[431:707] Family name: Heiti TC
2012-03-21 17:10:57.811 JustArrived[431:707]     Font name: STHeitiTC-Medium
2012-03-21 17:10:57.814 JustArrived[431:707]     Font name: STHeitiTC-Light
2012-03-21 17:10:57.817 JustArrived[431:707] Family name: Copperplate
2012-03-21 17:10:57.820 JustArrived[431:707]     Font name: Copperplate
2012-03-21 17:10:57.823 JustArrived[431:707]     Font name: Copperplate-Light
2012-03-21 17:10:57.826 JustArrived[431:707]     Font name: Copperplate-Bold
2012-03-21 17:10:57.829 JustArrived[431:707] Family name: Party LET
2012-03-21 17:10:57.834 JustArrived[431:707]     Font name: PartyLetPlain
2012-03-21 17:10:57.835 JustArrived[431:707] Family name: American Typewriter
2012-03-21 17:10:57.839 JustArrived[431:707]     Font name: AmericanTypewriter-CondensedLight
2012-03-21 17:10:57.841 JustArrived[431:707]     Font name: AmericanTypewriter-Light
2012-03-21 17:10:57.844 JustArrived[431:707]     Font name: AmericanTypewriter-Bold
2012-03-21 17:10:57.847 JustArrived[431:707]     Font name: AmericanTypewriter
2012-03-21 17:10:57.850 JustArrived[431:707]     Font name: AmericanTypewriter-CondensedBold
2012-03-21 17:10:57.853 JustArrived[431:707]     Font name: AmericanTypewriter-Condensed
2012-03-21 17:10:57.856 JustArrived[431:707] Family name: AppleGothic
2012-03-21 17:10:57.859 JustArrived[431:707]     Font name: AppleGothic
2012-03-21 17:10:57.862 JustArrived[431:707] Family name: Bangla Sangam MN
2012-03-21 17:10:57.864 JustArrived[431:707]     Font name: BanglaSangamMN-Bold
2012-03-21 17:10:57.867 JustArrived[431:707]     Font name: BanglaSangamMN
2012-03-21 17:10:57.872 JustArrived[431:707] Family name: Noteworthy
2012-03-21 17:10:57.875 JustArrived[431:707]     Font name: Noteworthy-Light
2012-03-21 17:10:57.883 JustArrived[431:707]     Font name: Noteworthy-Bold
2012-03-21 17:10:57.884 JustArrived[431:707] Family name: Zapfino
2012-03-21 17:10:57.888 JustArrived[431:707]     Font name: Zapfino
2012-03-21 17:10:57.891 JustArrived[431:707] Family name: Tamil Sangam MN
2012-03-21 17:10:57.894 JustArrived[431:707]     Font name: TamilSangamMN
2012-03-21 17:10:57.897 JustArrived[431:707]     Font name: TamilSangamMN-Bold
2012-03-21 17:10:57.900 JustArrived[431:707] Family name: DB LCD Temp
2012-03-21 17:10:57.903 JustArrived[431:707]     Font name: DBLCDTempBlack
2012-03-21 17:10:57.906 JustArrived[431:707] Family name: Arial Hebrew
2012-03-21 17:10:57.909 JustArrived[431:707]     Font name: ArialHebrew
2012-03-21 17:10:57.912 JustArrived[431:707]     Font name: ArialHebrew-Bold
2012-03-21 17:10:57.915 JustArrived[431:707] Family name: Chalkduster
2012-03-21 17:10:57.918 JustArrived[431:707]     Font name: Chalkduster
2012-03-21 17:10:57.921 JustArrived[431:707] Family name: Georgia
2012-03-21 17:10:57.924 JustArrived[431:707]     Font name: Georgia-Italic
2012-03-21 17:10:57.927 JustArrived[431:707]     Font name: Georgia-BoldItalic
2012-03-21 17:10:57.930 JustArrived[431:707]     Font name: Georgia-Bold
2012-03-21 17:10:57.934 JustArrived[431:707]     Font name: Georgia
2012-03-21 17:10:57.937 JustArrived[431:707] Family name: Helvetica Neue
2012-03-21 17:10:57.940 JustArrived[431:707]     Font name: HelveticaNeue-Bold
2012-03-21 17:10:57.943 JustArrived[431:707]     Font name: HelveticaNeue-CondensedBlack
2012-03-21 17:10:57.946 JustArrived[431:707]     Font name: HelveticaNeue-Medium
2012-03-21 17:10:57.949 JustArrived[431:707]     Font name: HelveticaNeue
2012-03-21 17:10:57.952 JustArrived[431:707]     Font name: HelveticaNeue-Light
2012-03-21 17:10:57.954 JustArrived[431:707]     Font name: HelveticaNeue-CondensedBold
2012-03-21 17:10:57.957 JustArrived[431:707]     Font name: HelveticaNeue-LightItalic
2012-03-21 17:10:57.960 JustArrived[431:707]     Font name: HelveticaNeue-UltraLightItalic
2012-03-21 17:10:57.963 JustArrived[431:707]     Font name: HelveticaNeue-UltraLight
2012-03-21 17:10:57.966 JustArrived[431:707]     Font name: HelveticaNeue-BoldItalic
2012-03-21 17:10:57.969 JustArrived[431:707]     Font name: HelveticaNeue-Italic
2012-03-21 17:10:57.972 JustArrived[431:707] Family name: Gill Sans
2012-03-21 17:10:57.975 JustArrived[431:707]     Font name: GillSans-LightItalic
2012-03-21 17:10:57.978 JustArrived[431:707]     Font name: GillSans-BoldItalic
2012-03-21 17:10:57.981 JustArrived[431:707]     Font name: GillSans-Italic
2012-03-21 17:10:57.984 JustArrived[431:707]     Font name: GillSans
2012-03-21 17:10:57.987 JustArrived[431:707]     Font name: GillSans-Bold
2012-03-21 17:10:57.990 JustArrived[431:707]     Font name: GillSans-Light
2012-03-21 17:10:57.993 JustArrived[431:707] Family name: Palatino
2012-03-21 17:10:57.996 JustArrived[431:707]     Font name: Palatino-Roman
2012-03-21 17:10:57.999 JustArrived[431:707]     Font name: Palatino-Bold
2012-03-21 17:10:58.002 JustArrived[431:707]     Font name: Palatino-BoldItalic
2012-03-21 17:10:58.005 JustArrived[431:707]     Font name: Palatino-Italic
2012-03-21 17:10:58.008 JustArrived[431:707] Family name: Courier New
2012-03-21 17:10:58.011 JustArrived[431:707]     Font name: CourierNewPSMT
2012-03-21 17:10:58.014 JustArrived[431:707]     Font name: CourierNewPS-BoldMT
2012-03-21 17:10:58.017 JustArrived[431:707]     Font name: CourierNewPS-BoldItalicMT
2012-03-21 17:10:58.020 JustArrived[431:707]     Font name: CourierNewPS-ItalicMT
2012-03-21 17:10:58.023 JustArrived[431:707] Family name: Oriya Sangam MN
2012-03-21 17:10:58.026 JustArrived[431:707]     Font name: OriyaSangamMN-Bold
2012-03-21 17:10:58.029 JustArrived[431:707]     Font name: OriyaSangamMN
2012-03-21 17:10:58.032 JustArrived[431:707] Family name: Didot
2012-03-21 17:10:58.036 JustArrived[431:707]     Font name: Didot-Italic
2012-03-21 17:10:58.039 JustArrived[431:707]     Font name: Didot
2012-03-21 17:10:58.042 JustArrived[431:707]     Font name: Didot-Bold
2012-03-21 17:10:58.045 JustArrived[431:707] Family name: Bodoni 72 Smallcaps
2012-03-21 17:10:58.047 JustArrived[431:707]     Font name: BodoniSvtyTwoSCITCTT-Book



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:868085次
    • 积分:8148
    • 等级:
    • 排名:第2467名
    • 原创:126篇
    • 转载:74篇
    • 译文:0篇
    • 评论:110条
    关于本人
    混迹于移动互联网领域,人在北京开发Android、iPhone、iPad软件,希望能打造出中国一流的Android、iOS软件,乐交各行业朋友, Email:andypan1314@gmail.com