Balances: /r, /g, superscripts, etc.

This commit is contained in:
be5invis 2015-11-27 04:51:04 +08:00
parent c3b45df019
commit 0a51584579
11 changed files with 48 additions and 42 deletions

View File

@ -46,7 +46,9 @@ define-macro reverse-last : syntax-rules
define-macro eject-contour : syntax-rules
`[eject-contour @::args] {'.syntactic-closure' `[currentGlyph.eject-contour @::args] env}
define-macro tag-contour : syntax-rules
`[tag-contour @name] {'.syntactic-closure' `(currentGlyph.contours.(currentGlyph.contours.length - 1).tag = @name) env}
`[tag-contour @::args] {'.syntactic-closure' `[currentGlyph.tag-contour @::args] env}
define-macro retag-contour : syntax-rules
`[retag-contour @::args] {'.syntactic-closure' `[currentGlyph.retag-contour @::args] env}
define-macro assign-unicode : syntax-rules
`[assign-unicode @code] {".syntactic-closure" `[begin \\
currentGlyph.assign-unicode @code
@ -90,12 +92,9 @@ define [anchorDeriv] : begin
return {.anchors h}
# contour tagging
define [tagged tag fn] : lambda [] : begin
local _tag this.defaultTag
set this.defaultTag tag
fn.apply this arguments
set this.defaultTag _tag
return nothing
define [tagged tag component] : begin
set component.tag tag
return component
export as build : define [buildFont para recursive recursiveCodes] : begin
define variantSelector para.variantSelector
@ -220,7 +219,7 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
define WHITENESS : ((XH - STROKE * 3) * (RIGHTSB - SB) * (1 / 3)) / (XH * (RIGHTSB - SB))
define [adviceBlackness crowdedness] : Math.min STROKE ((RIGHTSB - SB) * (1 - WHITENESS) / (crowdedness * CORRECTION_HX))
define MVERTSTROKE : adviceBlackness : fallback para.lllcrowdedness (3 + 1 / 3)
define OVERLAYSTROKE : adviceBlackness 4
define OVERLAYSTROKE : adviceBlackness 3.75
define OPERATORSTROKE : adviceBlackness 3.2
define SHOULDERFINE : [adviceBlackness 4] / 2

View File

@ -219,12 +219,12 @@ define [suggestName name] : begin
define [createCircledGlyphs records] : if [not recursive] : begin
local dscale 0.55
local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 4 0.65
local miniatureFont : Miniature pendingGlyphs 3.5 0.65
foreach {unicode glyphid w} [items-of records] : create-glyph [suggestName : 'circle' + glyphid] : glyph-construction
local width : fallback w WIDTH
set-width width
local sw [adviceBlackness 6]
local sw [adviceBlackness 5]
if unicode : assign-unicode unicode
include : create-glyph [suggestName : 'circleinner' + glyphid] : glyph-construction
local g miniatureFont.(glyphid)
@ -243,7 +243,7 @@ define [createCircledGlyphs records] : if [not recursive] : begin
define [createSuperscripts records] : if [not recursive] : begin
local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.7
local miniatureFont : Miniature pendingGlyphs 3.5 0.7
foreach {unicode glyphid} [items-of records] : create-glyph [suggestName : 'sup' + glyphid] : glyph-construction
if unicode : assign-unicode unicode
include miniatureFont.(glyphid) AS_BASE
@ -255,7 +255,7 @@ define [createSuperscripts records] : if [not recursive] : begin
define [createSubscripts records] : if [not recursive] : begin
local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.7
local miniatureFont : Miniature pendingGlyphs 3.5 0.7
foreach {unicode glyphid} [items-of records] : create-glyph [suggestName : 'sub' + glyphid] : glyph-construction
if unicode : assign-unicode unicode
include miniatureFont.(glyphid) AS_BASE
@ -487,7 +487,7 @@ createSuperscripts : list
list 0x1D41 'U'
list 0x1D42 'W'
list 0x2C7D 'V'
if [not recursive] : let [df : Miniature {'a' 'o'} 0.7 0.7] : begin
if [not recursive] : let [df : Miniature {'a' 'o'} 3.5 0.7] : begin
create-glyph 'ordfeminine' : glyph-construction
assign-unicode 0xAA
include df.a

View File

@ -569,7 +569,7 @@ define [CyrYaShape top] : glyph-construction
include : dispiro
widths.center
g4.up.start (left + HALFSTROKE) 0 [heading UPWARD]
quadcontrols 0 0.4 8
quadcontrols 0 [if SLAB 0.2 0.4] 8
g4 MIDDLE ((top - STROKE) * m)
if SLAB : begin

View File

@ -117,13 +117,13 @@ create-glyph 'Y' : glyph-construction
define [KShape top] : glyph-construction
local turn (top * 0.99)
local attach (top * 0.375)
local attach2 MIDDLE
local attach (top * [if SLAB 0.325 0.375])
local attach2 [if SLAB [mix SB RIGHTSB 0.48] MIDDLE]
local fine : adviceBlackness 3.5
include : dispiro
g4.down.start (RIGHTSB - [if SLAB (JUT / 4) 0]) top [widths.heading 0 (STROKE * 1.05 * (WIDTH * 2 / UPM)) DOWNWARD]
bezcontrols 0 0.2 0.5 0.65 8
g4.down.start RIGHTSB top [widths.heading 0 (STROKE * [if SLAB 1.15 1.05] * (WIDTH * 2 / UPM)) DOWNWARD]
bezcontrols 0 [if SLAB 0.1 0.2] 0.5 [if SLAB 0.55 0.65] 8
g4 (SB + STROKE) attach [widths 0 fine]
include : dispiro
widths.center
@ -131,7 +131,7 @@ define [KShape top] : glyph-construction
quadcontrols 0 [if SLAB 0.125 0.25] 8
g4 attach2 (top * 0.61) [widths.center fine]
if SLAB : begin
include : RightwardTopSerif (RIGHTSB - JUT / 4) top (SIDEJUT + O)
include : RightwardTopSerif RIGHTSB top (SIDEJUT + O - JUT / 4)
include : RightwardBottomSerif (RIGHTSB - O - JUT / 4) 0 SIDEJUT
create-glyph 'K' : glyph-construction
@ -243,7 +243,7 @@ define [RShape top] : glyph-construction
include : dispiro
widths.center
g4.up.start (right - HALFSTROKE) 0 [heading UPWARD]
quadcontrols 0 0.4 8
quadcontrols 0 [if SLAB 0.2 0.4] 8
g4 MIDDLE ((top - STROKE) * m)
if SLAB : begin
include : RightwardBottomSerif (RIGHTSB - JUT / 4) 0 (SIDEJUT + JUT / 4)
@ -434,6 +434,7 @@ define [TShape top] : glyph-construction
include : DownwardLeftSerif l top VJUT MVERTSTROKE
tag-contour 'serifLT'
include : CenterBottomSerif MIDDLE 0 JUT
tag-contour 'serifRB'
create-glyph 'T' : glyph-construction
set-width WIDTH

View File

@ -91,18 +91,19 @@ create-glyph 'g.doublestorey' : glyph-construction
local obot : XH * GBARPOS - O - HALFSTROKE
include : smallo XH obot SB (RIGHTSB - 0.3 * SB)
local gleftx (SB * 0.8 + OX)
local grightx (RIGHTSB + SB * 0.1 - OX)
local groundy : Math.round : [mix DESCENDER (XH * GBARPOS) 0.625] + HALFSTROKE
local gleftx ([mix 0 SB 0.85] + OX)
local grightx ([mix WIDTH RIGHTSB 0.825] - OX)
local groundy : Math.round : [mix DESCENDER (XH * GBARPOS) 0.63] + HALFSTROKE
local gtipy [mix XH obot 0.975]
include : dispiro
g4 [mix SB RIGHTSB 0.3] [mix XH obot 0.95] [widths 0 (STROKE * 0.7)]
alsothru (-1.2) 0.5 [widths HALFSTROKE HALFSTROKE]
g4.left.start [mix SB RIGHTSB 0.4] gtipy [widths 0 (STROKE * 0.7)]
g4 ([mix SB RIGHTSB 0.0575] + STROKE * 0.85) [mix groundy gtipy 0.5] [widths.rhs (STROKE * 0.85)]
flat [mix SB RIGHTSB 0.435] groundy [widths 0 STROKE]
curl [mix RIGHTSB SB 0.435] groundy
archv 4
g4 grightx [mix (DESCENDER + O) groundy 0.53]
arcvh
g4 [mix gleftx grightx 0.5] (DESCENDER + O)
g4 MIDDLE (DESCENDER + O)
archv
g4 gleftx [mix (DESCENDER + O) groundy 0.53]
arcvh
@ -218,7 +219,7 @@ create-glyph 'a.upright' : glyph-construction
flat (RIGHTSB - STROKE * CORRECTION_HX) (SMALLSMOOTHB * 0.9) [widths 0 SHOULDERFINE]
curl (RIGHTSB - STROKE * CORRECTION_HX) (SMALLSMOOTHB * 0.9 + 1)
if SLAB : begin
include : RightwardBottomSerif RIGHTSB 0 SIDEJUT
include : tagged 'serifRB' : RightwardBottomSerif RIGHTSB 0 SIDEJUT
create-glyph 'a.italic' : glyph-construction
set-width WIDTH
@ -256,8 +257,7 @@ create-glyph 'n' : glyph-construction
: then : include : tagged 'serifRB' : RightwardBottomSerif RIGHTSB 0 SIDEJUT
: else : include : tagged 'serifRB' : CenterBottomSerif (RIGHTSB - HALFSTROKE * CORRECTION_HX) 0 JUT
if (para.italicangle === 0) : begin
include : CenterBottomSerif (SB + HALFSTROKE * CORRECTION_HX) 0 JUT
tag-contour 'serifLB'
include : tagged 'serifLB' : CenterBottomSerif (SB + HALFSTROKE * CORRECTION_HX) 0 JUT
create-glyph 'u' : glyph-construction
set-width WIDTH
@ -267,6 +267,7 @@ create-glyph 'u' : glyph-construction
include glyphs.n
eject-contour 'serifRB'
eject-contour 'serifLB'
retag-contour 'serifLT' 'serifRB'
include : FlipAround MIDDLE (XH / 2)
if SLAB : begin
@ -544,10 +545,8 @@ create-glyph 'r' : glyph-construction
set-anchor 'overlay' BASE rbar (XH * 0.5)
if SLAB : begin
include : CenterBottomSerif (SB + RBALANCE + STROKE * 0.75 * CORRECTION_HX) 0 (JUT + HALFSTROKE / 2)
tag-contour 'serifLB'
include : LeftwardTopSerif (SB + RBALANCE) XH SIDEJUT
tag-contour 'serifLT'
include : tagged 'serifLB' : CenterBottomSerif (SB + RBALANCE + RBALANCE * 1.25) 0 (JUT + RBALANCE * 0.75)
include : tagged 'serifLT' : LeftwardTopSerif (SB + RBALANCE) XH (SIDEJUT + RBALANCE * 0.25)
### f

View File

@ -198,8 +198,7 @@ create-glyph 'rlongleg' : glyph-construction
eject-contour 'serifLB'
include : VBarLeft (SB + RBALANCE) DESCENDER 0
if SLAB : begin
include : CenterBottomSerif (SB + RBALANCE + STROKE * 0.75 * CORRECTION_HX) DESCENDER (JUT + HALFSTROKE / 2)
tag-contour 'serifLB'
include : tagged 'serifLB' : CenterBottomSerif (SB + RBALANCE + RBALANCE * 1.25) DESCENDER (JUT + RBALANCE * 0.75)
create-glyph 'turnmleg' : glyph-construction
assign-unicode 0x270

View File

@ -73,7 +73,7 @@ symbol-block 'Currency'
create-glyph 'frenchFranc' : glyph-construction
assign-unicode 0x20A3
include glyphs.F
include : HOverlayBar [mix SB 0 0.7] [mix SB RIGHTSB 0.5] [mix 0 XH 0.3]
include : HOverlayBar (SB * 0.5) (SB * 3 + STROKE * CORRECTION_HX) [mix 0 XH 0.4]
create-glyph 'peseta' : glyph-construction
assign-unicode 0x20A7

View File

@ -212,7 +212,7 @@ symbol-block 'Typographic Symbols'
set-width WIDTH
assign-unicode '&'
local fine : adviceBlackness 3.5
local fine : adviceBlackness 3
local p 0.85
local l 0.05
local pr 0.85

View File

@ -11,7 +11,7 @@ PREFIX = $(VARIANTNAME)iosevka$(SUFFIX)
ifeq ($(OS),Windows_NT)
SHELL = C:\\Windows\\System32\\cmd.exe
SUPPRESS_ERRORS = 2> NUL
NODE = node --noincremental_marking --max_executable_size=1024
NODE = node --max_executable_size=4096
else
SUPPRESS_ERRORS = 2> /dev/null
NODE = node

View File

@ -141,7 +141,7 @@ rbalance = 60
[x-slab-bold]
style = 'Bold'
sb = 55
rbalance = 80
rbalance = 50
[x-slab-italic]
style = 'Italic'
@ -153,7 +153,7 @@ style = 'Bold Italic'
ebalance = 0.375
sbalance = 0.53
sb = 55
rbalance = 80
rbalance = 50
# Variants
[v-l-hooky.variantSelector]

View File

@ -84,13 +84,21 @@ define [Glyph.prototype.tag-contour tag n] : begin
local lastContour this.contours.(this.contours.length - 1)
if lastContour : if tag : set lastContour.tag tag
return this
define [Glyph.prototype.retag-contour oldtag newtag] : begin
if this.contours : foreach [c : items-of this.contours] : if (c.tag === oldtag) : set c.tag newtag
return this
define [Glyph.prototype.eject-contour tag] : begin
set this.contours : this.contours.filter : lambda [c] (c.tag !== tag)
return this
define [Glyph.prototype.include component copyAnchors] : begin
local glyph : match component
[aFunction it] : return : component.call this
[aFunction it] : begin
local t this.defaultTag
set this.defaultTag component.tag
component.call this
set this.defaultTag t
return this
{:: contours} {.contours contours}
otherwise component
local contours glyph.contours
@ -130,7 +138,7 @@ define [Glyph.prototype.include component copyAnchors] : begin
foreach [contour : items-of contours] : begin
local c {}
foreach [point : items-of contour] : c.push : tp transform point
set c.tag : contour.tag || t.defaultTag
set c.tag : contour.tag || component.tag || t.defaultTag
this.contours.push c
if (([not contours] || copyAnchors) && glyph.anchors) : set this.anchors : let [a {.}] [anchors glyph.anchors] [keys : Object.keys glyph.anchors] : begin
foreach k [items-of keys] [set a.(k) anchors.(k)]