WEBFONT: cure Chrome

This commit is contained in:
Belleve Invis 2019-07-14 14:02:56 -07:00
parent 2e98f7a1b1
commit c14a0ef556
17 changed files with 510 additions and 404 deletions

View file

@ -229,5 +229,5 @@ css = 900
# the webfont CSS. Change `parameters.toml` instead.
[slants]
upright = "normal"
italic = "italic"
oblique = "oblique"
italic = "italic"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 137 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

After

Width:  |  Height:  |  Size: 413 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 175 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 349 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 KiB

After

Width:  |  Height:  |  Size: 706 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

After

Width:  |  Height:  |  Size: 333 KiB

Before After
Before After

View file

@ -1,13 +1,14 @@
{
"name": "iosevka",
"version": "2.2.1",
"version": "2.2.2",
"main": "./generate.js",
"engines": {
"node": ">=8.4.0"
},
"scripts": {
"install": "node checkenv",
"build": "verda -f verdafile.js"
"build": "verda -f verdafile.js",
"stylus": "stylus"
},
"dependencies": {
"bezier-js": "^2.2.3",
@ -31,6 +32,7 @@
"yargs": "^12.0.0"
},
"devDependencies": {
"eslint": "^5.2.0"
"eslint": "^5.2.0",
"stylus": "^0.54.5"
}
}

View file

