Add unhinted webfont targets (#1363)
This commit is contained in:
parent
dd627b4556
commit
5d747b9a66
3 changed files with 148 additions and 97 deletions
|
@ -6,7 +6,7 @@ const WebfontFormatMap = new Map([
|
|||
["woff2", "woff2"],
|
||||
["ttf", "truetype"]
|
||||
]);
|
||||
module.exports = function (output, family, hs, formats) {
|
||||
module.exports = function (output, family, hs, formats, unhinted) {
|
||||
if (!formats) {
|
||||
fs.writeFileSync(output, "");
|
||||
return;
|
||||
|
@ -17,8 +17,13 @@ module.exports = function (output, family, hs, formats) {
|
|||
if (!WebfontFormatMap.get(ext)) throw new TypeError("Invalid webfont file format " + ext);
|
||||
}
|
||||
for (const term of hs) {
|
||||
const dirSuffix = unhinted ? "-unhinted" : "";
|
||||
const src = formats
|
||||
.map(ext => `url('${ext}/${term.name}.${ext}') format('${WebfontFormatMap.get(ext)}')`)
|
||||
.map(
|
||||
ext =>
|
||||
`url('${ext}${dirSuffix}/${term.name}.${ext}') ` +
|
||||
`format('${WebfontFormatMap.get(ext)}')`
|
||||
)
|
||||
.join(", ");
|
||||
ans += `
|
||||
@font-face {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue