Fix using helvetica when no font is provided

This commit is contained in:
DD 2018-08-16 14:57:19 -04:00
parent 58095a50c8
commit e84866a31c
2 changed files with 3 additions and 5 deletions

View file

@ -21,7 +21,9 @@ const convertFonts = function (svgTag) {
collectText(svgTag);
// If there's an old font-family, switch to the new one.
for (const textElement of textElements) {
if (textElement.getAttribute('font-family') === 'Helvetica') {
// If there's no font-family provided, provide one.
if (!textElement.getAttribute('font-family') ||
textElement.getAttribute('font-family') === 'Helvetica') {
textElement.setAttribute('font-family', 'Sans Serif');
} else if (textElement.getAttribute('font-family') === 'Mystery') {
textElement.setAttribute('font-family', 'Curly');

View file

@ -130,10 +130,6 @@ class SvgRenderer {
if (!textElement.getAttribute('font-size')) {
textElement.setAttribute('font-size', '18');
}
// If there's no font-family provided, provide one.
if (!textElement.getAttribute('font-family')) {
textElement.setAttribute('font-family', 'Helvetica');
}
let text = textElement.textContent;
// Fix line breaks in text, which are not natively supported by SVG.