Handle a nasty bug in some SVG files
SVG files generated by draw.io (fairly widely used in W3C documents) have a nasty bug: they use the deprecated
<font>
element of HTML. Because epubcheck is very strict, it labels those SVG files as erroneous (although they
do display properly). This hook replaces the font elements by a <span>
. (It seems that the draw.io files do include
the right style
attribute in those elements, so it is really an unnecessary usage.)
NOTE THAT THIS DOES NOT ALWAYS WORK! In some cases the generated span element finds itself in a wrong place.
The only reasonable thing to do is for draw.io to avoid doing this.
f
deFontSvg
Replace all occurrences of the <font>
element in the SVG file by a <span>
.
Usage
import * as mod from "lib/defontSvg.ts";