add more circled glyphs and paren glyphs
This commit is contained in:
parent
7e2b717980
commit
d5c87914f5
5 changed files with 239 additions and 150 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -58,3 +58,5 @@ meta/*.js
|
||||||
meta/feature/*.js
|
meta/feature/*.js
|
||||||
glyphs/*.js
|
glyphs/*.js
|
||||||
testdrive/assets
|
testdrive/assets
|
||||||
|
|
||||||
|
package-lock.json
|
|
@ -249,37 +249,46 @@ export : define [apply] : begin
|
||||||
local dscale 0.55
|
local dscale 0.55
|
||||||
local pendingGlyphs : records.map : [record] => record.1
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
local miniatureFont : Miniature
|
local miniatureFont : Miniature
|
||||||
glyphs -- pendingGlyphs
|
glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]]
|
||||||
crowd -- [fallback para.smallCrowd 3.75]
|
crowd -- [fallback para.smallCrowd 3.75]
|
||||||
scale -- 0.65
|
scale -- 0.65
|
||||||
unfair -- true
|
unfair -- true
|
||||||
|
|
||||||
foreach {unicode glyphid w} [items-of records] : create-glyph [suggestName : 'circle' + glyphid] : glyph-construction
|
foreach {unicode parts w} [items-of records] : do
|
||||||
|
local gn : suggestName : 'circle-' + [parts.join '_']
|
||||||
|
local gni : suggestName : 'circle-inner-' + [parts.join '_']
|
||||||
local width : fallback w WIDTH
|
local width : fallback w WIDTH
|
||||||
set-width width
|
|
||||||
local sw [adviceBlackness 5]
|
local sw [adviceBlackness 5]
|
||||||
if unicode : assign-unicode unicode
|
local top (CAP * dscale + [Math.max (CAP * 0.175) (sw * 3)])
|
||||||
include : create-glyph [suggestName : 'circleinner' + glyphid] : glyph-construction
|
local bot (-[Math.max (CAP * 0.175) (sw * 3)])
|
||||||
|
local left : Math.max (SB + O * 3) : Math.min (width / 2 - (top - bot) / 2) (width / 2 - CAP / 2 * dscale - sw * 2.5)
|
||||||
|
local right : Math.min (width - SB - O * 3) : Math.max (width / 2 + (top - bot) / 2) (width / 2 + CAP / 2 * dscale + sw * 2.5)
|
||||||
|
|
||||||
|
local lg : create-glyph gni : glyph-construction
|
||||||
|
local tw 0
|
||||||
|
foreach [glyphid : items-of parts] : begin
|
||||||
local g miniatureFont.(glyphid)
|
local g miniatureFont.(glyphid)
|
||||||
include g
|
include g
|
||||||
|
apply-transform : Translate (-g.advanceWidth) 0
|
||||||
|
set tw : tw + g.advanceWidth
|
||||||
|
apply-transform : Translate tw 0
|
||||||
|
apply-transform : Upright
|
||||||
|
apply-transform : Scale [Math.min 1 (width / tw)] 1
|
||||||
|
set tw : Math.min width tw
|
||||||
local shift 0
|
local shift 0
|
||||||
if (g.anchors.above && g.anchors.below) : set shift : CAP / 2 - [mix g.anchors.above.y g.anchors.below.y 0.5]
|
if (g.anchors.above && g.anchors.below) : set shift : CAP / 2 - [mix g.anchors.above.y g.anchors.below.y 0.5]
|
||||||
apply-transform : Upright
|
apply-transform : Translate (-tw / 2) (-CAP / 2 + shift)
|
||||||
apply-transform : Translate (-WIDTH / 2) (-CAP / 2 + shift)
|
|
||||||
apply-transform : Scale dscale
|
apply-transform : Scale dscale
|
||||||
apply-transform : Translate (width / 2) (CAP / 2 * dscale)
|
apply-transform : Translate (width / 2) (CAP / 2 * dscale)
|
||||||
apply-transform : Italify
|
apply-transform : Italify
|
||||||
set currentGlyph.cmpPriority 12
|
set currentGlyph.cmpPriority 12
|
||||||
refair this
|
refair this
|
||||||
|
|
||||||
include : OShape
|
create-glyph gn : glyph-construction
|
||||||
* (CAP * dscale + [Math.max (CAP * 0.175) (sw * 3)])
|
set-width width
|
||||||
* (-[Math.max (CAP * 0.175) (sw * 3)])
|
if unicode : assign-unicode unicode
|
||||||
* [Math.max (SB + O * 3) (width / 2 - CAP / 2 * dscale - sw * 2.5)]
|
include lg
|
||||||
* [Math.min (width - SB - O * 3) (width / 2 + CAP / 2 * dscale + sw * 2.5)]
|
include : OShape top bot left right sw (SMALLSMOOTHA * width / WIDTH) (SMALLSMOOTHB * width / WIDTH)
|
||||||
* sw
|
|
||||||
* (SMALLSMOOTHA * width / WIDTH)
|
|
||||||
* (SMALLSMOOTHB * width / WIDTH)
|
|
||||||
apply-transform : Upright
|
apply-transform : Upright
|
||||||
apply-transform : Translate 0 (parenMid - CAP * dscale / 2)
|
apply-transform : Translate 0 (parenMid - CAP * dscale / 2)
|
||||||
apply-transform : Italify
|
apply-transform : Italify
|
||||||
|
@ -289,29 +298,43 @@ export : define [apply] : begin
|
||||||
local pscale 0.6
|
local pscale 0.6
|
||||||
local pendingGlyphs : records.map : [record] => record.1
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
local miniatureFont : Miniature
|
local miniatureFont : Miniature
|
||||||
glyphs -- pendingGlyphs
|
glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]]
|
||||||
crowd -- [fallback para.smallCrowd 3.75]
|
crowd -- [fallback para.smallCrowd 3.75]
|
||||||
scale -- 0.65
|
scale -- 0.65
|
||||||
sbscale -- 1
|
sbscale -- 1
|
||||||
unfair -- true
|
unfair -- true
|
||||||
|
|
||||||
foreach {unicode glyphid w} [items-of records] : sketch
|
foreach {unicode parts w} [items-of records] : do
|
||||||
|
local gn : suggestName : 'braced-' + [parts.join '_']
|
||||||
|
local gni : suggestName : 'braced-inner-' + [parts.join '_']
|
||||||
local width : fallback w WIDTH
|
local width : fallback w WIDTH
|
||||||
set-width width
|
|
||||||
local sw [adviceBlackness 5]
|
local sw [adviceBlackness 5]
|
||||||
local l : [Math.max (SB + O * 3) (width / 2 - CAP / 2 * dscale - sw * 2.5)] + OX
|
local l : [Math.max (SB + O * 3) (width / 2 - CAP / 2 * dscale - sw * 2.5)] + OX
|
||||||
local r : width - l
|
local r : width - l
|
||||||
|
|
||||||
include : create-glyph [suggestName : 'braceinner' + glyphid] : glyph-construction
|
local lg : create-glyph gni : glyph-construction
|
||||||
include miniatureFont.(glyphid)
|
local tw 0
|
||||||
|
foreach [glyphid : items-of parts] : begin
|
||||||
|
local g miniatureFont.(glyphid)
|
||||||
|
if tw : begin # Add a little kern
|
||||||
|
set tw : tw - SB
|
||||||
|
apply-transform : Translate SB 0
|
||||||
|
include g
|
||||||
|
apply-transform : Translate (-g.advanceWidth) 0
|
||||||
|
set tw : tw + g.advanceWidth
|
||||||
|
apply-transform : Translate tw 0
|
||||||
apply-transform : Upright
|
apply-transform : Upright
|
||||||
apply-transform : Translate (-WIDTH / 2) 0
|
apply-transform : Scale [Math.min 1 (width / tw)] 1
|
||||||
|
set tw : Math.min width tw
|
||||||
|
apply-transform : Translate (-tw / 2) 0
|
||||||
apply-transform : Scale dscale
|
apply-transform : Scale dscale
|
||||||
apply-transform : Translate (width / 2) 0
|
apply-transform : Translate (width / 2) 0
|
||||||
apply-transform : Italify
|
apply-transform : Italify
|
||||||
set currentGlyph.cmpPriority 11
|
set currentGlyph.cmpPriority 11
|
||||||
refair this
|
refair this
|
||||||
|
sketch
|
||||||
|
set-width width
|
||||||
|
include lg
|
||||||
include : dispiro
|
include : dispiro
|
||||||
widths.lhs sw
|
widths.lhs sw
|
||||||
g4 [mix l r 0.15] (parenTop * pscale)
|
g4 [mix l r 0.15] (parenTop * pscale)
|
||||||
|
@ -328,7 +351,43 @@ export : define [apply] : begin
|
||||||
include : Translate 0 (parenMid - parenMid * pscale)
|
include : Translate 0 (parenMid - parenMid * pscale)
|
||||||
include : Italify
|
include : Italify
|
||||||
|
|
||||||
save [suggestName : 'braced' + glyphid] unicode
|
save gn unicode
|
||||||
|
|
||||||
|
define [createDottedGlyphs shrink records] : if [not recursive] : begin
|
||||||
|
local dscale 0.55
|
||||||
|
local pscale 0.6
|
||||||
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
|
local miniatureFont : Thinner
|
||||||
|
[pendingGlyphs.reduce : [a b] => [a.concat b]].concat {'period'}
|
||||||
|
if (para.spacing > 1) 1 shrink
|
||||||
|
|
||||||
|
foreach {unicode parts w} [items-of records] : do
|
||||||
|
local gn : suggestName : 'dotted-' + [parts.join '_']
|
||||||
|
local width : fallback w WIDTH
|
||||||
|
local sw [adviceBlackness 5]
|
||||||
|
local l : [Math.max (SB + O * 3) (width / 2 - CAP / 2 * dscale - sw * 2.5)] + OX
|
||||||
|
local r : width - l
|
||||||
|
|
||||||
|
sketch
|
||||||
|
set-width width
|
||||||
|
local tw 0
|
||||||
|
foreach [glyphid : items-of : parts.concat {'period'}] : begin
|
||||||
|
local g miniatureFont.(glyphid)
|
||||||
|
if tw : begin # Add a little kern
|
||||||
|
set tw : tw - SB
|
||||||
|
apply-transform : Translate SB 0
|
||||||
|
include g
|
||||||
|
apply-transform : Translate (-g.advanceWidth) 0
|
||||||
|
set tw : tw + g.advanceWidth
|
||||||
|
apply-transform : Translate tw 0
|
||||||
|
set tw : tw - SB
|
||||||
|
apply-transform : Upright
|
||||||
|
if (tw > width)
|
||||||
|
: then : apply-transform : Scale [Math.min 1 (width / tw)] 1
|
||||||
|
: else : apply-transform : Translate (width / 2 - tw / 2) 0
|
||||||
|
apply-transform : Italify
|
||||||
|
set currentGlyph.cmpPriority 11
|
||||||
|
save gn unicode
|
||||||
|
|
||||||
define [createSuperscripts records] : if [not recursive] : begin
|
define [createSuperscripts records] : if [not recursive] : begin
|
||||||
local pendingGlyphs : records.map : [record] => record.1
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
|
@ -434,25 +493,6 @@ export : define [apply] : begin
|
||||||
apply-transform : Italify
|
apply-transform : Italify
|
||||||
include : HBar SB RIGHTSB parenMid (fine * 0.75)
|
include : HBar SB RIGHTSB parenMid (fine * 0.75)
|
||||||
|
|
||||||
|
|
||||||
if [not recursive] : let : begin
|
|
||||||
local compositions : list
|
|
||||||
list 0xA9 'C' FULLWIDTH2
|
|
||||||
list 0xAE 'R' FULLWIDTH2
|
|
||||||
list 0x2117 'P' FULLWIDTH2
|
|
||||||
list 0x24EA 'zero' FULLWIDTH1
|
|
||||||
list null 'space' FULLWIDTH1
|
|
||||||
foreach [j : range 1 till 9] : compositions.push {(0x2460 + j - 1) unicodeGlyphs.(['0'.charCodeAt 0] + j).name FULLWIDTH1}
|
|
||||||
foreach [j : range 0 26] : compositions.push {(0x24B6 + j) unicodeGlyphs.(['A'.charCodeAt 0] + j).name FULLWIDTH1}
|
|
||||||
foreach [j : range 0 26] : compositions.push {(0x24D0 + j) unicodeGlyphs.(['a'.charCodeAt 0] + j).name FULLWIDTH1}
|
|
||||||
createCircledGlyphs compositions
|
|
||||||
|
|
||||||
local compositions : list
|
|
||||||
list null 'space' FULLWIDTH1
|
|
||||||
foreach [j : range 1 till 9] : compositions.push {(0x2474 + j - 1) unicodeGlyphs.(['0'.charCodeAt 0] + j).name FULLWIDTH1}
|
|
||||||
foreach [j : range 0 26] : compositions.push {(0x249C + j) unicodeGlyphs.(['a'.charCodeAt 0] + j).name FULLWIDTH1}
|
|
||||||
createBracedGlyphs compositions
|
|
||||||
|
|
||||||
createSMCPs : list
|
createSMCPs : list
|
||||||
list 0x1D00 'A'
|
list 0x1D00 'A'
|
||||||
list 0x1D01 'AE'
|
list 0x1D01 'AE'
|
||||||
|
@ -747,8 +787,6 @@ export : define [apply] : begin
|
||||||
list 0x1DF4 'udieresis'
|
list 0x1DF4 'udieresis'
|
||||||
|
|
||||||
# Unicode Ligatures
|
# Unicode Ligatures
|
||||||
let : begin
|
|
||||||
define stdShrink : clamp 0.75 0.9 : linreg 72 0.75 108 0.9 STROKE
|
|
||||||
define [createLigatures shrink1 shrink2 wadj1 wadj2 records] : if [not recursive] : begin
|
define [createLigatures shrink1 shrink2 wadj1 wadj2 records] : if [not recursive] : begin
|
||||||
local pendingGlyphs1 : records.map : [record] => record.1
|
local pendingGlyphs1 : records.map : [record] => record.1
|
||||||
local pendingGlyphs2 : records.map : [record] => record.2
|
local pendingGlyphs2 : records.map : [record] => record.2
|
||||||
|
@ -785,6 +823,7 @@ export : define [apply] : begin
|
||||||
if mark : include mark
|
if mark : include mark
|
||||||
save glyphName unicode
|
save glyphName unicode
|
||||||
|
|
||||||
|
define stdShrink : clamp 0.75 0.9 : linreg 72 0.75 108 0.9 STROKE
|
||||||
createLigatures stdShrink stdShrink 1 1 : list
|
createLigatures stdShrink stdShrink 1 1 : list
|
||||||
list 0x1C4 'D' 'Zcaron'
|
list 0x1C4 'D' 'Zcaron'
|
||||||
list 0x1C5 'D' 'zcaron'
|
list 0x1C5 'D' 'zcaron'
|
||||||
|
@ -815,6 +854,40 @@ export : define [apply] : begin
|
||||||
list 0x2103 'degree' 'C'
|
list 0x2103 'degree' 'C'
|
||||||
list 0x2109 'degree' 'F'
|
list 0x2109 'degree' 'F'
|
||||||
|
|
||||||
|
# Circled & Braced
|
||||||
|
if [not recursive] : let : begin
|
||||||
|
local compositions : list
|
||||||
|
list 0xA9 {'C'} FULLWIDTH2
|
||||||
|
list 0xAE {'R'} FULLWIDTH2
|
||||||
|
list 0x2117 {'P'} FULLWIDTH2
|
||||||
|
list 0x24EA {'zero'} FULLWIDTH1
|
||||||
|
list null {'space'} FULLWIDTH1
|
||||||
|
foreach [j : range 1 till 20] : compositions.push : list
|
||||||
|
0x2460 + j - 1
|
||||||
|
[(j+'').split ''].map : c => unicodeGlyphs.(['0'.charCodeAt 0] + (c - 0)).name
|
||||||
|
begin FULLWIDTH1
|
||||||
|
foreach [j : range 0 26] : compositions.push {(0x24B6 + j) {unicodeGlyphs.(['A'.charCodeAt 0] + j).name} FULLWIDTH1}
|
||||||
|
foreach [j : range 0 26] : compositions.push {(0x24D0 + j) {unicodeGlyphs.(['a'.charCodeAt 0] + j).name} FULLWIDTH1}
|
||||||
|
createCircledGlyphs compositions
|
||||||
|
|
||||||
|
if [not recursive] : let : begin
|
||||||
|
local compositions : list
|
||||||
|
list null {'space'} FULLWIDTH1
|
||||||
|
foreach [j : range 1 till 20] : compositions.push : list
|
||||||
|
0x2474 + j - 1
|
||||||
|
[(j+'').split ''].map : c => unicodeGlyphs.(['0'.charCodeAt 0] + (c - 0)).name
|
||||||
|
begin FULLWIDTH1
|
||||||
|
foreach [j : range 0 26] : compositions.push {(0x249C + j) {unicodeGlyphs.(['a'.charCodeAt 0] + j).name} FULLWIDTH1}
|
||||||
|
createBracedGlyphs compositions
|
||||||
|
|
||||||
|
if [not recursive] : let : begin
|
||||||
|
local compositions {}
|
||||||
|
foreach [j : range 1 till [if (para.spacing > 0) 20 9]] : compositions.push : list
|
||||||
|
0x2488 + j - 1
|
||||||
|
[(j+'').split ''].map : c => unicodeGlyphs.(['0'.charCodeAt 0] + (c - 0)).name
|
||||||
|
begin FULLWIDTH1
|
||||||
|
createDottedGlyphs 0.9 compositions
|
||||||
|
|
||||||
# Composite superscripts and subscripts
|
# Composite superscripts and subscripts
|
||||||
let : begin
|
let : begin
|
||||||
define [doubleSuperscript a b] : glyph-construction
|
define [doubleSuperscript a b] : glyph-construction
|
||||||
|
|
3
makefile
3
makefile
|
@ -27,6 +27,9 @@ test : $(BUILD)/targets.mk
|
||||||
fw : $(BUILD)/targets.mk
|
fw : $(BUILD)/targets.mk
|
||||||
@$(MAKE) -f utility/standard.mk fw
|
@$(MAKE) -f utility/standard.mk fw
|
||||||
|
|
||||||
|
scripts :
|
||||||
|
@$(MAKE) -f utility/scripts.mk scripts
|
||||||
|
|
||||||
sample-images :
|
sample-images :
|
||||||
@$(MAKE) -f utility/standard.mk sample-images
|
@$(MAKE) -f utility/standard.mk sample-images
|
||||||
|
|
||||||
|
|
16
package.json
16
package.json
|
@ -3,17 +3,17 @@
|
||||||
"version": "1.9.2",
|
"version": "1.9.2",
|
||||||
"main": "./generate.js",
|
"main": "./generate.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bezier-js": "^2.0.0",
|
"bezier-js": "^2.2.3",
|
||||||
"caryll-shapeops": "^0.2.0",
|
"caryll-shapeops": "^0.2.1",
|
||||||
"cubic2quad": "^1.0.0",
|
"cubic2quad": "^1.1.1",
|
||||||
"libspiro-js": ">=0.3.0",
|
"libspiro-js": "^0.3.1",
|
||||||
"object-assign": "^4.1.1",
|
"object-assign": "^4.1.1",
|
||||||
"otfcc-c2q": "^0.5.0",
|
"otfcc-c2q": "^0.5.0",
|
||||||
"pad": "^1.1.0",
|
"pad": "^1.1.0",
|
||||||
"patel": ">=0.32.0",
|
"patel": "^0.32.1",
|
||||||
"toml": ">=2.3.0",
|
"toml": "^2.3.2",
|
||||||
"topsort": "0.0.2",
|
"topsort": "0.0.2",
|
||||||
"unorm": ">=1.4.1",
|
"unorm": "^1.4.1",
|
||||||
"yargs": "*"
|
"yargs": "^8.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ function contourHash(c) {
|
||||||
var buf = "";
|
var buf = "";
|
||||||
for (var j = 1; j < c.length; j++) {
|
for (var j = 1; j < c.length; j++) {
|
||||||
var z = c[j];
|
var z = c[j];
|
||||||
buf += `${z.on ? 'o' : 'f'}${z.cubic ? 'c' : 'q'}${delta(z.x, lx)},${delta(z.y, ly)};`;
|
buf += `${z.on ? "o" : "f"}${z.cubic ? "c" : "q"}${delta(z.x, lx)},${delta(z.y, ly)};`;
|
||||||
lx = z.x, ly = z.y;
|
(lx = z.x), (ly = z.y);
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,14 @@ function match(g1, g2, _n) {
|
||||||
for (let j = 0; j + g1.contours.length <= g2.contours.length; j++) {
|
for (let j = 0; j + g1.contours.length <= g2.contours.length; j++) {
|
||||||
var found = true;
|
var found = true;
|
||||||
for (var k = j; k < g2.contours.length && k - j < g1.contours.length; k++) {
|
for (var k = j; k < g2.contours.length && k - j < g1.contours.length; k++) {
|
||||||
if (g1.contours[k - j].hash !== g2.contours[k].hash
|
if (
|
||||||
|| !(k <= j || delta(g1.contours[k - j][0].x, g1.contours[k - j - 1][0].x) === delta(g2.contours[k][0].x, g2.contours[k - 1][0].x)
|
g1.contours[k - j].hash !== g2.contours[k].hash ||
|
||||||
&& delta(g1.contours[k - j][0].y, g1.contours[k - j - 1][0].y) === delta(g2.contours[k][0].y, g2.contours[k - 1][0].y))) {
|
!(k <= j ||
|
||||||
|
(delta(g1.contours[k - j][0].x, g1.contours[k - j - 1][0].x) ===
|
||||||
|
delta(g2.contours[k][0].x, g2.contours[k - 1][0].x) &&
|
||||||
|
delta(g1.contours[k - j][0].y, g1.contours[k - j - 1][0].y) ===
|
||||||
|
delta(g2.contours[k][0].y, g2.contours[k - 1][0].y)))
|
||||||
|
) {
|
||||||
found = false;
|
found = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -64,10 +69,9 @@ function autoref(glyf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Refl-referencify, forward.
|
// Refl-referencify, forward.
|
||||||
for (var j = 0; j < glyf.length; j++) {
|
for (var j = 0; j < glyf.length; j++) {
|
||||||
if (!glyf[j].contours.length || glyf[j].references && glyf[j].references.length) continue;
|
if (!glyf[j].contours.length || (glyf[j].references && glyf[j].references.length)) continue;
|
||||||
for (var k = j + 1; k < glyf.length; k++) {
|
for (var k = j + 1; k < glyf.length; k++) {
|
||||||
if (glyf[j].contours.length === glyf[k].contours.length) {
|
if (glyf[j].contours.length === glyf[k].contours.length) {
|
||||||
if (match(glyf[j], glyf[k], j)) {
|
if (match(glyf[j], glyf[k], j)) {
|
||||||
|
@ -79,7 +83,12 @@ function autoref(glyf) {
|
||||||
|
|
||||||
// referencify, backward
|
// referencify, backward
|
||||||
for (var j = 0; j < glyf.length; j++) {
|
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;
|
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--) {
|
for (var k = j - 1; k >= 0; k--) {
|
||||||
if (glyf[j].contours.length > glyf[k].contours.length) continue;
|
if (glyf[j].contours.length > glyf[k].contours.length) continue;
|
||||||
while (match(glyf[j], glyf[k], j)) {
|
while (match(glyf[j], glyf[k], j)) {
|
||||||
|
@ -90,8 +99,10 @@ function autoref(glyf) {
|
||||||
|
|
||||||
// unlink composite
|
// unlink composite
|
||||||
for (var j = 0; j < glyf.length; j++) {
|
for (var j = 0; j < glyf.length; j++) {
|
||||||
if (glyf[j].contours.length === 0 || !glyf[j].references || glyf[j].references.length === 0) continue;
|
if (!glyf[j].references || glyf[j].references.length === 0) continue;
|
||||||
// console.log("Unlink", glyf[j].name);
|
if (glyf[j].contours.length === 0 && !(glyf[j].unicode && glyf[j].unicode[0] < 0x80))
|
||||||
|
continue;
|
||||||
|
|
||||||
var cs = unlinkRef(glyf[j], 0, 0, glyf);
|
var cs = unlinkRef(glyf[j], 0, 0, glyf);
|
||||||
glyf[j].contours = g.contours.concat(cs);
|
glyf[j].contours = g.contours.concat(cs);
|
||||||
glyf[j].references = [];
|
glyf[j].references = [];
|
||||||
|
@ -105,8 +116,8 @@ function supporessNaN(glyf) {
|
||||||
for (var k = 0; k < g.contours.length; k++) {
|
for (var k = 0; k < g.contours.length; k++) {
|
||||||
var contour = g.contours[k];
|
var contour = g.contours[k];
|
||||||
for (let z of contour) {
|
for (let z of contour) {
|
||||||
if (!isFinite(z.x)) z.x = 0
|
if (!isFinite(z.x)) z.x = 0;
|
||||||
if (!isFinite(z.y)) z.y = 0
|
if (!isFinite(z.y)) z.y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue