Attempt to fix Safari rendering of SVGs
This commit is contained in:
parent
b5c8cbec52
commit
ade68b217c
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