Change line height.

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Change line height.

Postby iKlsR » Sun Jun 23, 2013 7:50 pm

How would I go about changing the spacing between lines or the line height. I have a custom monospaced font and it looks really clumsy and packed together. I haven't been able to find anything for this in the docs.

Currently what I have..

Image

What I want..

Image

Thanks.
Last edited by iKlsR on Sun Jun 23, 2013 11:27 pm, edited 1 time in total.
User avatar
iKlsR
 
Posts: 2
Joined: Sat Jun 22, 2013 4:25 pm

Re: Change line spacing.

Postby robert » Sun Jun 23, 2013 8:48 pm

There's no direct way to artificially set the line height, but since it's based on the height of the font used for the largest token style, you should be able to do something like this:

java code:

Style whitespaceStyle = new Style(Color.gray, null, new Font("Monospaced", 24, Font.PLAIN));
textArea.getSyntaxScheme().setStyle(TokenTypes.WHITESPACE, whitespaceStyle);


This will force the line height to accommodate a 24-point font, and make whitespace characters rendered gray (which is the default). Though note the whitespace foreground color is only important if you call setWhitespaceVisible(true).
User avatar
robert
 
Posts: 801
Joined: Sat May 10, 2008 5:16 pm

Re: Change line spacing.

Postby iKlsR » Sun Jun 23, 2013 11:26 pm

This behaves a bit wonky at first but works.. thanks.
User avatar
iKlsR
 
Posts: 2
Joined: Sat Jun 22, 2013 4:25 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron