Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SwiftとCoreTextと文字組み
Search
Taishi Ikai
July 26, 2016
Technology
1
590
SwiftとCoreTextと文字組み
Taishi Ikai
July 26, 2016
Tweet
Share
More Decks by Taishi Ikai
See All by Taishi Ikai
日経電子版でApp内課金を導入した話 / Nikkei uses In-App Purchase
ikait
2
2.7k
安定的 60 fps をめざす / the way to 60 fps
ikait
19
5.5k
紙面ビューアーを支える サーバーレスアーキテクチャ / serverless architecture supports Nikkei's paper viewer
ikait
43
40k
Typography and Fonts と日本語フォントまわり
ikait
2
3k
Other Decks in Technology
See All in Technology
podman_update_2024-12
orimanabu
1
280
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
850
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
170
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
540
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
160
生成AIのガバナンスの全体像と現実解
fnifni
1
190
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
350
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
20241220_S3 tablesの使い方を検証してみた
handy
4
610
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
270
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
750
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
How GitHub (no longer) Works
holman
311
140k
Documentation Writing (for coders)
carmenintech
66
4.5k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Practical Orchestrator
shlominoach
186
10k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Typedesign – Prime Four
hannesfritz
40
2.4k
The Cult of Friendly URLs
andyhume
78
6.1k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
The Language of Interfaces
destraynor
154
24k
Agile that works and the tools we love
rasmusluckow
328
21k
Transcript
!.FMPOTXJGU ழࣂେࢤຊܦࡁ৽ฉࣾ 4XJGUͱ$PSF5FYUͱจࣈΈ
2 ழࣂେࢤʢ*LBJ5BJTIJʣ ຊܦࡁ৽ฉࣾͷΤϯδχΞ ࢴ໘ϏϡʔΞʔΞϓϦͷ։ൃ 4XJGU/PEFKT1ZUIPO ϝϩϯ ࣗݾհ
จࣈΈ͍ͯ͠·͔͢ʁ 3
4 ग़యIUUQPFDOFUTZPLV[BJNFMPO ΞʔϧεɾϑΣϘϦοτ ʢผ໊ʣϚεΫϝϩϯ ϝϩϯͷදछͰ͢ɻՌൽ৭Ͱશ໘ ʹඒ͍༷͕͠Ͱ͍ͯ·͢ɻ
5 ग़యIUUQPFDOFUTZPLV[BJNFMPO ΞʔϧεɾϑΣϘϦοτ ʢผ໊ʣϚεΫϝϩϯ ϝϩϯͷදछͰ͢ɻՌൽ৭Ͱશ໘ ʹඒ͍༷͕͠Ͱ͍ͯ·͢ɻ
6 ग़యIUUQPFDOFUTZPLV[BJNFMPO ΞʔϧεɾϑΣϘϦοτ ʢผ໊ʣϚεΫϝϩϯ ϝϩϯͷදछͰ͢ɻՌൽ৭Ͱશ໘ ʹඒ͍༷͕͠Ͱ͍ͯ·͢ɻ
7 ग़యIUUQPFDOFUTZPLV[BJNFMPO ΞʔϧεɾϑΣϘϦοτ ʢผ໊ʣϚεΫϝϩϯ ϝϩϯͷදछͰ͢ɻՌൽ৭Ͱશ໘ ʹඒ͍༷͕͠Ͱ͍ͯ·͢ɻ ʢผ໊ʣ
ΞʔϧεɾϑΣϘϦοτ ϝϩϯͷදछͰ͢ɻՌൽ৭Ͱશ໘ ʹඒ͍༷͕͠Ͱ͍ͯ·͢ɻ ʢผ໊ʣϚεΫϝϩϯ 8 ग़యIUUQPFDOFUTZPLV[BJNFMPO ʢผ໊ʣ ʢผ໊ʣ
9 ग़యIUUQPFDOFUTZPLV[BJNFMPO ΞʔϧεɾϑΣϘϦοτ ϝϩϯͷදछͰ͢ɻՌൽ৭Ͱશ໘ ʹඒ͍༷͕͠Ͱ͍ͯ·͢ɻ ʢผ໊ʣϚεΫϝϩϯ
10
ߦ಄ͷׅހΛͭΊΔฤ $PSF5FYUΛͬͨඳը 11
12 /4"UUSJCVUFE4USJOH͔Β$55ZQFTFUUFSΛੜ Ұߦͷ͞ %PVCMF Λ͋ͨ͑ͯɺվߦ͢Δ·Ͱͷจࣈ ΛಘΔ var
typesetter = CTTypesetterCreateWithAttributedString( attributedText) let count = CTTypesetterSuggestLineBreak( typesetter, 0, Double(lineWidth)) $PSF5FYUΛͬͨඳըʕߦ಄ͷׅހΛͭΊΔฤ ϝϩϯͷදछͰ͢ɻՌൽ৭Ͱશ໘ʹ ʹ 20 21 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
13 $55ZQFTFUUFS͔ΒҰߦͷ$5-JOFΛੜ ߦ಄͕࢝ΊׅހͳΒɺӈʹدͤΔͷ͞ΛಘΔ let ctline = CTTypesetterCreateLine(
typesetter, CFRangeMake(0, count)) let offsetX = fontSize / 2 // ͱΓ͋͑ͣϑΥϯταΠζͷʹ $PSF5FYUΛͬͨඳըʕߦ಄ͷׅހΛͭΊΔฤ ʢ
14 ӈʹدͤΔΛઃఆͯ͠ɺ$5-JOFΛඳը ߦ͘Γ͔͑͢ CGContextSetTextPosition(context, offsetX, offsetY) CTLineDraw(ctline,
context) $PSF5FYUΛͬͨඳըʕߦ಄ͷׅހΛͭΊΔฤ ʢผ໊ʣϚεΫϝϩϯ ʢผ໊ʣϚεΫϝϩϯ
15 /4"UUSJCVUFE4USJOHΑΓ̏ഒ͘Β͍͍ จࣈ͕ଟ͘ͳΔͱɺNT NT Λ͑Δ ͜ͱ ಛʹ$55ZQFTFUUFS$SFBUF8JUI"UUSJCVUFE4USJOH͕ॏ͍ ͍ͭ͜ͷ࣌ؒ "UUSJCVUFΛଟ͋ͯ͘Δͱ͘ͳΔ ύϑΥʔϚϯε
HJUIVCDPNJLBJU,FSO-BCFM 16 ߦ಄Ґஔௐɺࠨɾதԝɾӈɾۉἧ͑ɺ ྡ͢ΔͷִؒΛௐɺ۟ಡͷ͍ग़͠ͳͲ ϥΠϒϥϦΛ͍ͭͬͯ͘·͢
$PSF5FYU4XJGUͰͲ͏มԽ 17 ͓·͚
18 4XJGU 4XJGU $PSF(SBQIJDT
19 4XJGU 4XJGU $PSF(SBQIJDT
20 $PSF5FYU 4XJGU 4XJGU