NSParagraphStyle Explained Visually

Stuart Moore
1 min readJun 26, 2015

--

I used to find myself randomly guessing a lot of magic numbers when it came to laying out paragraphs. The biggest issue I had was text clipping with small `lineHeightMultiples` — I figured that out in my last post.

`NSParagraphStyle` is much better documented in the header file then its actual documentation (⌘-click an attribute to view). In lieu of that, I made a quick cheatsheet for everybody to understand what’s possible.

Funnily enough, sometimes the best way to explain text is with an image.

Top inset shifted by https://medium.com/@at_underscore/fix-clipping-uifont-lineheightmultiple-146f28e2cb8e and all UITextView insets are zeroed out (textContainerInset & textContainer.lineFragmentPadding)

It all makes so much sense now. My next post explains `UIFont`.

--

--

Stuart Moore

iOS at Capital One, Formerly at Washington Post & iA. America’s Sweetheart™