@ -1,46 +1,57 @@
const {app, BrowserWindow} = require('electron');
var argv = require('yargs').argv;
var fs = require('fs');
var cp = require('child_process');
const { app, BrowserWindow } = require("electron");
var argv = require("yargs").argv;
var fs = require("fs");
var cp = require("child_process");
var mainWindow = null;
var allWindowClosed = false;
var pendingTasks = 0;
var zoom = 2
var zoom = 2;
function checkQuit() {
if (allWindowClosed && pendingTasks == 0) app.quit();
}
app.on('window-all-closed', function () {
app.on("window-all-closed", function() {
allWindowClosed = true;
checkQuit()
checkQuit();
});
function combineImages(images, outfile, width, height, doubleTrim) {
var command = 'magick ' + images.join(' ') + ' -append -crop ' + width + 'x' + height + '+0+0 +repage -bordercolor #008000 -fuzz 5% -trim ' + (doubleTrim ? '-bordercolor ' + doubleTrim + ' -trim ' : '') + outfile;
var command =
"magick " +
images.join(" ") +
" -append -crop " +
width +
"x" +
height +
"+0+0 +repage -bordercolor #008000 -fuzz 5% -trim " +
(doubleTrim ? "-bordercolor " + doubleTrim + " -trim " : "") +
outfile;
console.log(command);
cp.exec(command, function (err, stdout, stderr) {
if (err) console.log(err)
images.forEach(function (file) {
cp.exec(command, function(err, stdout, stderr) {
if (err) console.log(err);
images.forEach(function(file) {
fs.unlinkSync(file);
});
pendingTasks -= 1;
checkQuit();
})
};
});
}
var ipc = require('electron').ipcMain;
function GOTO(phase) { currentPhase = phase };
var ipc = require("electron").ipcMain;
function GOTO(phase) {
currentPhase = phase;
}
var phases = {
prepare: function (event, arg) {
prepare: function(event, arg) {
console.log(arg);
GOTO(phases['receive-rect']);
GOTO(phases["receive-rect"]);
},
'receive-rect': function (event, rect) {
pendingTasks += 1
"receive-rect": function(event, rect) {
pendingTasks += 1;
rect = JSON.parse(JSON.stringify(rect));
var file = argv.dir + '/' + rect.name + '.png';
var file = argv.dir + "/" + rect.name + ".png";
var j = 0;
var totalFiles = Math.ceil(rect.height / rect.windowHeight);
var pendingFiles = totalFiles;
@ -49,48 +60,61 @@ var phases = {
if (pendingFiles <= 0) {
var images = [];
for (var k = 0; k < j; k++) {
images.push(argv.dir + '/' + rect.name + '.' + k + '.png')
images.push(argv.dir + "/" + rect.name + "." + k + ".png");
}
combineImages(images, file, rect.windowWidth * rect.dpi, rect.height * rect.dpi, rect.doubleTrim);
combineImages(
images,
file,
rect.windowWidth * rect.dpi,
rect.height * rect.dpi,
rect.doubleTrim
);
}
}
function step() {
event.sender.send('scroll', rect.y + j * rect.windowHeight);
GOTO(function (event) {
mainWindow.capturePage(function (image) {
fs.writeFile(argv.dir + '/' + rect.name + '.' + j + '.png', image.toPng(), doneFileWrite);
event.sender.send("scroll", rect.y + j * rect.windowHeight);
GOTO(function(event) {
mainWindow.capturePage(function(image) {
fs.writeFile(
argv.dir + "/" + rect.name + "." + j + ".png",
image.toPNG(),
doneFileWrite
);
j += 1;
if (j >= totalFiles) { // Move to next image
event.sender.send('complete', file);
GOTO(phases['receive-rect']);
if (j >= totalFiles) {
// Move to next image
event.sender.send("complete", file);
GOTO(phases["receive-rect"]);
} else {
step()
step();
}
})
})
};
step()
});
});
}
step();
}
};
var currentPhase = phases['prepare'];
ipc.on('snapshot', function () {
currentPhase.apply(this, arguments)
var currentPhase = phases["prepare"];
ipc.on("snapshot", function() {
currentPhase.apply(this, arguments);
});
ipc.on('log', function (event, arg) {
ipc.on("log", function(event, arg) {
console.log(arg);
})
});
app.on('ready', function () {
app.on("ready", function() {
mainWindow = new BrowserWindow({
width: 64 * 16 * zoom, height: 1024 * zoom,
x: 5000, y: 5000,
width: 64 * 16 * zoom,
height: 1024 * zoom,
//x: 5000, y: 5000,
webPreferences: {
zoomFactor: zoom
zoomFactor: zoom,
nodeIntegration: true
},
show: false
});
mainWindow.showInactive();
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.loadURL("file://" + __dirname + "/index.html");
mainWindow.blurWebView();
//mainWindow.hide();
});

View file

@ -1,24 +1,22 @@
if (window && window.process && window.process.type && process.versions["electron"])
(function() {
console.log("I AN IN ELECTRON");
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var dpi = window.devicePixelRatio;
var ipc = require("electron").ipcRenderer;
console.log("I AN IN ELECTRON");
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var dpi = window.devicePixelRatio;
var ipc = require("electron").ipcRenderer;
var onScroll = function() {};
ipc.on("scroll", function() {
var onScroll = function() {};
ipc.on("scroll", function() {
onScroll.apply(this, arguments);
setTimeout(function() {
ipc.send("snapshot", "scroll-done");
}, 500);
});
var onComplete = function() {};
ipc.on("complete", function() {
});
var onComplete = function() {};
ipc.on("complete", function() {
onComplete.apply(this, arguments);
});
});
function captureElement(options, callback) {
function captureElement(options, callback) {
window.scroll(0, 0);
setTimeout(function() {
var rect = options.el.getBoundingClientRect();
@ -41,9 +39,9 @@ if (window && window.process && window.process.type && process.versions["electro
height: rect.height | 0
});
}, 10);
}
}
window.onload = function() {
window.onload = function() {
var snapshotTasks = [
{
el: document.querySelector("#downloadoptions"),
@ -103,5 +101,4 @@ if (window && window.process && window.process.type && process.versions["electro
ipc.send("snapshot", "i am ready");
console.log("I AM READY");
setTimeout(step, 2000);
};
})();
};

View file

@ -1,301 +1,372 @@
@import url(iosevka/webfont.css)
@import url(iosevka-slab/webfont.css)
@import url('iosevka/webfont.css');
@import url('iosevka-slab/webfont.css');
.thin { font-weight: 100 }
.extralight { font-weight: 200 }
.light { font-weight: 300 }
.medium { font-weight: 500 }
.semibold { font-weight: 600 }
.bold { font-weight: 700 }
.extrabold { font-weight: 800 }
.heavy { font-weight: 900 }
.italic { font-style: italic }
.oblique { font-style: oblique }
.slab { font-family: "Iosevka Slab Web", monospace }
.thin
font-weight: 100;
html,body{
margin: 0
padding:0
}
body {
font-family: "Iosevka Web"
background: #008000
padding-bottom: 60em
font-size: 15px
}
pre, code { font-family: "Iosevka Web"; }
.extralight
font-weight: 200;
::-webkit-scrollbar {display: none;}
.light
font-weight: 300;
body > section {
margin: 3em auto
width: 900px
background: white
}
.medium
font-weight: 500;
.semibold
font-weight: 600;
.bold
font-weight: 700;
.extrabold
font-weight: 800;
.heavy
font-weight: 900;
.italic
font-style: italic;
.slab
font-family: 'Iosevka Slab Web', monospace;
&.oblique
font-family: 'Iosevka Slab Web Oblique', monospace;
.oblique
font-family: 'Iosevka Web Oblique', monospace;
html, body
margin: 0;
padding: 0;
body
font-family: 'Iosevka Web';
background: #008000;
padding-bottom: 60em;
font-size: 15px;
pre, code
font-family: 'Iosevka Web';
::-webkit-scrollbar
display: none;
body > section
margin: 3em auto;
width: 900px;
background: white;
/* hljs */
section.preview {
text-align: center
font-size: 80%
}
section.preview pre {
display: inline-block
text-align: left
margin: 1.2rem 0
line-height: 1.5
}
section.color-light {
background-color: hsl(39, 6%, 95%)
color: #333
}
.color-light .keyword, .color-light .class, .color-light .tag, .color-light .pseudo, .color-light .attr_selector, .color-light .constant, .color-light .xml .title {
color: #446fbd
}
.color-light .comment {
color: hsl(0, 0%, 62%)
}
.color-light .title, .color-light .attribute, .color-light .params, .color-light .built_in {
color: #8757ad
}
.color-light .string, .color-light .pi, .color-light .language-less .keyword, .color-light .xml .value {
color: #e88501
}
.color-light .number, .color-light .xml .attribute {
color: #6d8600
}
.color-light .operator {
color: #c33500
}
section.color-dark {
background-color: hsl(39, 6%, 12%)
color: #cfcfcf
}
.color-dark .keyword, .color-dark .class, .color-dark .tag, .color-dark .pseudo, .color-dark .attr_selector, .color-dark .constant, .color-dark .xml .title {
color: #6c9ef8
}
.color-dark .comment {
color: #767676
}
.color-dark .title, .color-dark .attribute, .color-dark .params, .color-dark .built_in {
color: #b77fdb
}
.color-dark .string, .color-dark .pi, .color-dark .language-less .keyword, .color-dark .xml .value {
color: #D89333
}
.color-dark .number, .color-dark .xml .attribute {
color: #85a300
}
.color-dark .operator {
color: #c34564
}
section.preview
text-align: center;
font-size: 80%;
section.preview pre
display: inline-block;
text-align: left;
margin: 1.2rem 0;
line-height: 1.5;
section.color-light
background-color: hsl(39, 6%, 95%);
color: #333;
.color-light .keyword, .color-light .class, .color-light .tag, .color-light .pseudo, .color-light .attr_selector, .color-light .constant, .color-light .xml .title
color: #446fbd;
.color-light .comment
color: hsl(0, 0%, 62%);
.color-light .title, .color-light .attribute, .color-light .params, .color-light .built_in
color: #8757ad;
.color-light .string, .color-light .pi, .color-light .language-less .keyword, .color-light .xml .value
color: #e88501;
.color-light .number, .color-light .xml .attribute
color: #6d8600;
.color-light .operator
color: #c33500;
section.color-dark
background-color: hsl(39, 6%, 12%);
color: #cfcfcf;
.color-dark .keyword, .color-dark .class, .color-dark .tag, .color-dark .pseudo, .color-dark .attr_selector, .color-dark .constant, .color-dark .xml .title
color: #6c9ef8;
.color-dark .comment
color: #767676;
.color-dark .title, .color-dark .attribute, .color-dark .params, .color-dark .built_in
color: #b77fdb;
.color-dark .string, .color-dark .pi, .color-dark .language-less .keyword, .color-dark .xml .value
color: #D89333;
.color-dark .number, .color-dark .xml .attribute
color: #85a300;
.color-dark .operator
color: #c34564;
section#matrix
height: 480px
position: relative
> div
position: absolute
font-size: 90px
left: 50%
margin-left: -4.75em
top: 50%
margin-top: -1.95em
> row
display: block
text-align: center
line-height: 0.8em
> span
font-size: 0.4em
padding: 0 0.5em
&.slab
margin-left: -4.25em
margin-top: -1.44em
height: 480px;
position: relative;
section#matrix > div > row > span {
font-size: 0.4em
padding: 0 0.5em
}
> div
position: absolute;
font-size: 90px;
left: 50%;
margin-left: -4.75em;
top: 50%;
margin-top: -1.95em;
> row
display: block;
text-align: center;
line-height: 0.8em;
> span
font-size: 0.4em;
padding: 0 0.5em;
&.slab
margin-left: -4.25em;
margin-top: -1.44em;
section#matrix > div > row > span
font-size: 0.4em;
padding: 0 0.5em;
section.opentype
width: 36em
padding: 0 8em
> h2 { display: none }
width: 36em;
padding: 0 8em;
> h2
display: none;
> div.hr
font-size: 80%
text-transform: uppercase
letter-spacing: 0.2em
margin: 3rem auto
text-align: center
display: block
font-size: 80%;
text-transform: uppercase;
letter-spacing: 0.2em;
margin: 3rem auto;
text-align: center;
display: block;
&:before, &:after
content: ''
display: inline-block
border-bottom: 1px solid #ddd
width: 4em
margin: 0 1em
vertical-align: 0.3em
content: '';
display: inline-block;
border-bottom: 1px solid #ddd;
width: 4em;
margin: 0 1em;
vertical-align: 0.3em;
> ol
list-style none
margin 0
padding 0
font-size 1em
width 36em
list-style: none;
margin: 0;
padding: 0;
font-size: 1em;
width: 36em;
> li
margin 0
padding 0
position relative
height 4.5em
border-top 1px solid #eee
margin-top 0.4em
padding-top 0.4em
margin: 0;
padding: 0;
position: relative;
height: 4.5em;
border-top: 1px solid #eee;
margin-top: 0.4em;
padding-top: 0.4em;
&:first-child
border-top none
margin-top 0
border-top: none;
margin-top: 0;
> .tag
display block
position absolute
top calc(0.8em - 0.2em - 1px)
left 0
font-size 0.8em
width 2em
border 1px solid rgba(0, 0, 0, 0.25)
padding 0.2em
padding-bottom 0.1em
text-align center
border-radius 0.2em
display: block;
position: absolute;
top: calc(0.8em - 0.2em - 1px);
left: 0;
font-size: 0.8em;
width: 2em;
border: 1px solid rgba(0, 0, 0, 0.25);
padding: 0.2em;
padding-bottom: 0.1em;
text-align: center;
border-radius: 0.2em;
> .description
display block
position absolute
top 0.8em
right 0
font-style italic
font-size 0.8em
color rgba(0, 0, 0, 0.5)
display: block;
position: absolute;
top: 0.8em;
right: 0;
font-style: italic;
font-size: 0.8em;
color: rgba(0, 0, 0, 0.5);
> .sample
display block
margin-top 1.6em
&.italic { margin-top: 0.25em }
display: block;
margin-top: 1.6em;
&.italic
margin-top: 0.25em;
&.narrow
display flex
justify-content center
flex-wrap wrap
display: flex;
justify-content: center;
flex-wrap: wrap;
width: 35em;
margin-left: ((35.5em - 35em) / 2);
> li
margin 0 0.5em 0.5em
border none
width 4em
flex none
margin: 0 0.5em 0.5em;
border: none;
width: 4em;
flex: none;
> .tag
width auto
left 50%
margin-left calc(-1.2em - 1px)
width: auto;
left: 50%;
margin-left: calc(-1.2em - 1px);
> .sample
display inline-block
font-size 2em
margin-top 0.9em
width 1em
text-align center
display: inline-block;
font-size: 2em;
margin-top: 0.9em;
width: 1em;
text-align: center;
b
font-weight normal
color #c33500
font-weight: normal;
color: #c33500;
#family
background: white
font-size: 0.9em
.group { display: flex }
background: white;
font-size: 0.9em;
.group
display: flex;
.group a
display: block
padding: 0.5rem
flex: 1
text-shadow: none
color: black
text-decoration: none
&.italic, &.oblique { flex: 1.3 }
&.slab { flex: 1.2 }
&.slab.italic, &.slab.oblique { flex: 1.7 }
display: block;
padding: 0.5rem;
flex: 1;
text-shadow: none;
color: black;
text-decoration: none;
&.italic, &.oblique
flex: 1.3;
&.slab
flex: 1.2;
&.slab.italic, &.slab.oblique
flex: 1.7;
#downloadoptions
display: flex
justify-content: center
display: flex;
justify-content: center;
> div
flex: none
width: 12em
border: 3px solid #ddd
border-radius: 1em
margin: 0.5em
flex: none;
width: 12em;
border: 3px solid #ddd;
border-radius: 1em;
margin: 0.5em;
> h3
margin: 0
padding: 1rem 0 1rem 0
text-align: center
font-weight: bold
font-size: 1em
margin: 0;
padding: 1rem 0 1rem 0;
text-align: center;
font-weight: bold;
font-size: 1em;
> ul
display: flex
list-style: none
margin: 0
padding: 0
justify-content: center
display: flex;
list-style: none;
margin: 0;
padding: 0;
justify-content: center;
> li
margin: 0
padding: 0
height: 3.5em
position: relative
padding: 0 0.5em 1em
margin: 0;
padding: 0;
height: 3.5em;
position: relative;
padding: 0 0.5em 1em;
> div
font-size: 0.8em
height: 2em
width: 2em
line-height: 2em
text-align: center
padding: 0.5em
border: 1px solid #ddd
border-radius: 0.5em
font-size: 0.8em;
height: 2em;
width: 2em;
line-height: 2em;
text-align: center;
padding: 0.5em;
border: 1px solid #ddd;
border-radius: 0.5em;
> h4
position: absolute
left: 0
right: 0
bottom: 1.25em
margin: 0
font-size: 0.6em
text-align: center
font-weight: normal
position: absolute;
left: 0;
right: 0;
bottom: 1.25em;
margin: 0;
font-size: 0.6em;
text-align: center;
font-weight: normal;
.missing
color: rgba(0, 0, 0, 0.25)
color: rgba(0, 0, 0, 0.25);
span
outline: 1px solid rgba(0, 0, 0, 0.2)
outline: 1px solid rgba(0, 0, 0, 0.2);
.fwm
padding-left: 0.25em
padding-right: 0.25em
margin-right: 0.25em
margin-left: -0.125em
padding-left: 0.25em;
padding-right: 0.25em;
margin-right: 0.25em;
margin-left: -0.125em;
.fwl
padding-right: 0.5em
padding-right: 0.5em;
#ligations > table
border-spacing 0
border-top 2px solid black
border-bottom 2px solid black
margin 1em auto
border-spacing: 0;
border-top: 2px solid black;
border-bottom: 2px solid black;
margin: 1em auto;
th
white-space nowrap
white-space: nowrap;
pre
margin 0
margin: 0;
th, td
padding: 0.4em 1em
text-align: left
padding: 0.4em 1em;
text-align: left;
tr.note
td
border-top 1px solid black
font-style italic
color #c33500
border-top: 1px solid black;
font-style: italic;
color: #c33500;
em, e
font-style normal
color #444
font-style: normal;
color: #444;
e
font-feature-settings: "cv19" on
font-feature-settings: 'cv19' on;
s, .nolig
text-decoration: none
opacity: 0.25
text-decoration: none;
opacity: 0.25;
.nolig
font-feature-settings: "calt" 0
font-feature-settings: 'calt' 0;

View file

@ -14,6 +14,16 @@ module.exports = function(output, family, hs, formats) {
src: ${src};
}
`;
if (term.cssStyle === "oblique") {
// CHROME hates a family with both Italic and Oblique
ans += `
@font-face {
font-family: '${family + " Web Oblique"}';
font-weight: ${term.cssWeight};
src: ${src};
}
`;
}
}
fs.writeFileSync(output, ans);
};

View file

@ -61,14 +61,16 @@ const RawPlans = oracle(`raw-plans`, async target => {
// Style groups
if (!plan.pre) plan.pre = {};
if (!plan.post) plan.post = {};
if (!plan.pre.design) plan.pre.design = plan.design || [];
if (!plan.pre.upright) plan.pre.upright = plan.upright || [];
if (!plan.pre.italic) plan.pre.italic = plan.italic || [];
if (!plan.pre.oblique) plan.pre.oblique = plan.oblique || [];
if (!plan.pre.italic) plan.pre.italic = plan.italic || [];
if (!plan.post.design) plan.post.design = [];
if (!plan.post.upright) plan.post.upright = [];
if (!plan.post.italic) plan.post.italic = [];
if (!plan.post.oblique) plan.post.oblique = [];
if (!plan.post.italic) plan.post.italic = [];
}
for (const prefix in t.collectPlans) {
t.collectPlans[prefix].prefix = prefix;
@ -385,7 +387,7 @@ const SampleImagesPre = task(`sample-images:pre`, async target => {
});
const SnapShotCSS = file(`snapshot/index.css`, async target => {
await target.need(fu`snapshot/index.styl`);
await cd(`snapshot`).run(`stylus`, `index.styl`, `-c`);
await run(`npm`, `run`, `stylus`, `snapshot/index.styl`, `-c`);
});
const TakeSampleImages = task(`sample-images:take`, async target => {
await target.need(SampleImagesPre, SnapShotCSS);