code cleanup

This commit is contained in:
be5invis 2016-06-11 21:10:47 +08:00
parent 3de8056f95
commit fed22dbf58
8 changed files with 26 additions and 69 deletions

View File

@ -430,7 +430,6 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
g.include t AS_BASE
set g.advanceWidth t.advanceWidth
set g.shortName t.shortName
set g.dense t.dense
set g.cmpPriority t.cmpPriority
if name : set dependencyProfile.(name) : getDependencyProfile g
if (g && unicode) : begin

View File

@ -543,7 +543,7 @@ define [CyrDescender x shift connex] : glyph-construction
# Derived subfonts
define [refair g] : begin
foreach [j : range 0 g.contours.length] : begin
set g.contours.(j) : fairify g.contours.(j) globalTransform g.dense
set g.contours.(j) : fairify g.contours.(j) globalTransform
return nothing
define [Fork gs ps] : begin
# BFS construct ShouldBuildList

View File

@ -494,7 +494,6 @@ define VShape : symbol-block 'V, v and nu'
g4 (RIGHTSB - HOOKX / 3) (top - HALFSTROKE - HOOK)
quadcontrols 0.4 0.75 64 unimportant
g4 (MIDDLE + cornerdist) 0 [widths.rhs VShape.fine]
#end [function : set this.dense true]
sketch # vhooktop
include eMarks

View File

@ -207,7 +207,6 @@ symbol-block 'Delta and cyrbe'
curl (SB + OX) (XH - SMALLSMOOTHA)
alsothruthem [list {0.25 0.79} {0.5 0.87}] important
g4 (RIGHTSB - HALFSTROKE * HVCONTRAST) CAP
#end : function : set this.dense true
save 'cyrbe' 0x431
symbol-block 'epsilon and cyrze'

View File

