Andrzej Michnia
Nov 6 · 1 min read

Great article, it was a real help in my current project!

Still, I have one remark. If you use this technique, the font size would always be bigger than what you expected! (I was so puzzled when I saw this) For example, when I specify font with size 30pt, I’m getting attributed string with fonts of 40pt.

After some googling, I ended up with a solution that changes generated attributes to match requirements. I’m sharing a link to gist, supporting:

  • proper setting of a font (as long as the whole text has the same point size)
  • setting up additional attributes (like kerning, line spacing, etc.) for the whole attributed string

I hope it helps and I would appreciate any information, why does it behave so weird (changing font size)

Andrzej Michnia

Written by

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade