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)
