release v11.13.4
This commit is contained in:
parent
c466ee8a26
commit
546392bbd0
1 changed files with 78 additions and 72 deletions
150
maker.js
150
maker.js
|
@ -1,57 +1,62 @@
|
||||||
const fs = require('fs');
|
const fs = require("fs");
|
||||||
const path = require('path');
|
const path = require("path");
|
||||||
const argv = require('yargs').argv;
|
const argv = require("yargs").argv;
|
||||||
const pad = require('pad');
|
const pad = require("pad");
|
||||||
|
|
||||||
const weights = ['thin', 'extralight', 'light', 'book', 'medium', 'bold', 'heavy'];
|
const weights = ["thin", "extralight", "light", "book", "medium", "bold", "heavy"];
|
||||||
const slantnesses = ['upright', 'italic', 'oblique'];
|
const slantnesses = ["upright", "italic", "oblique"];
|
||||||
const widths = ['term', 'normal', 'cc'];
|
const widths = ["term", "normal", "cc"];
|
||||||
const designs = ['sans', 'slab'];
|
const designs = ["sans", "slab"];
|
||||||
|
|
||||||
function present(x) {
|
function present(x) {
|
||||||
return !!x;
|
return !!x;
|
||||||
}
|
}
|
||||||
|
|
||||||
function tofn(a) {
|
function tofn(a) {
|
||||||
return a.filter(present).join('-');
|
return a.filter(present).join("-");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMapping(options) {
|
function getMapping(options) {
|
||||||
options = options || {
|
options = options || {
|
||||||
design: [],
|
design: [],
|
||||||
width: 'normal',
|
width: "normal",
|
||||||
weight: 'book',
|
weight: "book",
|
||||||
slantness: 'upright',
|
slantness: "upright",
|
||||||
styles: {},
|
styles: {},
|
||||||
dirPrefix: '',
|
dirPrefix: "",
|
||||||
dirSuffix: '',
|
dirSuffix: "",
|
||||||
filePrefix: '',
|
filePrefix: "",
|
||||||
infix: '',
|
infix: "",
|
||||||
fileSuffix: ''
|
fileSuffix: ""
|
||||||
};
|
};
|
||||||
let design = options.design || [];
|
let design = options.design || [];
|
||||||
let prestyle = options.prestyle || [];
|
let prestyle = options.prestyle || [];
|
||||||
let weight = options.weight || 'book';
|
let weight = options.weight || "book";
|
||||||
let slantness = options.slantness || 'upright';
|
let slantness = options.slantness || "upright";
|
||||||
let hives = ['iosevka'].concat(
|
let hives = ["iosevka"].concat(
|
||||||
prestyle,
|
prestyle,
|
||||||
['w-' + weight, 's-' + slantness],
|
["w-" + weight, "s-" + slantness],
|
||||||
(options.styles || {})[slantness] || [],
|
(options.styles || {})[slantness] || [],
|
||||||
design
|
design
|
||||||
);
|
);
|
||||||
let dir = [options.dirPrefix || '', 'iosevka', options.infix || tofn(design), options.dirSuffix || '']
|
let dir = [
|
||||||
.filter(present)
|
options.dirPrefix || "",
|
||||||
.join('-');
|
"iosevka",
|
||||||
let filename = [
|
|
||||||
options.filePrefix || '',
|
|
||||||
'iosevka',
|
|
||||||
options.infix || tofn(design),
|
options.infix || tofn(design),
|
||||||
options.fileSuffix || '',
|
options.dirSuffix || ""
|
||||||
(weight === 'book' ? slantness === 'upright' ? 'regular' : '' : weight) +
|
|
||||||
(slantness === 'upright' ? '' : slantness)
|
|
||||||
]
|
]
|
||||||
.filter(present)
|
.filter(present)
|
||||||
.join('-');
|
.join("-");
|
||||||
|
let filename = [
|
||||||
|
options.filePrefix || "",
|
||||||
|
"iosevka",
|
||||||
|
options.infix || tofn(design),
|
||||||
|
options.fileSuffix || "",
|
||||||
|
(weight === "book" ? (slantness === "upright" ? "regular" : "") : weight) +
|
||||||
|
(slantness === "upright" ? "" : slantness)
|
||||||
|
]
|
||||||
|
.filter(present)
|
||||||
|
.join("-");
|
||||||
return { hives, dir, filename, custom: options.custom };
|
return { hives, dir, filename, custom: options.custom };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,12 +71,12 @@ function createMake(mapping) {
|
||||||
let woffTarget = `$(DIST)/${dir}/woff/${filename}.woff`;
|
let woffTarget = `$(DIST)/${dir}/woff/${filename}.woff`;
|
||||||
let woff2Target = `$(DIST)/${dir}/woff2/${filename}.woff2`;
|
let woff2Target = `$(DIST)/${dir}/woff2/${filename}.woff2`;
|
||||||
|
|
||||||
let buf = '';
|
let buf = "";
|
||||||
if (!definedBuildSeqs[tfname]) {
|
if (!definedBuildSeqs[tfname]) {
|
||||||
buf += `
|
buf += `
|
||||||
${tfname} : ${custom || ''} $(SCRIPTS) | $(BUILD) $(DIST)/${dir}/
|
${tfname} : ${custom || ""} $(SCRIPTS) | $(BUILD) $(DIST)/${dir}/
|
||||||
@echo Building ${filename} with ${hives.join(' ')}
|
@echo Building ${filename} with ${hives.join(" ")}
|
||||||
$(GENERATE) ${hives.join(' ')} -o $@ ${cm ? '--charmap $(BUILD)/' + filename + '.charmap' : ''}`;
|
$(GENERATE) ${hives.join(" ")} -o $@ ${cm ? "--charmap $(BUILD)/" + filename + ".charmap" : ""}`;
|
||||||
definedBuildSeqs[tfname] = true;
|
definedBuildSeqs[tfname] = true;
|
||||||
}
|
}
|
||||||
buf += `
|
buf += `
|
||||||
|
@ -99,8 +104,8 @@ let designGroups = [];
|
||||||
if (argv.custom) {
|
if (argv.custom) {
|
||||||
designGroups = [
|
designGroups = [
|
||||||
{
|
{
|
||||||
custom: '$(BUILD)/targets-' + argv.custom + '.mk',
|
custom: "$(BUILD)/targets-" + argv.custom + ".mk",
|
||||||
name: 'customized-' + argv.custom,
|
name: "customized-" + argv.custom,
|
||||||
design: argv.design.trim().split(/ +/),
|
design: argv.design.trim().split(/ +/),
|
||||||
prestyle: argv.prestyle.trim().split(/ +/),
|
prestyle: argv.prestyle.trim().split(/ +/),
|
||||||
width: argv.width,
|
width: argv.width,
|
||||||
|
@ -114,19 +119,19 @@ if (argv.custom) {
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
designGroups = [
|
designGroups = [
|
||||||
{ name: 'sans', design: [], dirPrefix: '' },
|
{ name: "sans", design: [], dirPrefix: "" },
|
||||||
{ name: 'slab', design: ['slab'], dirPrefix: '' },
|
{ name: "slab", design: ["slab"], dirPrefix: "" },
|
||||||
{ name: 'r-sans', design: [], dirPrefix: '01' },
|
{ name: "r-sans", design: [], dirPrefix: "01" },
|
||||||
{ name: 'r-sans-term', design: ['term'], dirPrefix: '02' },
|
{ name: "r-sans-term", design: ["term"], dirPrefix: "02" },
|
||||||
{ name: 'r-sans-type', design: ['type'], dirPrefix: '03' },
|
{ name: "r-sans-type", design: ["type"], dirPrefix: "03" },
|
||||||
{ name: 'r-sans-cc', design: ['cc'], dirPrefix: '04' },
|
{ name: "r-sans-cc", design: ["cc"], dirPrefix: "04" },
|
||||||
{ name: 'r-slab', design: ['slab'], dirPrefix: '05' },
|
{ name: "r-slab", design: ["slab"], dirPrefix: "05" },
|
||||||
{ name: 'r-slab-term', design: ['term', 'slab'], dirPrefix: '06' },
|
{ name: "r-slab-term", design: ["term", "slab"], dirPrefix: "06" },
|
||||||
{ name: 'r-slab-type', design: ['type', 'slab'], dirPrefix: '07' },
|
{ name: "r-slab-type", design: ["type", "slab"], dirPrefix: "07" },
|
||||||
{ name: 'r-slab-cc', design: ['cc', 'slab'], dirPrefix: '08' }
|
{ name: "r-slab-cc", design: ["cc", "slab"], dirPrefix: "08" }
|
||||||
];
|
];
|
||||||
for (let j = 1; j <= 11; j++) {
|
for (let j = 1; j <= 11; j++) {
|
||||||
const tag = 'ss' + pad(2, '' + j, '0');
|
const tag = "ss" + pad(2, "" + j, "0");
|
||||||
designGroups.push({
|
designGroups.push({
|
||||||
name: `r-sans-${tag}`,
|
name: `r-sans-${tag}`,
|
||||||
design: [tag],
|
design: [tag],
|
||||||
|
@ -134,7 +139,7 @@ if (argv.custom) {
|
||||||
});
|
});
|
||||||
designGroups.push({
|
designGroups.push({
|
||||||
name: `r-sans-term-${tag}`,
|
name: `r-sans-term-${tag}`,
|
||||||
design: ['term', tag],
|
design: ["term", tag],
|
||||||
dirPrefix: ``
|
dirPrefix: ``
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -178,7 +183,7 @@ $(DIST)/${groupMapping.dir}/woff2/ : | $(DIST)/${groupMapping.dir}/
|
||||||
config.weight = weight;
|
config.weight = weight;
|
||||||
config.slantness = slantness;
|
config.slantness = slantness;
|
||||||
const mapping = getMapping(config);
|
const mapping = getMapping(config);
|
||||||
if (weight === 'book' && slantness === 'upright') {
|
if (weight === "book" && slantness === "upright") {
|
||||||
mapping.cm = true;
|
mapping.cm = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,13 +195,15 @@ $(DIST)/${groupMapping.dir}/woff2/ : | $(DIST)/${groupMapping.dir}/
|
||||||
groupTargets.woff2.push(woff2Target);
|
groupTargets.woff2.push(woff2Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
makes.push(`fonts-${dg.name} : ${groupTargets.ttf.join(' ')}`);
|
makes.push(`fonts-${dg.name} : ${groupTargets.ttf.join(" ")}`);
|
||||||
makes.push(`fonts-${dg.name}-upright : ${groupTargets.upright.join(' ')}`);
|
makes.push(`fonts-${dg.name}-upright : ${groupTargets.upright.join(" ")}`);
|
||||||
makes.push(`fonts-${dg.name}-italic : ${groupTargets.italic.join(' ')}`);
|
makes.push(`fonts-${dg.name}-italic : ${groupTargets.italic.join(" ")}`);
|
||||||
makes.push(`fonts-${dg.name}-oblique : ${groupTargets.oblique.join(' ')}`);
|
makes.push(`fonts-${dg.name}-oblique : ${groupTargets.oblique.join(" ")}`);
|
||||||
makes.push(`web-${dg.name} : ${groupTargets.woff.join(' ')} ${groupTargets.woff2.join(' ')}`);
|
makes.push(`web-${dg.name} : ${groupTargets.woff.join(" ")} ${groupTargets.woff2.join(" ")}`);
|
||||||
makes.push(
|
makes.push(
|
||||||
`$(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip : fonts-${dg.name} web-${dg.name} | $(ARCHIVEDIR)/
|
`$(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip : fonts-${dg.name} web-${
|
||||||
|
dg.name
|
||||||
|
} | $(ARCHIVEDIR)/
|
||||||
cd $(DIST)/${groupMapping.dir}/ && 7z a -tzip -r -mx=9 ../../$@ ./`
|
cd $(DIST)/${groupMapping.dir}/ && 7z a -tzip -r -mx=9 ../../$@ ./`
|
||||||
);
|
);
|
||||||
makes.push(`archive-${dg.name} : $(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip`);
|
makes.push(`archive-${dg.name} : $(ARCHIVEDIR)/${groupMapping.dir}-$(VERSION).zip`);
|
||||||
|
@ -217,8 +224,8 @@ $(DIST)/ttc/ : | $(DIST)/
|
||||||
);
|
);
|
||||||
for (let tg of ttcgroups) {
|
for (let tg of ttcgroups) {
|
||||||
for (let weight of weights) {
|
for (let weight of weights) {
|
||||||
|
let ttctargets = [];
|
||||||
for (let slantness of slantnesses) {
|
for (let slantness of slantnesses) {
|
||||||
let ttctargets = [];
|
|
||||||
for (let dg of tg.groups) {
|
for (let dg of tg.groups) {
|
||||||
let config = Object.create(dg);
|
let config = Object.create(dg);
|
||||||
config.weight = weight;
|
config.weight = weight;
|
||||||
|
@ -226,30 +233,29 @@ $(DIST)/ttc/ : | $(DIST)/
|
||||||
const mapping = getMapping(config);
|
const mapping = getMapping(config);
|
||||||
ttctargets.push(createMake(mapping).target);
|
ttctargets.push(createMake(mapping).target);
|
||||||
}
|
}
|
||||||
|
|
||||||
let config = Object.create(tg.groups[0]);
|
|
||||||
config.weight = weight;
|
|
||||||
config.slantness = slantness;
|
|
||||||
const mapping = getMapping(config);
|
|
||||||
ttcs.push(`$(DIST)/ttc/${mapping.filename}.ttc`);
|
|
||||||
makes.push(
|
|
||||||
`
|
|
||||||
$(DIST)/ttc/${mapping.filename}.ttc : ${ttctargets.join(' ')} | $(DIST)/ttc/
|
|
||||||
otfcc-ttcize -o $@ ${ttctargets.join(' ')}
|
|
||||||
`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
let config = Object.create(tg.groups[0]);
|
||||||
|
config.weight = weight;
|
||||||
|
config.slantness = "upright";
|
||||||
|
const mapping = getMapping(config);
|
||||||
|
ttcs.push(`$(DIST)/ttc/${mapping.filename}.ttc`);
|
||||||
|
makes.push(
|
||||||
|
`
|
||||||
|
$(DIST)/ttc/${mapping.filename}.ttc : ${ttctargets.join(" ")} | $(DIST)/ttc/
|
||||||
|
otfcc-ttcize -o $@ ${ttctargets.join(" ")}
|
||||||
|
`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
makes.push(`ttc : ${ttcs.join(' ')}`);
|
makes.push(`ttc : ${ttcs.join(" ")}`);
|
||||||
makes.push(
|
makes.push(
|
||||||
`$(ARCHIVEDIR)/iosevka-pack-$(VERSION).zip : ttc | $(ARCHIVEDIR)/
|
`$(ARCHIVEDIR)/iosevka-pack-$(VERSION).zip : ttc | $(ARCHIVEDIR)/
|
||||||
cd $(DIST)/ttc/ && 7z a -tzip -mx=9 ../../$@ ./*.ttc`
|
cd $(DIST)/ttc/ && 7z a -tzip -mx=9 ../../$@ ./*.ttc`
|
||||||
);
|
);
|
||||||
makes.push(`archive-ttc : $(ARCHIVEDIR)/iosevka-pack-$(VERSION).zip`);
|
makes.push(`archive-ttc : $(ARCHIVEDIR)/iosevka-pack-$(VERSION).zip`);
|
||||||
makes.push(`__default : fonts-sans fonts-slab`);
|
makes.push(`__default : fonts-sans fonts-slab`);
|
||||||
makes.push(`__release : archive-ttc ${designGroups.map(g => 'archive-' + g.name).join(' ')}`);
|
makes.push(`__release : archive-ttc ${designGroups.map(g => "archive-" + g.name).join(" ")}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(makes.join('\n\n'));
|
console.log(makes.join("\n\n"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue