NSString UIKit AdditionsにあるsizeWithFont:は、文字列を指定フォントで表示した時の表示サイズを求めるメソッドとされている。 ところがこれ、横幅は正しいのだが、縦幅は正しくないことがある。 表示幅が取得値(size.height)より大きいことがあるのだ。 どのような場合にそうなるか。 指定フォントが英字フォントで、文字列に日本語を含む場合がそれに当たる。 この場合、英字部分は指定フォントが使われるが、日本語に関しては代替フォントが使われる。 例えば、標準的フォントとしてよく使われるHelveticaは英字フォントであり、実は日本語は含まない。それでも日本語も表示できるのは、この代替機能があるからだ。絵文字もこの機能によって、どのフォントでも表示できるようになっている。 (フォントが実際のところどの文字コードに相当するフォントを持っているかは、FontBo