Attempt to fix Safari rendering of SVGs #798

Merged
skhameneh merged 1 commit from memeify-fixes into master 2018-12-01 08:36:00 +01:00
Showing only changes of commit ade68b217c - Show all commits

View file

@ -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}">