From 6f314b03bd6f71daa9d2662b25b5cc9f38512e0d Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Wed, 23 Sep 2015 08:33:20 +0300 Subject: [PATCH] Added fixedCodepoints option to allow specifying codepoints for some glyphs --- index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index f149a51..fbf66a3 100644 --- a/index.js +++ b/index.js @@ -71,11 +71,17 @@ function iconfontCSS(config) { }); } - currentCodePoint = currentGlyph.toString(16).toUpperCase(); + var fileName = path.basename(file.path, '.svg'); + + if (config.fixedCodepoints && config.fixedCodepoints[fileName]){ + currentCodePoint = config.fixedCodepoints[fileName].toString(16).toUpperCase(); + } else { + currentCodePoint = (currentGlyph++).toString(16).toUpperCase(); + } // Add glyph glyphMap.push({ - fileName: path.basename(file.path, '.svg'), + fileName: fileName, codePoint: currentCodePoint }); @@ -84,9 +90,6 @@ function iconfontCSS(config) { file.path = path.dirname(file.path) + '/' + inputFilePrefix + path.basename(file.path); - // Increase counter - currentGlyph++; - this.push(file); cb(); };