Comparing version 4.0.3 to 4.1.0
@@ -0,1 +1,7 @@ | ||
4.1.0 / 2017-06-24 | ||
------------------ | ||
- Added font subfamily name support, #57. | ||
4.0.3 / 2017-05-27 | ||
@@ -2,0 +8,0 @@ ------------------ |
@@ -29,6 +29,5 @@ /* | ||
font.copyright = options.copyright || svgFont.metadata; | ||
font.sfntNames.push({ id: 2, value: options.subfamilyname || 'Regular' }); // subfamily name | ||
font.sfntNames.push({ id: 2, value: options.subfamilyname || svgFont.subfamilyName || 'Regular' }); // subfamily name | ||
font.sfntNames.push({ id: 4, value: options.fullname || svgFont.id }); // full name | ||
var versionString = options.version || 'Version 1.0'; | ||
@@ -45,6 +44,4 @@ | ||
font.sfntNames.push({ id: 5, value: versionString }); // version ID for TTF name table | ||
font.sfntNames.push({ id: 6, value: (options.fullname || svgFont.id).replace(/[\s\(\)\[\]<>%\/]/g, '').substr(0, 62) }); // Postscript name for the font, required for OSX Font Book | ||
font.sfntNames.push({ id: 6, value: options.fullname || svgFont.id }); // Postscript name for the font, required for OSX Font Book | ||
if (typeof options.ts !== 'undefined') { | ||
@@ -51,0 +48,0 @@ font.createdDate = font.modifiedDate = new Date(parseInt(options.ts, 10) * 1000); |
@@ -47,3 +47,3 @@ 'use strict'; | ||
//getters and setters | ||
//getters and setters | ||
@@ -50,0 +50,0 @@ Object.defineProperty(this, 'descent', { |
@@ -80,5 +80,10 @@ 'use strict'; | ||
var familyName = fontFaceElem.getAttribute('font-family') || 'fontello'; | ||
var subfamilyName = fontFaceElem.getAttribute('font-style') || 'Regular'; | ||
var id = fontElem.getAttribute('id') || (familyName + '-' + subfamilyName).replace(/[\s\(\)\[\]<>%\/]/g, '').substr(0, 62); | ||
var font = { | ||
id: fontElem.getAttribute('id') || 'fontello', | ||
familyName: fontFaceElem.getAttribute('font-family') || 'fontello', | ||
id: id, | ||
familyName: familyName, | ||
subfamilyName: subfamilyName, | ||
stretch: fontFaceElem.getAttribute('font-stretch') || 'normal' | ||
@@ -85,0 +90,0 @@ }; |
{ | ||
"name": "svg2ttf", | ||
"version": "4.0.3", | ||
"version": "4.1.0", | ||
"description": "Converts SVG font to TTF font", | ||
@@ -36,5 +36,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "^3.10.2", | ||
"eslint": "^4.1.0", | ||
"mocha": "^3.0.0" | ||
} | ||
} |
@@ -55,3 +55,3 @@ svg2ttf | ||
var ttf = svg2ttf(fs.readFileSync('myfont.svg'), {}); | ||
var ttf = svg2ttf(fs.readFileSync('myfont.svg', 'utf8'), {}); | ||
fs.writeFileSync('myfont.ttf', new Buffer(ttf.buffer)); | ||
@@ -58,0 +58,0 @@ ``` |
77394
2091