Control margin when using <mark>

Is there a way to achieve the space between text (0.7 Kilo) and borders of the mark? Currently I fake it using a character (_) before and after the -tag. Since the mark is 100% solid color that char is hidden.

<mark=#28283C>_<font=LiberationSans SDF><b><color=#ffffff>0.7 Kilo</font></color></b>_</mark>

Is there a better way to do it? I tried and , but none of them worked.

Yes. Use the padding attribute as per the following example

<mark=#ff800080 padding=“2,2,2,2”> … left, right, top, bottom.

1 Like

Does this need a newer version than 2.0.1?

I think so… It is for certain in 2.1.0.

Hey @Stephan_B , would it be possible to add support for font units on mark padding? Instead of just pixels

I gather you like font units :slight_smile:

I’ll look at adding it to the next release.

1 Like

Haha, indeed I do. Thanks very much <3

Just took a quick look at this and the tag padding values are already in font units but the values are 1/100 em. So if the text object point size is 100 and the padding values 1, 1, 1, 1 then it will add padding of 1 pixel or 1/100 of 100 point size.

So the new question is whether or not I should add support for pixel units? If I make any changes, it will break / change the padding for everyone using this as the values are currently declared in pixel unit style but are em based.

If I do add the “em” modifier then do I stick to 1/100 em?

In my opinion, the spacing should be consistent across all rich text tags. So without the em tag it should be pixels, and with the tag it should be full font units, not 1/100 font units.

But of course, this would be a breaking change and screw up mark padding for anyone using that feature. For my own projects I think the change is worth it, and I’d be happy to update everything in exchange for consistent formatting. But others may not agree.

In the Inspector, the spacing values are all 1/100 em. However, in many of the tags, which predate these changes they were in full em so I’ll take a look to try to make sure everything is consistent.

I am working on the new preview series where although I most certainly want to avoid breaking changes, this would be the time to review / further improve on the consistency of those values / tags.

1 Like