Author Topic: Absolute Line Spacing  (Read 2787 times)

KickBack

  • Beta User
  • Newbie
  • *
  • Posts: 49
Absolute Line Spacing
« on: July 09, 2014, 02:33:04 AM »
Minor feature request.

Could we maybe have a Line Space option that is in game units, so if I want, I can set the line spacing to be, say 1.2 gameunits, regardless of the font size or the font itself.

Right now the line space is dependant on the font and font size (which is fine), but since there are situations where I want a specific (absolute) line space, if I then change the text size or the font itself, I have to find a new value for line space again.

Again, not a big deal but it would nice to have.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Absolute Line Spacing
« Reply #1 on: July 09, 2014, 02:44:19 AM »
Line spacing is defined in the TTF for each font.  You are correct that line spacing (value) is relative to the font size but regardless of font size, this line spacing is consistent. Essentially, line spacing is defined in font units.

Having said that, can you elaborate on how you want to use this alternative line spacing. Do you have any examples / images you could post? How are you trying to use this in your game / project?

I am just trying to get a picture of how when you would want to use this mode of line spacing.




KickBack

  • Beta User
  • Newbie
  • *
  • Posts: 49
Re: Absolute Line Spacing
« Reply #2 on: July 14, 2014, 12:29:28 PM »
Here is an image:

[ Guests cannot view attachments ]

The game presents the player with dialogue options (this specific screenshot has only two options, but it has a maximum of five). All the options used to be one TextMesh. I had found a good number for the linespacing so each option was at a specific spot. Now that I'm converting everything to TextMesh Pro, one feature I'm considering adding, is the option to have the user choose the font size they want. So in the specific example, if the user chose a different font size, the options would be at new places.

I ended up splitting the options into five different TextMesh Pros so it's fine now, but it would still be handy to be able to set a fixed amount of line space based on game units, so that the text stayed in the same place even with different sizes.

In any case, as I said, a minor feature request :)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Absolute Line Spacing
« Reply #3 on: July 14, 2014, 01:15:37 PM »
Here is an image:

(Attachment Link)

The game presents the player with dialogue options (this specific screenshot has only two options, but it has a maximum of five). All the options used to be one TextMesh. I had found a good number for the linespacing so each option was at a specific spot. Now that I'm converting everything to TextMesh Pro, one feature I'm considering adding, is the option to have the user choose the font size they want. So in the specific example, if the user chose a different font size, the options would be at new places.

I ended up splitting the options into five different TextMesh Pros so it's fine now, but it would still be handy to be able to set a fixed amount of line space based on game units, so that the text stayed in the same place even with different sizes.

In any case, as I said, a minor feature request :)

Now that I have modified the <size> tag to also affect line spacing, this should be easier to implement. 

I was thinking that I could introduce a new tag <linespacing> but before doing so, I was thinking about the new Text Auto-Sizing feature and the newly added <size=%125> tag which like the other <size> variants can be inserted in between lines of text to control spacing.

Take a look at this video (the part with the Long Item Name) and let me know if that could be an option?

Regardless, adding a <linespacing> tag should be pretty straight forward now. 

KickBack

  • Beta User
  • Newbie
  • *
  • Posts: 49
Re: Absolute Line Spacing
« Reply #4 on: July 14, 2014, 02:33:35 PM »
I watched the video. If I understand correctly, you are proposing adding size tags between lines to compensate for any changes in the actual lines of text? If that works as I think it would then yeah, I can work with that. But from what I gather, the behaviour I'm asking, is the previous size tag behaviour, where linespacing was completely unaffected.

In any case, as I said, really minor request, so unless you're done with everything else you want to do with textmesh pro, don't really bother with this. (although I have to say, more control with tags is always good).

(as a side-note, I hope the previous section in the video, about the myth of SDF looking bad when the text is small, isn't something I helped create with the thread I made about that really thin font and softness! In any case, I made an addition to that thread to help bust the myth :D )

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5687
Re: Absolute Line Spacing
« Reply #5 on: July 14, 2014, 02:56:53 PM »
I watched the video. If I understand correctly, you are proposing adding size tags between lines to compensate for any changes in the actual lines of text? If that works as I think it would then yeah, I can work with that. But from what I gather, the behaviour I'm asking, is the previous size tag behaviour, where linespacing was completely unaffected.

Correct. The <size> tag can be added in between lines to control the line spacing. With the new <size=%> variant, it makes it a lot easier to control that as well. The best thing will be to play with it and see how it does and where the limitations might be. Like I said, now that I have had to modify how line spacing is handled for the <size> tag, adding a new <linespacing> tag should be trivial.


Quote
In any case, as I said, really minor request, so unless you're done with everything else you want to do with textmesh pro, don't really bother with this. (although I have to say, more control with tags is always good).

There are still many features I want to add to TextMesh Pro. My goal is to make it the de facto standard when it comes to text in Unity. The only thing that would stop me from further development, is if people stopped buying it and using it.

Quote
(as a side-note, I hope the previous section in the video, about the myth of SDF looking bad when the text is small, isn't something I helped create with the thread I made about that really thin font and softness! In any case, I made an addition to that thread to help bust the myth :D )

You did not and I greatly appreciate that you took the time to add the additional comments in your support thread about Softness.

This misconception has been around for a while now since most implementations of SDF & Shaders are incorrect. They all do fine with large text but can fail pretty badly with small text.
« Last Edit: July 14, 2014, 03:01:31 PM by Stephan B. »