mirror of
https://github.com/scratchfoundation/scratch-svg-renderer.git
synced 2024-11-14 19:25:41 -05:00
Fix using helvetica when no font is provided
This commit is contained in:
parent
58095a50c8
commit
e84866a31c
2 changed files with 3 additions and 5 deletions
|
@ -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');
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue