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
600
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
AIアプリケーション開発でAzure AI Searchを使いこなすためには
isidaitc
1
120
Goで実践するBFP
hiroyaterui
1
120
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
2.4k
月間60万ユーザーを抱える 個人開発サービス「Walica」の 技術スタック変遷
miyachin
1
140
Cloudflareで実現する AIエージェント ワークフロー基盤
kmd09
0
290
When Windows Meets Kubernetes…
pichuang
0
310
データ基盤におけるIaCの重要性とその運用
mtpooh
4
530
Bring Your Own Container: When Containers Turn the Key to EDR Bypass/byoc-avtokyo2024
tkmru
0
860
0→1事業こそPMは営業すべし / pmconf #落選お披露目 / PM should do sales in zero to one
roki_n_
PRO
1
1.5k
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
160
AWSサービスアップデート 2024/12 Part3
nrinetcom
PRO
0
140
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Cult of Friendly URLs
andyhume
78
6.1k
Building Applications with DynamoDB
mza
93
6.2k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Side Projects
sachag
452
42k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Designing for Performance
lara
604
68k
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