Xcode 7 / iOS 9 の日本語フォント周りについて気になったこと

# 中華フォント STHeiti が出なくなったはいいが……

Interface Builder（中身は実質的に iPhone Simulator）の日本語フォントが、かつての中華フォント「STHeiti/华文黑体」から違うものに変わったようです。まだ見やすくなりましたが、ただやはりこれも中華フォントな気がします。少なくともヒラギノではありません。

![ib6.4.png](https://qiita-image-store.s3.amazonaws.com/0/3603/c8dd637f-2b93-36e7-23ab-d089e5e93154.png)
_Xcode 6.4: STHeiti のキモイ感じが前面に出ています_

![ib.png](https://qiita-image-store.s3.amazonaws.com/0/3603/976ff91f-014b-10f3-d76b-d3c0474d51b2.png)
_Xcode 7: まだマシですが、ヒラギノ角ゴではないし、「直」が向こうの字体です。_

![heiti.png](https://qiita-image-store.s3.amazonaws.com/0/3603/068e33ed-0faa-9a03-2e8c-2c5f2dd346cd.png)
_STHeiti ライト（STXihei）。「て」のカーブや「ォ」のバランスなどが “特徴的”。_

SDKの中身を見てみたら「HeitiFallback」なる ttf ファイルが追加されていました。フォールバックとは「正しく表示できないフォントに対して代替のフォントを設定すること」を指すようですが、もしかしたら Heiti に対してのパッチでもあてられたのかもしれません。にしては IB の日本語フォント、特に漢字がまだおかしいのが気になります。

> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Fonts/LanguageSupport/HeitiFallback-Medium.ttf

> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Fonts/LanguageSupport/HeitiFallback-Light.ttf

# Interface Builder でヒラギノ各ゴ系を直接指定できない？

Interface Builder で Hiragino Kaku Gothic ProN ファミリーを直接指定できなくなったようです。<del>「Hiragino Sans」にすると一見それっぽくはなりますが、これは中国語向けのヒラギノ書体なので、Hiragino Kaku Gothic ProN とは別物です。明朝はあるのになぜ各ゴシックは選べなくなったのでしょうか……？ バグですかね。</del>
「Hiragino Kaku Gothic ProN」は「Hiragino Sans」ファミリーに置き換えられました。OS X El Capitan ではヒラギノ系がこの Hiragino Sans ファミリーに変更されたため、その影響だと思われます。
（なお、簡体中国語向けのヒラギノは「Hiragino Sans GB」でしたので、取り消し部分は間違いです。訂正いたします。）

![font64.png](https://qiita-image-store.s3.amazonaws.com/0/3603/c785cc38-310c-3728-73b9-5c39f0095916.png)
_Xcode 6.4: Hiragino Kaku Gothic ProN ファミリーが選べた_

![font7.png](https://qiita-image-store.s3.amazonaws.com/0/3603/7cfabdf7-7e63-d038-bdd8-cd26ac7d0da4.png)
_Xcode 7: Hiragino Sans ファミリーに置き換わった_

基本的にシステムフォントを指定することの方が多いとは思いますが、このような差異がありました。

## 気になったので UIFont からフォントファミリーを出力してみた

```objc
[UIFont familyNames]
```
```
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: Trebuchet MS
    Font name: Trebuchet-BoldItalic
    Font name: TrebuchetMS
    Font name: TrebuchetMS-Bold
    Font name: TrebuchetMS-Italic
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: 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
```

「Hiragino Sans」を見ると W3, W6 とあるので、かつての Hiragino Kaku Gothic ProN のそれと思われます。

```:抜粋
Family name: Hiragino Sans
    Font name: HiraginoSans-W3
    Font name: HiraginoSans-W6
```

San Francisco（SF***）が見当たらないのが気になります。

直接かつてのフォントファミリー名を指定したらどうなるのか試したら、PostScript 名が得られました。なので互換性に関しては維持されているのだと思います。

```objc
[UIFont fontNamesForFamilyName:@"Hiragino Kaku Gothic ProN"]
```
```
(
    "HiraKakuProN-W6",
    "HiraKakuProN-W3"
)
```

# シミュレータで中華フォントを検証

英語環境と日本語環境で確認しました。英語環境では（言語の優先順位から）中華フォントが採用され、日本語環境ではシステムフォントであるヒラギノが採用されました。これは今までどおりです。

なので、実質的に成果物であるアプリにはさほど影響はありません。（欧文書体が San Francisco に変更になったくらい。）強いて言えば、Interface Builder で見た目が若干キモイくらいですね。

![en.png](https://qiita-image-store.s3.amazonaws.com/0/3603/5c9a1f81-573f-d4d0-dc36-4c5092cb1111.png)
_英語環境（言語順番デフォルト）。上から、システムフォント/IBから指定、システムフォント/コードから指定、HiraKakuProN-W6/コードから指定_

![ja.png](https://qiita-image-store.s3.amazonaws.com/0/3603/9a29c9cc-cce8-2db5-09b7-0434b8694b3d.png)
_日本語環境。同条件_

# 参考資料等

http://ma9no.com/2014/12/13/heitl_iyada/
https://ja.wikipedia.org/wiki/ヒラギノ