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
コロプラのオンボーディングを採用から語りたい
colopl
5
940
Evolving Architecture
rainerhahnekamp
3
250
AWS Community Builderのススメ - みんなもCommunity Builderに応募しよう! -
smt7174
0
150
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!座学①
siyuanzh09
0
110
When Windows Meets Kubernetes…
pichuang
0
300
🌏丸い地球を効率的に平たくする 〜🗺️地図の幾何学とWeb地図技術〜
syotasasaki593876
0
140
2025年に挑戦したいこと
molmolken
0
150
comilioとCloudflare、そして未来へと向けて
oliver_diary
6
430
OPENLOGI Company Profile for engineer
hr01
1
18k
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
820
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
54k
【JAWS-UG大阪 reInvent reCap LT大会 サンバが始まったら強制終了】“1分”で初めてのソロ参戦reInventを数字で振り返りながら反省する
ttelltte
0
130
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
335
57k
KATA
mclloyd
29
14k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
It's Worth the Effort
3n
183
28k
Making Projects Easy
brettharned
116
6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Designing for humans not robots
tammielis
250
25k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
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