@ -2,29 +2,23 @@
symbol-block "Numbers"
sketch # zero.unslashed
include capitalMarks
set-width WIDTH
include : OShape CAP 0 SB RIGHTSB
save 'zero.unslashed'
sketch # zero.slashed
include capitalMarks
set-width WIDTH
include glyphs.'zero.unslashed'
local fine : 0.5 * OVERLAYSTROKE
include : dispiro
flat (SB + STROKE / 2) (CAP * (1 - 0.77)) [widths fine fine]
curl (RIGHTSB - STROKE / 2) (CAP * 0.77)
save 'zero.slashed'
sketch # zero.dotted
include capitalMarks
set-width WIDTH
include glyphs.'zero.unslashed'
local radius : Math.min DOTRADIUS ((RIGHTSB - SB - STROKE * 2) / 4)
include : Ring (CAPMIDDLE + radius) (CAPMIDDLE - radius) (MIDDLE + radius) (MIDDLE - radius)
save 'zero.dotted'
select-variant 'zero' '0' 'slashed' {
@ -32,27 +26,20 @@ symbol-block "Numbers"
.cv14 'zero.dotted'
.cv15 'zero.unslashed'
}
sketch # one
include capitalMarks
set-width WIDTH
include : VBar (MIDDLE + ONEBALANCE) 0 CAP
include : dispiro
flat (MIDDLE - HALFSTROKE * HVCONTRAST + ONEBALANCE) CAP [widths STROKE 0]
curl (MIDDLE - HOOKX * 1.25 + ONEBALANCE) (CAP - HOOK * 0.75)
if SLAB : begin
include : CenterBottomSerif (MIDDLE + ONEBALANCE) 0 LONGJUT
save 'one' '1'
sketch # two
include capitalMarks
set-width WIDTH
define smooth : [adviceGlottalStopSmooth CAP 1] * 0.95
include : dispiro
widths.rhs
@ -62,22 +49,18 @@ symbol-block "Numbers"
alsothru 0.5 ([linreg 18 0.425 120 0.4 STROKE] * [linreg 500 1 700 0.95 WIDTH]) [widths.center]
flat SB 1 [widths.heading STROKE 0 DOWNWARD]
curl SB 0 [heading DOWNWARD]
include : HBarBottom (SB + HALFSTROKE) RIGHTSB 0
if SLAB : begin
include : UpwardRightSerif RIGHTSB 0 VJUT
save 'two' '2'
sketch # three
include capitalMarks
set-width WIDTH
local barcenter : CAP * 0.53
local threeRadius : (CAPMIDDLE + HALFSTROKE - SMOOTH) * 1.25
local fine : STROKE * CTHIN
include : dispiro
widths.rhs
g4 (SB - O) (CAP - HOOK)
@ -92,18 +75,16 @@ symbol-block "Numbers"
g4 (RIGHTSB - O * 2) (SMOOTHA * barcenter / CAPMIDDLE)
flat (RIGHTSB - threeRadius + 0.01) (barcenter + (fine - HALFSTROKE)) [widths.heading fine 0 LEFTWARD]
curl (RIGHTSB - threeRadius) (barcenter + (fine - HALFSTROKE)) [heading LEFTWARD]
save 'three' '3'
sketch # four
include capitalMarks
set-width WIDTH
local bar (CAP * 0.4)
local vert : [mix SB RIGHTSB 0.825] - HVCONTRAST * STROKE
local p 0.25
local fine (STROKE * 0.9)
include : HBarTop (SB + OX) RIGHTSB bar
include : VBarLeft vert 0 CAP
local slope : (CAP - bar) / (vert - fine * p * HVCONTRAST - (SB + OX))
@ -112,15 +93,15 @@ symbol-block "Numbers"
g4 (vert - fine * p * HVCONTRAST) CAP [widths.heading 0 [Math.hypot fine (fine / slope)] UPWARD]
if SLAB : begin
include : CenterBottomSerif (vert + HALFSTROKE * HVCONTRAST) 0 JUT
save 'four' '4'
define [FiveShape top bp] : glyph-construction
local t1 : top * bp * 0.8
local t2 : top * bp
local ycurly : mix 0 t2 (SMOOTHA / (SMOOTHA + SMOOTHB))
local xleft : mix SB RIGHTSB 0.025
local xright : [mix RIGHTSB SB 0.05] - OXE
include : dispiro
widths.rhs
g4 (xleft - OXHOOK) (t2 - AHOOK * top / CAP)
@ -132,30 +113,25 @@ symbol-block "Numbers"
include : HBarTop xleft xright top
if SLAB : begin
include : DownwardRightSerif xright top VJUT
sketch # five
include capitalMarks
set-width WIDTH
include : FiveShape CAP FIVEBARPOS
save 'five' '5'
sketch # zhuangToneFive
include capitalMarks
include : FiveShape CAP FIVEBARPOS
save 'zhuangToneFive' 0x1BC
sketch # zhuangtonefive
include eMarks
include : FiveShape XH FIVEBARPOS
save 'zhuangtonefive' 0x1BD
sketch # six
include capitalMarks
set-width WIDTH
include : OShape (CAP * 0.6) 0 SB RIGHTSB
local ymiddlea : (CAP * 0.6 - SMALLSMOOTHA + SMALLSMOOTHB) / 2
include : dispiro
@ -164,36 +140,29 @@ symbol-block "Numbers"
quadcontrols 0 0.8
g4 ([mix SB RIGHTSB 0.85] - HALFSTROKE * HVCONTRAST) CAP
save 'six' '6'
sketch # seven
include capitalMarks
set-width WIDTH
include : HBarTop (SB + OXE) RIGHTSB CAP
local x : mix SB RIGHTSB 0.28
local cor : [Math.hypot 1 ((RIGHTSB - x - HALFSTROKE) / (CAP - STROKE))] * HVCONTRAST
start-from (x - STROKE * cor / 2) 0
line-to (x + STROKE * cor / 2) 0
line-to RIGHTSB (CAP - STROKE)
line-to (RIGHTSB - STROKE * cor) (CAP - STROKE)
reverse-last
if SLAB : begin
include : DownwardLeftSerif (SB + OXE) CAP VJUT
save 'seven' '7'
local pr : linreg 18 0.85 120 0.975 STROKE
sketch # eight
include capitalMarks
set-width WIDTH
local p 0.96
local l (SB + OX)
local r (RIGHTSB - OX)
include : dispiro
widths.rhs
g4.right.mid (MIDDLE - CORRECTION_OMIDS) (CAP - O)
@ -209,8 +178,8 @@ symbol-block "Numbers"
g4 [mix r l p] (CAP - SMOOTHA * pr * p) [widths.rhs]
arcvh
close
save 'eight' '8'
# There is an "eight without lower contour" shape used for /propto
sketch # rotetedpropto
local p 0.96
@ -228,7 +197,6 @@ symbol-block "Numbers"
g4 [mix l r p] (CAP - SMOOTHB * p * pr)
alsothru 0.5 py [widths (STROKE * py) (STROKE * (1 - py))]
straight.down.end l 0 [widths.heading STROKE 0 DOWNWARD]
save 'rotetedpropto'
sketch # nine
@ -255,10 +223,8 @@ symbol-block "Numbers"
curl r (CAP * 0.35)
hookend O
g4 SB HOOK
save 'nine' '9'
sketch # ten
include capitalMarks
set-width : WIDTH * 2
@ -267,4 +233,3 @@ symbol-block "Numbers"
include glyphs.zero
apply-transform : Translate WIDTH 0
save 'ten'

