From 940260e5fd9e886dfd2ca89564fd945a587cd798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Murat=20=C3=87orlu?= Date: Tue, 19 Sep 2017 14:49:43 +0200 Subject: [PATCH 1/2] Ligature support with based on configuration parameters --- README.md | 16 ++++++++++++++++ src/generateFonts.js | 17 +++++++++++------ src/index.js | 8 ++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 29d684f..344bc40 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,22 @@ Default: basename of file Function that takes path of file and return name of icon. +### ligature + +Type: `boolean` +
+Default: `false` + +Whether ligature function will be used or not. + +### ligatureName + +Type: `function(string) -> string` +
+Default: basename of file + +Function that takes name of file and return ligature for that icon. + ### startCodepoint Type: `number` diff --git a/src/generateFonts.js b/src/generateFonts.js index 33723c1..eca54d5 100644 --- a/src/generateFonts.js +++ b/src/generateFonts.js @@ -44,14 +44,19 @@ var generators = { _.each(options.files, function(file, idx) { var glyph = fs.createReadStream(file) var name = options.names[idx] - var unicode = String.fromCharCode(options.codepoints[name]) - var ligature = '' - for(var i=0;i Date: Wed, 5 Dec 2018 15:01:38 +0100 Subject: [PATCH 2/2] clean console.log --- src/generateFonts.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/generateFonts.js b/src/generateFonts.js index eca54d5..e8fa402 100644 --- a/src/generateFonts.js +++ b/src/generateFonts.js @@ -45,15 +45,13 @@ var generators = { var glyph = fs.createReadStream(file) var name = options.names[idx] var unicode; - // console.log(options); + if (options.ligature) { unicode = options.ligatureName(name); } else { unicode = String.fromCharCode(options.codepoints[name]); } - // console.log(name, unicode); - glyph.metadata = { name: name, unicode: [unicode]