Prepare for 1.5.0.
This commit is contained in:
parent
183f2f50e2
commit
b7cc443f48
48
generator.js
48
generator.js
|
@ -10,19 +10,8 @@ var toml = require('toml');
|
||||||
|
|
||||||
var Glyph = require('./support/glyph');
|
var Glyph = require('./support/glyph');
|
||||||
|
|
||||||
function toBuffer(arrayBuffer) {
|
|
||||||
var length = arrayBuffer.byteLength;
|
|
||||||
var view = new DataView(arrayBuffer, 0, length);
|
|
||||||
var buffer = new Buffer(length);
|
|
||||||
for (var i = 0, l = length; i < l; i++) {
|
|
||||||
buffer[i] = view.getUint8(i, false);
|
|
||||||
}
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
function pad(s, n){ while(s.length < n) s = '0' + s; return s; }
|
|
||||||
function mix(a, b, p){ return a + (b - a) * p }
|
|
||||||
|
|
||||||
// Font building
|
// Font building
|
||||||
|
var font = function(){
|
||||||
var parametersData = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'parameters.toml'), 'utf-8'));
|
var parametersData = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'parameters.toml'), 'utf-8'));
|
||||||
var emptyFont = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'emptyfont.toml'), 'utf-8'));
|
var emptyFont = toml.parse(fs.readFileSync(path.join(path.dirname(require.main.filename), 'emptyfont.toml'), 'utf-8'));
|
||||||
var para = parameters.build(parametersData, argv._);
|
var para = parameters.build(parametersData, argv._);
|
||||||
|
@ -31,8 +20,10 @@ var fontUniqueName = para.family + ' ' + para.style + ' ' + para.version + ' ('
|
||||||
console.log(' Start build font ' + fontUniqueName);
|
console.log(' Start build font ' + fontUniqueName);
|
||||||
var font = buildGlyphs.build.call(emptyFont, para);
|
var font = buildGlyphs.build.call(emptyFont, para);
|
||||||
console.log(' ' + fontUniqueName + " Successfully built.");
|
console.log(' ' + fontUniqueName + " Successfully built.");
|
||||||
|
return font;
|
||||||
|
}();
|
||||||
|
|
||||||
if(argv.charmap) {
|
if(argv.charmap) (function(){
|
||||||
console.log(' Writing character map -> ' + argv.charmap);
|
console.log(' Writing character map -> ' + argv.charmap);
|
||||||
fs.writeFileSync(argv.charmap, JSON.stringify(font.glyf.map(function(glyph){
|
fs.writeFileSync(argv.charmap, JSON.stringify(font.glyf.map(function(glyph){
|
||||||
return [
|
return [
|
||||||
|
@ -41,9 +32,9 @@ if(argv.charmap) {
|
||||||
glyph.advanceWidth === 0 && glyph.anchors && Object.keys(glyph.anchors).length > 0
|
glyph.advanceWidth === 0 && glyph.anchors && Object.keys(glyph.anchors).length > 0
|
||||||
]
|
]
|
||||||
})), 'utf8')
|
})), 'utf8')
|
||||||
};
|
})();
|
||||||
|
|
||||||
if(argv.feature) {
|
if(argv.feature) (function(){
|
||||||
console.log(' Writing feature file -> ' + argv.feature);
|
console.log(' Writing feature file -> ' + argv.feature);
|
||||||
var featurefile = '\n\n';
|
var featurefile = '\n\n';
|
||||||
// markGlyphs
|
// markGlyphs
|
||||||
|
@ -72,12 +63,21 @@ if(argv.feature) {
|
||||||
+ 'table GDEF { GlyphClassDef @GDEF_Simple, @GDEF_Ligature, @GDEF_Mark, ;} GDEF;'
|
+ 'table GDEF { GlyphClassDef @GDEF_Simple, @GDEF_Ligature, @GDEF_Mark, ;} GDEF;'
|
||||||
|
|
||||||
fs.writeFileSync(argv.feature, featurefile, 'utf8');
|
fs.writeFileSync(argv.feature, featurefile, 'utf8');
|
||||||
};
|
})();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Currently unused
|
// Currently unused
|
||||||
|
if(argv.ttf) (function(){
|
||||||
|
function toBuffer(arrayBuffer) {
|
||||||
|
var length = arrayBuffer.byteLength;
|
||||||
|
var view = new DataView(arrayBuffer, 0, length);
|
||||||
|
var buffer = new Buffer(length);
|
||||||
|
for (var i = 0, l = length; i < l; i++) {
|
||||||
|
buffer[i] = view.getUint8(i, false);
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
};
|
||||||
var options = { preserveOS2Version: true };
|
var options = { preserveOS2Version: true };
|
||||||
if(argv.ttf) {
|
|
||||||
var upm = (argv.upm - 0) || 1000;
|
var upm = (argv.upm - 0) || 1000;
|
||||||
var upmscale = upm / font.head.unitsPerEm;
|
var upmscale = upm / font.head.unitsPerEm;
|
||||||
var skew = (argv.uprightify ? 1 : 0) * Math.tan((font.post.italicAngle || 0) / 180 * Math.PI);
|
var skew = (argv.uprightify ? 1 : 0) * Math.tan((font.post.italicAngle || 0) / 180 * Math.PI);
|
||||||
|
@ -108,12 +108,14 @@ if(argv.ttf) {
|
||||||
font['OS/2'].sCapHeight *= upmscale;
|
font['OS/2'].sCapHeight *= upmscale;
|
||||||
|
|
||||||
fs.writeFileSync(argv.ttf, toBuffer(new TTFWriter(options).write(font)));
|
fs.writeFileSync(argv.ttf, toBuffer(new TTFWriter(options).write(font)));
|
||||||
};
|
})();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(argv.svg) {
|
if(argv.svg) (function(){
|
||||||
console.log(' Writing outline as SVG -> ' + argv.svg);
|
console.log(' Writing outline as SVG -> ' + argv.svg);
|
||||||
function cov(x){ return Math.round(x * 10000) / 10000 }
|
function cov(x){ return Math.round(x * 10000) / 10000 };
|
||||||
|
function mix(a, b, p){ return a + (b - a) * p };
|
||||||
|
|
||||||
function toSVGPath(glyph){
|
function toSVGPath(glyph){
|
||||||
var buf = '';
|
var buf = '';
|
||||||
if(glyph.contours) for(var j = 0; j < glyph.contours.length; j++) {
|
if(glyph.contours) for(var j = 0; j < glyph.contours.length; j++) {
|
||||||
|
@ -190,9 +192,9 @@ if(argv.svg) {
|
||||||
}
|
}
|
||||||
svg += '</font></defs></svg>'
|
svg += '</font></defs></svg>'
|
||||||
fs.writeFileSync(argv.svg, svg, 'utf-8')
|
fs.writeFileSync(argv.svg, svg, 'utf-8')
|
||||||
};
|
})();
|
||||||
|
|
||||||
if(argv.meta){
|
if(argv.meta) (function(){
|
||||||
console.log(' Writing metadata as JSON -> ' + argv.meta);
|
console.log(' Writing metadata as JSON -> ' + argv.meta);
|
||||||
var glyf = font.glyf;
|
var glyf = font.glyf;
|
||||||
var glyfMap = font.glyfMap;
|
var glyfMap = font.glyfMap;
|
||||||
|
@ -203,4 +205,4 @@ if(argv.meta){
|
||||||
|
|
||||||
font.glyf = glyf;
|
font.glyf = glyf;
|
||||||
font.glyfMap = glyfMap;
|
font.glyfMap = glyfMap;
|
||||||
}
|
})();
|
|
@ -1,6 +1,6 @@
|
||||||
[iosevka]
|
[iosevka]
|
||||||
family = 'Iosevka'
|
family = 'Iosevka'
|
||||||
version = '1.4.3'
|
version = '1.5.0-pre'
|
||||||
codename = 'Aureta'
|
codename = 'Aureta'
|
||||||
copyright = 'Copyright (c) 2015 Belleve Invis.'
|
copyright = 'Copyright (c) 2015 Belleve Invis.'
|
||||||
licence = '''This font software is licenced under the SIL Open Font Licence, Version 1.1. This is licence is avaliable with a FAQ at: http://scripts.sil.org/OFL. This font software is distributes on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence fot the specific language, premissions and limitations governing your use of this font software.'''
|
licence = '''This font software is licenced under the SIL Open Font Licence, Version 1.1. This is licence is avaliable with a FAQ at: http://scripts.sil.org/OFL. This font software is distributes on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence fot the specific language, premissions and limitations governing your use of this font software.'''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user