Skip to content

Commit

Permalink
Merge pull request #44 from fsih/changeDefaultFontSize
Browse files Browse the repository at this point in the history
Use 18 instead of 14 when the font size is missing
  • Loading branch information
cwillisf authored Aug 17, 2018
2 parents 5f15b96 + e84866a commit 91d6714
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/font-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 1 addition & 5 deletions src/svg-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ class SvgRenderer {
textElement.setAttribute('alignment-baseline', 'text-before-edge');
// If there's no font size provided, provide one.
if (!textElement.getAttribute('font-size')) {
textElement.setAttribute('font-size', '14');
}
// If there's no font-family provided, provide one.
if (!textElement.getAttribute('font-family')) {
textElement.setAttribute('font-family', 'Helvetica');
textElement.setAttribute('font-size', '18');
}
let text = textElement.textContent;

Expand Down

0 comments on commit 91d6714

Please sign in to comment.