Attempt to fix Safari rendering of SVGs #798
1 changed files with 5 additions and 0 deletions
|
@ -28,6 +28,11 @@ const getRasterizedCanvas = (contents, width, height) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix busted SVG images in Safari
|
||||||
|
if(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {
|
||||||
|
contents = contents.replace(/\<img\s/g, '<xhtml:img ');
|
||||||
|
}
|
||||||
|
|
||||||
// Attempt to match font kerning with the DOM.
|
// Attempt to match font kerning with the DOM.
|
||||||
const kerningAndPadding = '<style>svg{font-kerning:normal}body{padding:0;margin:0}</style>';
|
const kerningAndPadding = '<style>svg{font-kerning:normal}body{padding:0;margin:0}</style>';
|
||||||
let svgContents = `<svg xmlns="http://www.w3.org/2000/svg" width="${width * 2}" height="${height * 2}">
|
let svgContents = `<svg xmlns="http://www.w3.org/2000/svg" width="${width * 2}" height="${height * 2}">
|
||||||
|
|
Loading…
Reference in a new issue