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
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
380
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
520
kargoの魅力について伝える
magisystem0408
0
200
Storage Browser for Amazon S3
miu_crescent
1
130
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
150
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
2
250
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
220
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
4 Signs Your Business is Dying
shpigford
181
21k
Side Projects
sachag
452
42k
A better future with KSS
kneath
238
17k
Mobile First: as difficult as doing things right
swwweet
222
9k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
BBQ
matthewcrist
85
9.4k
Music & Morning Musume
bryan
46
6.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
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