I really appreciate all the great text formatting options — thanks! One option I'd love to see added is paragraph spacing. This could be passed as an optional argument to playdate.graphics.drawText
and friends, and/or set via e.g. playdate.graphics.font:setParagraphSpacing()
. This would manifest as extra space (increased leading) before the next line following a hard-coded \n
within the provided text.
This would make it convenient to manage small blocks of stylized text without needing to manually account for the size of each line/paragraph they contain. Some examples:
- Longer form text, with multiple paragraphs of prose
- Short lists, to add extra space between list items
- Title + description blocks, where the title might be bolded, followed by a small gap, followed by one or more lines of wrapped text
I've already hacked together a small change to _layoutTextInRect
in CoreLibs/graphics.lua
which achieves the effect, which I can share if helpful. It's quite straightforward since the inner loop already iterates over each hard-broken line — just add the appropriate paragraphSpacing
at the very end of each loop. However, since I couldn't set a property on the font object itself, I cheated and just set playdate.graphics.paragraphSpacing
in order to get the desired value into that function cheaply. Would be great to have official support!
As far as parameterizing it, I'm not sure which approach to specifying paragraph spacing makes the most sense, but I'd accept any of:
- An additive value (added to leading)
- An override value (used instead of standard leading)
- A multiplier (e.g. 1.5 would yield space equal to
lineHeight * 1.5
between paragraphs)
Thanks!