~/talk

Let's Make That Label With CoreText

Talkat Swift Heroes Digital 2021 · 2021-04-15..04-16· [ios, web-performance]
slides:none on file

Builds a UILabel-like view using CoreText that actually works: creates CTLine/CTRun, fixes the flipped coordinate system and baseline by subtracting descent from the text position, and implements truncation with CTLineCreateTruncatedLine using U+2026. Wraps text into arbitrary shapes with CTFramesetter + CGPath, obtains ascent/descent/leading for accurate line spacing, draws glyphs by converting them to paths via CTFontCreatePathForGlyph and fills them, registers downloadable fonts with CTFontManagerRegisterGraphicsFont, and applies pixel-rounding to get crisp edges.

AI-written summary · about

  1. 0:00Introduction
  2. 1:02Who am I
  3. 1:16Why use CoreText
  4. 2:04Alternatives
  5. 3:43API
  6. 5:35Drawing
  7. 6:33Font Matrix
  8. 6:54Baseline
  9. 7:44Label
  10. 8:18UI View
  11. 9:07Draw
  12. 11:27Text
  13. 13:09Text Position
  14. 14:45Text Length
  15. 15:31Truncation
  16. 18:41Shapes
  17. 18:55Lines
  18. 20:04Transform Origins
  19. 21:08Style Brand
  20. 23:42DrawPath
  21. 23:52CreatePath
  22. 24:47Custom Layout
  23. 24:59New Example
  24. 27:08Typesetter
  25. 29:20Get Size That Fits
  26. 31:28Font Management
  27. 32:39Alignment
  28. 36:31Where is my label
  29. 37:53Conclusion
  30. 38:16Contact
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.