yWorks / svg2pdf.js

A javascript-only SVG to PDF conversion utility that runs in the browser. Brought to you by yWorks - the diagramming experts
MIT License
643 stars 96 forks source link

Use dominant-baseline if alignment-baseline is missing & Apply context on text nodes #286

Open giroletm opened 2 months ago

giroletm commented 2 months ago

Fixes #80 by falling back on dominant-baseline if alignment-baseline is unspecified.

Note that according to MDN, if dominant-baseline is defined within a parent and a child sets its alignment-baseline to baseline, it should be equivalent to the same value as the parent's dominant-baseline.

This specific case is not supported here. All this PR does is allow the usage of dominant-baseline on text nodes. Child nodes are not considered.

This PR also applies the current context before rendering a text node, since this was previously not done, causing adjacent text nodes that uses different font styles to use the same one.