iOS SDKで利用できるフォント名一覧を取得するスニペット
今回はちょっと短め。
UIFontのメソッドを使って次のように書くことで、実行環境にインストールされている(&利用できる)フォント名の一覧を取得できます。
SKLabelNode(fontNamed: ... )
と書いてはみたものの、さて何を指定すればよかったんだっけ?と困ったときに役立ちます。
for family in UIFont.familyNames() { print("Font family name: \(family)") for fontName in UIFont.fontNamesForFamilyName(family) { print(" > Font name: \(fontName)") } }
参考サイト
参考:iOS9.2での取得結果
ついでに、iOS9.2の実機上で上記ソースを実行した結果を以下に残しておきます。
Family name: Copperplate >Font name: Copperplate-Light >Font name: Copperplate >Font name: Copperplate-Bold Family name: Heiti SC Family name: Iowan Old Style >Font name: IowanOldStyle-Italic >Font name: IowanOldStyle-Roman >Font name: IowanOldStyle-BoldItalic >Font name: IowanOldStyle-Bold Family name: Kohinoor Telugu >Font name: KohinoorTelugu-Regular >Font name: KohinoorTelugu-Medium >Font name: KohinoorTelugu-Light Family name: Thonburi >Font name: Thonburi >Font name: Thonburi-Bold >Font name: Thonburi-Light Family name: Heiti TC Family name: Courier New >Font name: CourierNewPS-BoldMT >Font name: CourierNewPS-ItalicMT >Font name: CourierNewPSMT >Font name: CourierNewPS-BoldItalicMT Family name: Gill Sans >Font name: GillSans-Italic >Font name: GillSans-Bold >Font name: GillSans-BoldItalic >Font name: GillSans-LightItalic >Font name: GillSans >Font name: GillSans-Light >Font name: GillSans-SemiBold >Font name: GillSans-SemiBoldItalic >Font name: GillSans-UltraBold Family name: Apple SD Gothic Neo >Font name: AppleSDGothicNeo-Bold >Font name: AppleSDGothicNeo-Thin >Font name: AppleSDGothicNeo-UltraLight >Font name: AppleSDGothicNeo-Regular >Font name: AppleSDGothicNeo-Light >Font name: AppleSDGothicNeo-Medium >Font name: AppleSDGothicNeo-SemiBold Family name: Marker Felt >Font name: MarkerFelt-Thin >Font name: MarkerFelt-Wide Family name: Avenir Next Condensed >Font name: AvenirNextCondensed-BoldItalic >Font name: AvenirNextCondensed-Heavy >Font name: AvenirNextCondensed-Medium >Font name: AvenirNextCondensed-Regular >Font name: AvenirNextCondensed-HeavyItalic >Font name: AvenirNextCondensed-MediumItalic >Font name: AvenirNextCondensed-Italic >Font name: AvenirNextCondensed-UltraLightItalic >Font name: AvenirNextCondensed-UltraLight >Font name: AvenirNextCondensed-DemiBold >Font name: AvenirNextCondensed-Bold >Font name: AvenirNextCondensed-DemiBoldItalic Family name: Tamil Sangam MN >Font name: TamilSangamMN >Font name: TamilSangamMN-Bold Family name: Helvetica Neue >Font name: HelveticaNeue-Italic >Font name: HelveticaNeue-Bold >Font name: HelveticaNeue-UltraLight >Font name: HelveticaNeue-CondensedBlack >Font name: HelveticaNeue-BoldItalic >Font name: HelveticaNeue-CondensedBold >Font name: HelveticaNeue-Medium >Font name: HelveticaNeue-Light >Font name: HelveticaNeue-Thin >Font name: HelveticaNeue-ThinItalic >Font name: HelveticaNeue-LightItalic >Font name: HelveticaNeue-UltraLightItalic >Font name: HelveticaNeue-MediumItalic >Font name: HelveticaNeue Family name: Gurmukhi MN >Font name: GurmukhiMN-Bold >Font name: GurmukhiMN Family name: Times New Roman >Font name: TimesNewRomanPSMT >Font name: TimesNewRomanPS-BoldItalicMT >Font name: TimesNewRomanPS-ItalicMT >Font name: TimesNewRomanPS-BoldMT Family name: Georgia >Font name: Georgia-BoldItalic >Font name: Georgia >Font name: Georgia-Italic >Font name: Georgia-Bold Family name: Apple Color Emoji >Font name: AppleColorEmoji Family name: Arial Rounded MT Bold >Font name: ArialRoundedMTBold Family name: Kailasa >Font name: Kailasa-Bold >Font name: Kailasa Family name: Kohinoor Devanagari >Font name: KohinoorDevanagari-Light >Font name: KohinoorDevanagari-Regular >Font name: KohinoorDevanagari-Semibold Family name: Kohinoor Bangla >Font name: KohinoorBangla-Semibold >Font name: KohinoorBangla-Regular >Font name: KohinoorBangla-Light Family name: Chalkboard SE >Font name: ChalkboardSE-Bold >Font name: ChalkboardSE-Light >Font name: ChalkboardSE-Regular Family name: Sinhala Sangam MN >Font name: SinhalaSangamMN-Bold >Font name: SinhalaSangamMN Family name: PingFang TC >Font name: PingFangTC-Medium >Font name: PingFangTC-Regular >Font name: PingFangTC-Light >Font name: PingFangTC-Ultralight >Font name: PingFangTC-Semibold >Font name: PingFangTC-Thin Family name: Gujarati Sangam MN >Font name: GujaratiSangamMN-Bold >Font name: GujaratiSangamMN Family name: Damascus >Font name: DamascusLight >Font name: DamascusBold >Font name: DamascusSemiBold >Font name: DamascusMedium >Font name: Damascus Family name: Noteworthy >Font name: Noteworthy-Light >Font name: Noteworthy-Bold Family name: Geeza Pro >Font name: GeezaPro >Font name: GeezaPro-Bold Family name: Avenir >Font name: Avenir-Medium >Font name: Avenir-HeavyOblique >Font name: Avenir-Book >Font name: Avenir-Light >Font name: Avenir-Roman >Font name: Avenir-BookOblique >Font name: Avenir-Black >Font name: Avenir-MediumOblique >Font name: Avenir-BlackOblique >Font name: Avenir-Heavy >Font name: Avenir-LightOblique >Font name: Avenir-Oblique Family name: Academy Engraved LET >Font name: AcademyEngravedLetPlain Family name: Mishafi >Font name: DiwanMishafi Family name: Futura >Font name: Futura-CondensedMedium >Font name: Futura-CondensedExtraBold >Font name: Futura-Medium >Font name: Futura-MediumItalic Family name: Farah >Font name: Farah Family name: Kannada Sangam MN >Font name: KannadaSangamMN >Font name: KannadaSangamMN-Bold Family name: Arial Hebrew >Font name: ArialHebrew-Bold >Font name: ArialHebrew-Light >Font name: ArialHebrew Family name: Arial >Font name: ArialMT >Font name: Arial-BoldItalicMT >Font name: Arial-BoldMT >Font name: Arial-ItalicMT Family name: Party LET >Font name: PartyLetPlain Family name: Chalkduster >Font name: Chalkduster Family name: Hoefler Text >Font name: HoeflerText-Italic >Font name: HoeflerText-Regular >Font name: HoeflerText-Black >Font name: HoeflerText-BlackItalic Family name: Optima >Font name: Optima-Regular >Font name: Optima-ExtraBlack >Font name: Optima-BoldItalic >Font name: Optima-Italic >Font name: Optima-Bold Family name: Palatino >Font name: Palatino-Bold >Font name: Palatino-Roman >Font name: Palatino-BoldItalic >Font name: Palatino-Italic Family name: Lao Sangam MN >Font name: LaoSangamMN Family name: Malayalam Sangam MN >Font name: MalayalamSangamMN-Bold >Font name: MalayalamSangamMN Family name: Al Nile >Font name: AlNile-Bold >Font name: AlNile Family name: Bradley Hand >Font name: BradleyHandITCTT-Bold Family name: PingFang HK >Font name: PingFangHK-Ultralight >Font name: PingFangHK-Semibold >Font name: PingFangHK-Thin >Font name: PingFangHK-Light >Font name: PingFangHK-Regular >Font name: PingFangHK-Medium Family name: Crashlytics >Font name: Crashlytics Family name: Helvetica >Font name: Helvetica-Bold >Font name: Helvetica >Font name: Helvetica-LightOblique >Font name: Helvetica-Oblique >Font name: Helvetica-BoldOblique >Font name: Helvetica-Light Family name: Courier >Font name: Courier-BoldOblique >Font name: Courier >Font name: Courier-Bold >Font name: Courier-Oblique Family name: Cochin >Font name: Cochin-Bold >Font name: Cochin >Font name: Cochin-Italic >Font name: Cochin-BoldItalic Family name: Trebuchet MS >Font name: Trebuchet-BoldItalic >Font name: TrebuchetMS >Font name: TrebuchetMS-Bold >Font name: TrebuchetMS-Italic Family name: Hiragino Mincho ProN >Font name: HiraMinProN-W6 >Font name: HiraMinProN-W3 Family name: Devanagari Sangam MN >Font name: DevanagariSangamMN >Font name: DevanagariSangamMN-Bold Family name: Oriya Sangam MN >Font name: OriyaSangamMN >Font name: OriyaSangamMN-Bold Family name: Snell Roundhand >Font name: SnellRoundhand-Bold >Font name: SnellRoundhand >Font name: SnellRoundhand-Black Family name: Zapf Dingbats >Font name: ZapfDingbatsITC Family name: Bodoni 72 >Font name: BodoniSvtyTwoITCTT-Bold >Font name: BodoniSvtyTwoITCTT-Book >Font name: BodoniSvtyTwoITCTT-BookIta Family name: Verdana >Font name: Verdana-Italic >Font name: Verdana-BoldItalic >Font name: Verdana >Font name: Verdana-Bold Family name: American Typewriter >Font name: AmericanTypewriter-CondensedLight >Font name: AmericanTypewriter >Font name: AmericanTypewriter-CondensedBold >Font name: AmericanTypewriter-Light >Font name: AmericanTypewriter-Bold >Font name: AmericanTypewriter-Condensed Family name: Avenir Next >Font name: AvenirNext-UltraLight >Font name: AvenirNext-UltraLightItalic >Font name: AvenirNext-Bold >Font name: AvenirNext-BoldItalic >Font name: AvenirNext-DemiBold >Font name: AvenirNext-DemiBoldItalic >Font name: AvenirNext-Medium >Font name: AvenirNext-HeavyItalic >Font name: AvenirNext-Heavy >Font name: AvenirNext-Italic >Font name: AvenirNext-Regular >Font name: AvenirNext-MediumItalic Family name: Baskerville >Font name: Baskerville-Italic >Font name: Baskerville-SemiBold >Font name: Baskerville-BoldItalic >Font name: Baskerville-SemiBoldItalic >Font name: Baskerville-Bold >Font name: Baskerville Family name: Khmer Sangam MN >Font name: KhmerSangamMN Family name: Didot >Font name: Didot-Italic >Font name: Didot-Bold >Font name: Didot Family name: Savoye LET >Font name: SavoyeLetPlain Family name: Bodoni Ornaments >Font name: BodoniOrnamentsITCTT Family name: Symbol >Font name: Symbol Family name: Menlo >Font name: Menlo-Italic >Font name: Menlo-Bold >Font name: Menlo-Regular >Font name: Menlo-BoldItalic Family name: Bodoni 72 Smallcaps >Font name: BodoniSvtyTwoSCITCTT-Book Family name: Papyrus >Font name: Papyrus >Font name: Papyrus-Condensed Family name: Hiragino Sans >Font name: HiraginoSans-W3 >Font name: HiraginoSans-W6 Family name: PingFang SC >Font name: PingFangSC-Ultralight >Font name: PingFangSC-Regular >Font name: PingFangSC-Semibold >Font name: PingFangSC-Thin >Font name: PingFangSC-Light >Font name: PingFangSC-Medium Family name: Euphemia UCAS >Font name: EuphemiaUCAS-Italic >Font name: EuphemiaUCAS >Font name: EuphemiaUCAS-Bold Family name: Telugu Sangam MN Family name: Bangla Sangam MN Family name: Zapfino >Font name: Zapfino Family name: Bodoni 72 Oldstyle >Font name: BodoniSvtyTwoOSITCTT-Book >Font name: BodoniSvtyTwoOSITCTT-Bold >Font name: BodoniSvtyTwoOSITCTT-BookIt