20
5かるTextKit @hayashi311

5分でわかるText Kit

Embed Size (px)

Citation preview

Page 1: 5分でわかるText Kit

5分で分かるTextKit

@hayashi311

Page 2: 5分でわかるText Kit
Page 3: 5分でわかるText Kit

文字列 Bitmap画像

文字のレンダリング

is

Page 4: 5分でわかるText Kit

文字列 Bitmap画像?

Page 5: 5分でわかるText Kit

1000001

A

A AA

文字 グリフ

UIFont(name: "AppleMyungjo", size: 112)

Page 6: 5分でわかるText Kit

文字とグリフは1:1ではない

"fly"fly

Page 7: 5分でわかるText Kit

文字列 != グリフの列

Page 8: 5分でわかるText Kit

200px

250px

ABCDEF

16px

A B C3px

ABCDEFGHIJKL

Page 9: 5分でわかるText Kit

文字列 レイアウト=グリフの座標

let text = "あのイーハトーヴォのすきとおった風"

あのイーハトーヴォのすきとおった風

あのイーハトーヴォのすきとおった風

あのイーハトーヴォのすきとおった風

枠のサイズ行の間隔

Page 10: 5分でわかるText Kit

文字列 Bitmap画像

グリフ

フォントフォントサイズ

レイアウト(グリフの座標)

表示領域のサイズ文字の間隔改行のスタイル

Page 11: 5分でわかるText Kit

String Bitmap画像

グリフ

フォントフォントサイズ

レイアウト(グリフの座標)

表示領域のサイズ文字の間隔改行のスタイル

Page 12: 5分でわかるText Kit

String Bitmap画像

グリフ(NSTextStorage)NSAttributedString

レイアウト(グリフの座標)

表示領域のサイズ文字の間隔改行のスタイル

Page 13: 5分でわかるText Kit

String Bitmap画像

UIFont+CGGlyph

(NSTextStorage)NSAttributedString

レイアウト(グリフの座標)

表示領域のサイズ文字の間隔改行のスタイル

Page 14: 5分でわかるText Kit

String Bitmap画像

UIFont+CGGlyph

(NSTextStorage)NSAttributedString

レイアウト(グリフの座標)

NSTextContainer

Page 15: 5分でわかるText Kit

String Bitmap画像

UIFont+CGGlyph

(NSTextStorage)NSAttributedString

NSLayoutManager

NSTextContainer

Page 16: 5分でわかるText Kit

String Bitmap画像

Glyphの座標(NSTextStorage)

NSAttributedString

NSLayoutManager

NSTextContainer

.textStorage

.textContainers

監視

Page 17: 5分でわかるText Kit

Bitmap画像Glyphの座標

NSLayoutManager

.textStorage

.textContainers

タッチイベント

.glyphIndexForPoint(point:)

.characterIndexForGlyphAtIndex()

CGPoint(100,45)

グリフのIndex

文字のIndex

Page 18: 5分でわかるText Kit

UITextViewに感謝

Page 19: 5分でわかるText Kit

次回:UITextViewの闇

Page 20: 5分でわかるText Kit

We are hiring !