View File

@ -207,15 +207,12 @@ define {TildeShape} : symbol-block 'Above marks'
set-width 0
currentGlyph.shortName = 'tilde'
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
include : TildeShape
ttop -- aboveMarkTop
tbot -- aboveMarkBot + markFine / 2
leftEnd -- (markMiddle - markExtend * 1.5)
rightEnd -- (markMiddle + markExtend * 1.5)
hs -- markHalfStroke
set currentGlyph.dense true
save 'tildeAbove' 0x303
sketch # asciitilde.high
@ -225,8 +222,6 @@ define {TildeShape} : symbol-block 'Above marks'
leftEnd -- SB
rightEnd -- RIGHTSB
hs -- (OPERATORSTROKE / 2)
set currentGlyph.dense true
save 'asciitilde.high'
sketch
@ -1231,7 +1226,6 @@ symbol-block 'Tie marks'
rightEnd -- tieRight
hs -- markHalfStroke
set currentGlyph.dense true
save 'tildeTieAbove' 0x360
symbol-block 'Greek Polytonic Marks'

View File

@ -296,6 +296,7 @@ function fairify(scurve, gizmo, denseQ, cleanMore) {
}
}
};
// Rebuild curve
for (var j = 0; j < splitpoints.length; j++) if (splitpoints[j].onCurve && !splitpoints[j].remove && splitpoints[j + 1] && !splitpoints[j + 1].onCurve) {
for (var k = j + 2; k < splitpoints.length && splitpoints[k].remove; k++);
if (k - j > 2) {

View File

@ -166,7 +166,7 @@ export : define [SetupBuilders args] : begin
lhs.0.type = rhs.0.type = lhs.(lhs.length - 1).type = rhs.(rhs.length - 1).type = 'corner'
libspiro.spiroToBezierOnContext [lhs.concat : rhs.reverse] true g QUAD PRECISION
if ([not s.unfair] && [not para.unfair]) : foreach [j : range 0 g.contours.length] : begin
set g.contours.(j) : fairify g.contours.(j) globalTransform s.dense s.cleanmore
set g.contours.(j) : fairify g.contours.(j) globalTransform
set g.knots knots
set g.lhsknots lhs
set g.rhsknots rhs
@ -178,7 +178,7 @@ export : define [SetupBuilders args] : begin
libspiro.spiroToBezierOnContext knots closed g QUAD PRECISION
foreach af [items-of lastafs] : if af : af.call g
if [not para.unfair] : foreach [j : range 0 g.contours.length] : begin
set g.contours.(j) : fairify g.contours.(j) (g.fairGizmo || g.gizmo) g.dense g.cleanmore
set g.contours.(j) : fairify g.contours.(j) (g.fairGizmo || g.gizmo)
this.include g
return [object