tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.21k stars 1.68k forks source link

Arabic-script letters not connected across html tags #391

Open pverkind opened 2 years ago

pverkind commented 2 years ago

Use case:

Some Arabic-script letters are connected to the next letter. In HTML code in the browser, these connections are made automatically, even when an HTML tag is written between two letters; but in XML (and thus in SVG, and all image formats dom-to-image derives from SVG) the connection has to be done explicitly by adding the Unicode character (U+200D ZERO WIDTH JOINER, HTML code ‍) on either side of the HTML tag.

See the different behavior in this jsfiddle

This problem is only observed in Chrome and Edge, not in Firefox.

Expected behavior

Arabic letters (apart from a few exceptions) should be connected, even across HTML tags

Actual behavior (stack traces, console logs etc)

HTML tags break the connections between letters

Library version

Browsers