Lineheight and letterspacing #244

Closed
opened 10 months ago by bert-bruggeman · 14 comments

Is it possible to set the lineheight (spacing between lines) and the letter spacing? Maybe I missed something in the wiki or manpage?

Is it possible to set the lineheight (spacing between lines) and the letter spacing? Maybe I missed something in the wiki or manpage?
dnkl added the
enhancement
label 10 months ago
Owner

No, you are right, this is currently not possible. I guess it would make sense to add support for it though.

No, you are right, this is currently not possible. I guess it would make sense to add support for it though.
Owner

In addition to setting the line height and letter spacing, we'd also need to add options to configure the x/y offsets, right? Is there anything else that is needed?

In addition to setting the line height and letter spacing, we'd also need to add options to configure the x/y offsets, right? Is there anything else that is needed?

I think that would cover all vertical and horizontal character modifications...
Maybe x-offset isn't necessary, some terminals seem to use this to set the letter-spacing but I think that's a confusing naming...

I think that would cover all vertical and horizontal character modifications... Maybe x-offset isn't necessary, some terminals seem to use this to set the letter-spacing but I think that's a confusing naming...
Owner

Let me think about it. But if we add an y-offset, it is probably best to add an x-offset too, even if it is less likely to be used, to make things consistent.

line-spacing=<unset>    # Use font metrics by default
letter-spacing=<unset>  # Use font metrics by default
line-offset=0
letter-offset=0

Something like that? Or do you think {line,letter}-spacing should be in addition to the font's line height, letter width? The latter would make it impossible to shrink lines/cells.

Let me think about it. But if we add an y-offset, it is probably best to add an x-offset too, even if it is less likely to be used, to make things consistent. ``` line-spacing=<unset> # Use font metrics by default letter-spacing=<unset> # Use font metrics by default line-offset=0 letter-offset=0 ``` Something like that? Or do you think `{line,letter}-spacing` should be _in addition_ to the font's line height, letter width? The latter would make it impossible to shrink lines/cells.

I would use "line-height" as it's a common used property name in typography, the same for "letter-spacing"...

the offset applies to the letters, so I would use "letter-offset-v" and "letter-offset-h" or maybe "vertical-letter-offset" and "horizontal-letter-offset" to be more clear...

maybe I'm just nitpicking, as a web developer I am very strict on naming properties...

I would use "line-height" as it's a common used property name in typography, the same for "letter-spacing"... the offset applies to the letters, so I would use "letter-offset-v" and "letter-offset-h" or maybe "vertical-letter-offset" and "horizontal-letter-offset" to be more clear... maybe I'm just nitpicking, as a web developer I am very strict on naming properties...
Owner

maybe I'm just nitpicking, as a web developer I am very strict on naming properties...

No worries. It is important. Better spend some time on proper names now; it's much harder to change them afterwards. Besides, if I didn't care about good names, I wouldn't ask :)

So, line-height, letter-spacing, and {horizontal,vertical}-letter-offset it is.

> maybe I'm just nitpicking, as a web developer I am very strict on naming properties... No worries. It **is** important. Better spend some time on proper names now; it's much harder to change them afterwards. Besides, if I didn't care about good names, I wouldn't ask :) So, `line-height`, `letter-spacing`, and `{horizontal,vertical}-letter-offset` it is.

Looking forward to the implementation!

Again thanks for foot, never thought I would leave st!

Looking forward to the implementation! Again thanks for foot, never thought I would leave st!
Owner

I'm working on this, and have a POC, more or less.

But I wanted to ask you this: would you expect letter-spacing to be an absolute value? I.e. setting letter-spacing sets the cell width.

Or relative to the font metrics? I.e. a value of 0 is the default, a negative value makes the cells more narrow, and a positive value widens them.

In my POC, it's an absolute value. But I think a relative value might make more sense.

For line-height I'm assuming absolute values. Though we could also support percentage values: line-height=120%. Would that be interresting to have?

I'm working on this, and have a POC, more or less. But I wanted to ask you this: would you expect `letter-spacing` to be an absolute value? I.e. setting `letter-spacing` sets the cell width. Or relative to the font metrics? I.e. a value of `0` is the default, a negative value makes the cells more narrow, and a positive value widens them. In my POC, it's an absolute value. But I think a relative value might make more sense. For `line-height` I'm assuming absolute values. Though we _could_ also support percentage values: `line-height=120%`. Would that be interresting to have?
Owner

Actually, I'm going to go ahead and change my POC to use relative letter-spacing values. Let me know if you want me to change it back.

Actually, I'm going to go ahead and change my POC to use relative `letter-spacing` values. Let me know if you want me to change it back.

I also think relative values for "letter-spacing" is the best option, I would set this as a decimal value (like 0.25)

I also think relative values for "letter-spacing" is the best option, I would set this as a decimal value (like 0.25)
Owner

I would set this as a decimal value (like 0.25)

I assume the unit in this case is points, not pixels?

I do think there will be people who will want to have pixel-level control of this. But I also realize you want to use point sizes to be able to resize the fonts runtime and keep the relative spacing.

So we need to support both. The question is which syntax to use. Perhaps the best option is to use point sizes by default (i.e letter-spacing=0.25), and force the user to use a px suffix to instead use pixels (i.e. letter-spacing=3px).

line-height is currently in pixels too, in the PR. I would assume the same applies to it, as well? I.e. use point sizes by default, but allow pixel sizes with the px suffix.

And I guess the same applies to the offsets too.

> I would set this as a decimal value (like 0.25) I assume the unit in this case is **points**, not **pixels**? I do think there will be people who will want to have pixel-level control of this. But I also realize you want to use point sizes to be able to resize the fonts runtime and keep the relative spacing. So we need to support both. The question is which syntax to use. Perhaps the best option is to use point sizes by default (i.e `letter-spacing=0.25`), and force the user to use a `px` suffix to instead use pixels (i.e. `letter-spacing=3px`). `line-height` is currently in pixels too, in the PR. I would assume the same applies to it, as well? I.e. use point sizes by default, but allow pixel sizes with the `px` suffix. And I guess the same applies to the offsets too.

I would only use points (only for the "letter-spacing") because in most cases this value will be a decimal value. A small description would make this clear... users who want a perfect 1px (and must understand dpi in the first place) could always calculate the value...

I would only use points (only for the "letter-spacing") because in most cases this value will be a decimal value. A small description would make this clear... users who want a perfect 1px (and must understand dpi in the first place) could always calculate the value...
Owner

Hmm, perhaps. But I don't think it's that simple. We should also consider bitmap fonts, where point sizes doesn't really apply.

It also doesn't really cost us anything to support both point- and pixel values: the code to parse these values are shared across all the four config options.

Hmm, perhaps. But I don't think it's that simple. We should also consider bitmap fonts, where point sizes doesn't really apply. It also doesn't really cost us anything to support both point- and pixel values: the code to parse these values are shared across all the four config options.

Sounds correct...

Sounds correct...
dnkl closed this issue 10 months ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.