Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Adjust line height in Label / TextLayout

10 views
Skip to first unread message

Guillermo Rodriguez Garcia

unread,
Oct 10, 2019, 11:07:59 AM10/10/19
to PlayN
Hello all,

I am trying to create a multiline Label and adjust the line height (more precisely, the inter-line spacing). But I am not sure if this is possible at all.

So far I have seen the following:
- Text layout is done in the TextWidget.TextLayoutData constructor
- Assuming the WRAP style is enabled and a positive width hint is set, this will create a StyledText.Block instance
- The StyledText.Block ctor calls Graphics.layoutText(text, style, wrap), which is an abstract method
- Concrete implementations of Graphics.layoutText all seem to fall back to the "leading" information which is built into the actual font used
- I have not seen any way to override or adjust this

Am I missing something? Is there any way to control line spacing ?

Thanks,

Guillermo

Michael Bayne

unread,
Oct 11, 2019, 12:10:06 PM10/11/19
to pl...@googlegroups.com
There wasn't any way to control line spacing short of doing text rendering yourself, but adding it was pretty easy, so I just did:


--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/playn/188b6948-8d16-49b1-942d-b06be00b736e%40googlegroups.com.


--

Guillermo Rodriguez Garcia

unread,
Oct 14, 2019, 4:42:30 AM10/14/19
to PlayN
Amazing!

I didn't realize that StyledText can actually tweak the layouts returned by Graphics.layoutText.

Thank you,

Guillermo

On Friday, October 11, 2019 at 6:10:06 PM UTC+2, Michael Bayne wrote:
There wasn't any way to control line spacing short of doing text rendering yourself, but adding it was pretty easy, so I just did:


On Thu, Oct 10, 2019 at 8:08 AM Guillermo Rodriguez Garcia <guille....@gmail.com> wrote:
Hello all,

I am trying to create a multiline Label and adjust the line height (more precisely, the inter-line spacing). But I am not sure if this is possible at all.

So far I have seen the following:
- Text layout is done in the TextWidget.TextLayoutData constructor
- Assuming the WRAP style is enabled and a positive width hint is set, this will create a StyledText.Block instance
- The StyledText.Block ctor calls Graphics.layoutText(text, style, wrap), which is an abstract method
- Concrete implementations of Graphics.layoutText all seem to fall back to the "leading" information which is built into the actual font used
- I have not seen any way to override or adjust this

Am I missing something? Is there any way to control line spacing ?

Thanks,

Guillermo

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages