resvg icon indicating copy to clipboard operation
resvg copied to clipboard

Support alignment-baseline

Open RazrFalcon opened this issue 4 years ago • 2 comments

RazrFalcon avatar Feb 27 '20 22:02 RazrFalcon

Looking forward to this! When do you think it will be ready?

Joeldorne avatar Mar 19 '20 15:03 Joeldorne

No idea.

RazrFalcon avatar Mar 19 '20 15:03 RazrFalcon

This would be really useful because Chrome supports it. The tests just mention "hanging" but I'm trying to use other values like "central" and "text-before-edge". I've posted a bounty: https://app.bountysource.com/issues/89281644-support-alignment-baseline

Here's a file that renders differently in resvg compared to Chrome: legend

gmeeker avatar Nov 15 '22 20:11 gmeeker

$500? Really? I'm not sure how hard it would be to implement, but that's a lot.

RazrFalcon avatar Nov 16 '22 08:11 RazrFalcon

Oh, it's my first bounty. It's worth it to us so we don't have to find a workaround. Happy to support resvg. It's a great project.

gmeeker avatar Nov 16 '22 17:11 gmeeker

Well, if you want to sponsor me directly, there is no need for BountySource. I'm not even sure if it works in my country.

As for the bug, it could take from 2 days up to a week. I haven't looked into it much. Half of the time will be spent on writing tests anyway. And will probably require adding BASE and bsln tables support to ttf-parser.

Not sure if someone else would be able to figure it all out. There is a reason why it's not implemented. I might look into it on the weekend, but no promises. Very busy.

RazrFalcon avatar Nov 16 '22 18:11 RazrFalcon

@gmeeker Added an absolute minimal support (54489e03b73b6bc83957dfe7331).

It's very simple, but should be as good as Chrome since it does't really implement this property properly either. You can find more in-depth overview here.

Currently, only a horizontal layout is supported. Vertical should be rewritten from scratch...

Technically, I should also take the current text script into account, but doesn't look like Chrome does it and it would be even more complicated.

Either way, the current implementation should be good enough for your use case and more will come later. Including dominant-baseline.

RazrFalcon avatar Nov 19 '22 15:11 RazrFalcon

Added dominant-baseline support as well.

And by "added" I mean that resvg produces the same output as Chrome. Because Chrome, Firefox and Safari all produce different output when you start mixing dominant-baseline and alignment-baseline. Baseline support in general is pretty tragic across all SVG apps: https://razrfalcon.github.io/resvg-test-suite/svg-support-table.html#a-dominant-baseline

RazrFalcon avatar Nov 19 '22 19:11 RazrFalcon

I'm closing this in favor of #558 and #559

RazrFalcon avatar Nov 19 '22 19:11 RazrFalcon