made autoref more strict to fix #241.
This commit is contained in:
parent
f0643152bf
commit
5da7f90a79
6 changed files with 59 additions and 45 deletions
4
.prettierrc.yaml
Normal file
4
.prettierrc.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
# .prettierrc
|
||||
printWidth: 100
|
||||
useTabs: true
|
||||
tabWidth: 4
|
|
@ -103,8 +103,12 @@ const font = (function() {
|
|||
.sort(function(a, b) {
|
||||
var pri1 = a.cmpPriority || 0;
|
||||
var pri2 = b.cmpPriority || 0;
|
||||
if (pri1 > pri2) return -1;
|
||||
if (pri1 < pri2) return 1;
|
||||
if (a.contours && b.contours && a.contours.length < b.contours.length) return 1;
|
||||
if (a.contours && b.contours && a.contours.length > b.contours.length) return -1;
|
||||
if (a.advanceWidth < b.advanceWidth) return -1;
|
||||
if (a.advanceWidth > b.advanceWidth) return 1;
|
||||
if ((a.unicode && a.unicode[0] && !b.unicode) || !b.unicode[0]) return -1;
|
||||
if ((b.unicode && b.unicode[0] && !a.unicode) || !a.unicode[0]) return +1;
|
||||
if (
|
||||
|
|
|
@ -268,6 +268,7 @@ export : define [apply] : begin
|
|||
apply-transform : Italify
|
||||
set currentGlyph.cmpPriority 12
|
||||
refair this
|
||||
set-width 0
|
||||
return lg
|
||||
|
||||
define [circleDimens dscale w m] : begin
|
||||
|
@ -389,6 +390,7 @@ export : define [apply] : begin
|
|||
apply-transform : Italify
|
||||
set currentGlyph.cmpPriority 11
|
||||
refair this
|
||||
set-width 0
|
||||
|
||||
sketch
|
||||
local s : TANSLANT * parenMid
|
||||
|
|
|
@ -22,35 +22,27 @@ export : define [apply] : begin
|
|||
save 'brailleBlank' 0x2800
|
||||
sketch # braille1
|
||||
include : DotAt (leftMiddle) (parenMid - 3 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille1' 0x2801
|
||||
sketch # braille2
|
||||
include : DotAt (leftMiddle) (parenMid - 1 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille2' 0x2802
|
||||
sketch # braille3
|
||||
include : DotAt (leftMiddle) (parenMid + 1 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille3' 0x2804
|
||||
sketch # braille4
|
||||
include : DotAt (rightMiddle) (parenMid - 3 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille4' 0x2808
|
||||
sketch # braille5
|
||||
include : DotAt (rightMiddle) (parenMid - 1 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille5' 0x2810
|
||||
sketch # braille6
|
||||
include : DotAt (rightMiddle) (parenMid + 1 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille6' 0x2820
|
||||
sketch # braille7
|
||||
include : DotAt (leftMiddle) (parenMid + 3 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille7' 0x2840
|
||||
save 'braille4' 0x2840
|
||||
sketch # braille5
|
||||
include : DotAt (rightMiddle) (parenMid - 3 * offsetY) brailleDotsRadius
|
||||
save 'braille5' 0x2808
|
||||
sketch # braille6
|
||||
include : DotAt (rightMiddle) (parenMid - 1 * offsetY) brailleDotsRadius
|
||||
save 'braille6' 0x2810
|
||||
sketch # braille7
|
||||
include : DotAt (rightMiddle) (parenMid + 1 * offsetY) brailleDotsRadius
|
||||
save 'braille7' 0x2820
|
||||
sketch # braille8
|
||||
include : DotAt (rightMiddle) (parenMid + 3 * offsetY) brailleDotsRadius
|
||||
set currentGlyph.cmpPriority (-101)
|
||||
save 'braille8' 0x2880
|
||||
|
||||
### Template
|
||||
|
@ -63,11 +55,18 @@ export : define [apply] : begin
|
|||
### Inheriting characters
|
||||
build-braille-patterns braillePatterns
|
||||
|
||||
set glyphs.braille1237.cmpPriority 104
|
||||
set glyphs.braille123.cmpPriority 103
|
||||
set glyphs.braille127.cmpPriority 103
|
||||
set glyphs.braille137.cmpPriority 103
|
||||
set glyphs.braille13.cmpPriority 102
|
||||
set glyphs.braille12.cmpPriority 102
|
||||
set glyphs.braille17.cmpPriority 102
|
||||
set glyphs.braille1.cmpPriority 103
|
||||
set glyphs.braille4.cmpPriority 101
|
||||
set glyphs.braille34.cmpPriority 102
|
||||
set glyphs.braille3.cmpPriority 101
|
||||
set glyphs.braille234.cmpPriority 103
|
||||
set glyphs.braille24.cmpPriority 102
|
||||
set glyphs.braille23.cmpPriority 102
|
||||
set glyphs.braille2.cmpPriority 101
|
||||
set glyphs.braille1234.cmpPriority 104
|
||||
set glyphs.braille123.cmpPriority 103
|
||||
set glyphs.braille124.cmpPriority 103
|
||||
set glyphs.braille134.cmpPriority 103
|
||||
set glyphs.braille13.cmpPriority 102
|
||||
set glyphs.braille12.cmpPriority 102
|
||||
set glyphs.braille14.cmpPriority 102
|
||||
set glyphs.braille1.cmpPriority 101
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
"name": "iosevka",
|
||||
"version": "1.13.3",
|
||||
"main": "./generate.js",
|
||||
"engines": { "node" : ">=8.4.0" },
|
||||
"engines": {
|
||||
"node": ">=8.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bezier-js": "^2.2.3",
|
||||
"caryll-shapeops": "^0.2.1",
|
||||
"caryll-shapeops": "^0.3.1",
|
||||
"libspiro-js": "^0.3.1",
|
||||
"object-assign": "^4.1.1",
|
||||
"megaminx": "^0.3.3",
|
||||
"object-assign": "^4.1.1",
|
||||
"pad": "^1.1.0",
|
||||
"patel": "^0.32.1",
|
||||
"toml": "^2.3.2",
|
||||
|
|
|
@ -36,12 +36,17 @@ function match(g1, g2, _n) {
|
|||
}
|
||||
}
|
||||
if (found) {
|
||||
const refX = g2.contours[j][0].x - g1.contours[0][0].x || 0;
|
||||
const refY = g2.contours[j][0].y - g1.contours[0][0].y || 0;
|
||||
if (Math.abs(refY) > 1 && g1.advanceWidth > 1) {
|
||||
continue;
|
||||
}
|
||||
if (!g2.references) g2.references = [];
|
||||
g2.references.push({
|
||||
glyph: g1.name,
|
||||
_n: _n,
|
||||
x: g2.contours[j][0].x - g1.contours[0][0].x,
|
||||
y: g2.contours[j][0].y - g1.contours[0][0].y,
|
||||
x: refX,
|
||||
y: refY,
|
||||
roundToGrid: true // RTG
|
||||
});
|
||||
g2.contours.splice(j, g1.contours.length);
|
||||
|
@ -78,26 +83,24 @@ function autoref(glyf) {
|
|||
if (!glyf[j].contours.length || (glyf[j].references && glyf[j].references.length)) continue;
|
||||
for (var k = j + 1; k < glyf.length; k++) {
|
||||
if (glyf[j].contours.length === glyf[k].contours.length) {
|
||||
if (match(glyf[j], glyf[k], j)) {
|
||||
// console.log("Refl", glyf[j].name, glyf[j].unicode, "->", glyf[k].name, glyf[k].unicode);
|
||||
}
|
||||
match(glyf[j], glyf[k], j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// referencify, backward
|
||||
for (var j = 0; j < glyf.length; j++) {
|
||||
if (
|
||||
glyf[j].cmpPriority < 0 ||
|
||||
!glyf[j].contours.length ||
|
||||
(glyf[j].references && glyf[j].references.length)
|
||||
)
|
||||
continue;
|
||||
for (var k = j - 1; k >= 0; k--) {
|
||||
if (glyf[j].contours.length > glyf[k].contours.length) continue;
|
||||
while (match(glyf[j], glyf[k], j)) {
|
||||
// console.log("Part", glyf[j].name, "->", glyf[k].name);
|
||||
}
|
||||
if (glyf[j].cmpPriority < 0) continue;
|
||||
if (!glyf[j].contours.length) continue;
|
||||
if (glyf[j].references && glyf[j].references.length) continue;
|
||||
for (var k = glyf.length - 1; k >= 0; k--) {
|
||||
if (
|
||||
glyf[j].contours.length > glyf[k].contours.length ||
|
||||
(glyf[j].contours.length === glyf[k].contours.length &&
|
||||
!(glyf[k].references && glyf[k].references.length))
|
||||
)
|
||||
continue;
|
||||
while (match(glyf[j], glyf[k], j)) "pass";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue