Merge pull request #798 from lbryio/memeify-fixes

Attempt to fix Safari rendering of SVGs
This commit is contained in:
Shawn K 2018-12-01 01:35:59 -06:00 committed by GitHub
commit c1b5d521b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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