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
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
160
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
260
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
700
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
10
1.2k
Engineer Career Talk
lycorp_recruit_jp
0
190
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
900
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
It's Worth the Effort
3n
183
27k
Being A Developer After 40
akosma
87
590k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Rails Girls Zürich Keynote
gr2m
94
13k
The Invisible Side of Design
smashingmag
298
50k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Adopting Sorbet at Scale
ufuk
73
9.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
How to train your dragon (web standard)
notwaldorf
88
5.7k
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