diff --git a/src/lib/config.js b/src/lib/config.js index f358b15..a1adb25 100644 --- a/src/lib/config.js +++ b/src/lib/config.js @@ -43,30 +43,33 @@ export const FONT_TMPL = ` - - Created by font-carrier - + Created by @bytedo/font-generator - - - <% print(v + '="' + fontface[v] + '"') %> - <%} %> - /> - + + `${k}="${fontface[k]}"`) + .join(' ')} /> + + - <% if(!hasX){ %> - - <% } %> - - <% for(var i in glyphs){ - var glyph = glyphs[i].options; - %> - <% if (glyph['vertAdvY']) print('vert-adv-y="'+ glyph['vertAdvY']+'"') %> /> - - <% } %> + ${ + hasX + ? '' + : '' + } + ${glyphs + .map( + glyph => + `` + ) + .join('\n')} @@ -75,7 +78,11 @@ export const FONT_TMPL = ` export const SVG_TMPL = ` - x="0" y="0" width="<%= options['width'] %>" height="<%= options['height'] %>" <% } %> viewBox="0 0 <%= glyph['horizAdvX'] %> <%= glyph['vertAdvY'] %>"> - + + ` diff --git a/src/lib/svg2ttf/lib/svg.js b/src/lib/svg2ttf/lib/svg.js index fce8862..695d768 100644 --- a/src/lib/svg2ttf/lib/svg.js +++ b/src/lib/svg2ttf/lib/svg.js @@ -91,7 +91,6 @@ export function load(str) { fontElem = doc.getElementsByTagName('font')[0] if (!fontElem) { - console.log(doc) throw new Error( "Can't find tag. Make sure you SVG file is font, not image." ) diff --git a/test/index.js b/test/index.js index a9e51eb..f1dadac 100644 --- a/test/index.js +++ b/test/index.js @@ -11,4 +11,4 @@ let svg = fs.cat('test/game.svg').toString() let ttf = svg2ttf(svg) -console.log(ttf) +// console.log(ttf)