Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Add ligature support to Node engine #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"memorystream": "~0.3.1",
"mkdirp": "~0.5.1",
"svg2ttf": "~2.1.1",
"svgicons2svgfont": "~1.1.0",
"svgicons2svgfont": "~8.0.0",
"svgo": "~0.6.1",
"temp": "~0.8.3",
"ttf2eot": "~1.3.0",
Expand Down
26 changes: 17 additions & 9 deletions tasks/engines/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function(o, allDone) {
var exec = require('child_process').exec;
var _ = require('lodash');
var StringDecoder = require('string_decoder').StringDecoder;
var svgicons2svgfont = require('svgicons2svgfont');
var SVGIcons2SVGFontStream = require('svgicons2svgfont');
var svg2ttf = require('svg2ttf');
var ttf2woff = require('ttf2woff');
var ttf2eot = require('ttf2eot');
Expand All @@ -33,7 +33,7 @@ module.exports = function(o, allDone) {
var font = '';
var decoder = new StringDecoder('utf8');
svgFilesToStreams(o.files, function(streams) {
var stream = svgicons2svgfont(streams, {
var stream = new SVGIcons2SVGFontStream({
fontName: o.fontFamilyName,
fontHeight: o.fontHeight,
descent: o.descent,
Expand All @@ -44,11 +44,16 @@ module.exports = function(o, allDone) {
});
stream.on('data', function(chunk) {
font += decoder.write(chunk);
});
stream.on('end', function() {
}).on('finish',function() {
fonts.svg = font;
done(font);
});


streams.forEach(function(glyph) {
stream.write(glyph);
});
stream.end();
});
},

Expand Down Expand Up @@ -126,11 +131,14 @@ module.exports = function(o, allDone) {
async.map(files, function(file, fileDone) {

function fileStreamed(name, stream) {
fileDone(null, {
codepoint: o.codepoints[name],
name: name,
stream: stream
});
stream.metadata = {
unicode: [String.fromCodePoint(o.codepoints[name])],
name: name
};
if (o.addLigatures) {
stream.metadata.unicode.push(name);
}
fileDone(null, stream);
}

function streamSVG(name, file) {
Expand Down