Balanced a lot of glyphs, especially o-shaped. Also reduced file size massively.

This commit is contained in:
be5invis 2015-08-12 02:45:17 +08:00
parent f64a11c4e3
commit af9ba2e094
15 changed files with 125 additions and 213 deletions

View file

@ -98,6 +98,9 @@ define [buildFont para recursive] : begin {
define SMALLSMOOTHB : SMALLSMOOTH + globalTransform.yx * para.smoothadjust define SMALLSMOOTHB : SMALLSMOOTH + globalTransform.yx * para.smoothadjust
define ITALICCORS : STROKE * globalTransform.yx define ITALICCORS : STROKE * globalTransform.yx
define OMIDCOR : globalTransform.yx * 1.2
define OMIDCOR_S : STROKE * OMIDCOR
# style parameters # style parameters
define EBARPOS : para.ebarpos || BARPOS define EBARPOS : para.ebarpos || BARPOS
define KAPPA para.kappa define KAPPA para.kappa

View file

@ -20,19 +20,17 @@ define [Ring u d l r transformShiftOnly] : begin {
return s.points return s.points
} }
define [RingAt x y r] : Ring [y + r] [y - r] [x - r] [x + r] define [RingAt x y r] : Ring [y + r] [y - r] [x - r] [x + r]
define [ORing u d l r smooth] : begin { define [ORing u d l r sma smb shift] : begin {
local myu [u - smooth]
local myd [d + smooth]
local mx [[l + r] / 2] local mx [[l + r] / 2]
local s : new Stroke local s : new Stroke
:.set-transform globalTransform :.set-transform globalTransform
:.start-from mx d :.start-from [mx + shift] d
:.cubic-to [mx + [l - mx] * CKAPPA] d l [myd + [d - myd] * CKAPPA] l myd :.arc-hv-to l [d + smb]
:.line-to l myu :.line-to l [u - sma]
:.cubic-to l [myu + [u - myu] * CKAPPA] [mx + [l - mx] * CKAPPA] u mx u :.arc-vh-to [mx - shift] u
:.cubic-to [mx + [r - mx] * CKAPPA] u r [myu + [u - myu] * CKAPPA] r myu :.arc-hv-to r [u - smb]
:.line-to r myd :.line-to r [d + sma]
:.cubic-to r [myd + [d - myd] * CKAPPA] [mx + [r - mx] * CKAPPA] d mx d :.arc-vh-to [mx + shift] d
return s.points return s.points
} }
define [leftwardTopSerif x y length] : begin { define [leftwardTopSerif x y length] : begin {
@ -152,30 +150,29 @@ define [xStrand _leftx lefty _rightx righty turn straight tension] : begin {
:.concat : halfXStrand _rightx righty middlex middley turn straight tension :.concat : halfXStrand _rightx righty middlex middley turn straight tension
} }
define [nBowl left middle right fine _top _bottom _sma _smb] : begin { define [nShoulder left middle right fine _top _bottom _sma _smb] : begin {
local top : fallback _top XH local top : fallback _top XH
local bottom : fallback _bottom 0 local bottom : fallback _bottom 0
local sma : fallback _sma SMALLSMOOTHA local sma : fallback _sma SMALLSMOOTHA
local smb : fallback _smb SMALLSMOOTHB local smb : fallback _smb SMALLSMOOTHB
local bandLeft : new Stroke local band : new Stroke
:.set-transform globalTransform :.set-transform globalTransform
:.start-from right bottom :.start-from right bottom
:.heads-to UPWARD :.heads-to UPWARD
:.set-width STROKE 0 :.set-width STROKE 0
:.line-to right [top - smb] :.line-to right [top - smb]
:.arc-vh-to middle [top - O] :.arc-vh-to middle [top - O]
:.heads-to LEFTWARD :.heads-to LEFTWARD
:.set-samples 12
:.to-outline :.to-outline
local bandRight : new Stroke local shoulder : new Stroke
:.set-transform globalTransform :.set-transform globalTransform
:.start-from middle [top - O - STROKE] :.start-from middle [top - O - STROKE]
:.set-width 0 STROKE :.arc-hv-to left [top - sma]
:.heads-to LEFTWARD :.line-to [left - fine] [top - sma]
:.arc-hv-to left [top - sma] :.arc-vh-to middle [top - O]
:.heads-to DOWNWARD
:.set-width 0 fine return : band.concat (shoulder.points)
:.to-outline
return : bandLeft.concat bandRight
} }
define [XSHookUpper top left middle right smooth hook] : glyph-construction { define [XSHookUpper top left middle right smooth hook] : glyph-construction {
@ -183,8 +180,7 @@ define [XSHookUpper top left middle right smooth hook] : glyph-construction {
:.set-transform globalTransform :.set-transform globalTransform
:.start-from [right - OXHOOK] [top - hook] :.start-from [right - OXHOOK] [top - hook]
:.set-width STROKE 0 :.set-width STROKE 0
:.curve-to [mix middle right KAPPA_HOOK] [top - O] middle [top - O] :.curve-to [mix middle right KAPPA_HOOK] [top - O] [middle - OMIDCOR_S] [top - O]
:.heads-to [if [left < right] LEFTWARD RIGHTWARD]
:.arc-hv-to left [top - smooth] :.arc-hv-to left [top - smooth]
} }
define [sHookUpper top smooth hook _middle] : glyph-construction { define [sHookUpper top smooth hook _middle] : glyph-construction {
@ -196,8 +192,7 @@ define [twoHookUpper top smooth hook _middle] : glyph-construction {
:.set-transform globalTransform :.set-transform globalTransform
:.start-from [SB + OXHOOK] [top - hook] :.start-from [SB + OXHOOK] [top - hook]
:.set-width 0 STROKE :.set-width 0 STROKE
:.curve-to [mix middle SB KAPPA_HOOK] [top - O] middle [top - O] :.curve-to [mix middle SB KAPPA_HOOK] [top - O] [middle - OMIDCOR_S] [top - O]
:.heads-to RIGHTWARD
:.arc-hv-to RIGHTSB [top - smooth] :.arc-hv-to RIGHTSB [top - smooth]
} }
define [sHookLower bottom smooth hook _middle] : glyph-construction { define [sHookLower bottom smooth hook _middle] : glyph-construction {
@ -208,8 +203,7 @@ define [XSHookLower bottom left middle right smooth hook] : glyph-construction {
:.set-transform globalTransform :.set-transform globalTransform
:.start-from right [bottom + smooth] :.start-from right [bottom + smooth]
:.set-width [if [left < right] 0 STROKE] [if [left < right] STROKE 0] :.set-width [if [left < right] 0 STROKE] [if [left < right] STROKE 0]
:.arc-vh-to middle [bottom + O] :.arc-vh-to [middle + OMIDCOR_S] [bottom + O]
:.heads-to [if [left < right] LEFTWARD RIGHTWARD]
:.curve-to [mix middle left KAPPA_HOOK] [bottom + O] [left + OXHOOK] [bottom + hook] :.curve-to [mix middle left KAPPA_HOOK] [bottom + O] [left + OXHOOK] [bottom + hook]
} }
@ -218,36 +212,31 @@ define [smallo u d l r _width _sma _smb] : glyph-construction {
local width : fallback _width STROKE local width : fallback _width STROKE
local sma : fallback _sma SMALLSMOOTHA local sma : fallback _sma SMALLSMOOTHA
local smb : fallback _smb SMALLSMOOTHB local smb : fallback _smb SMALLSMOOTHB
local mc : OMIDCOR * width
if [u - d > sma + smb] { if [u - d > sma + smb] {
then : begin { then : begin {
include : create-stroke include : create-stroke
:.set-transform globalTransform :.set-transform globalTransform
:.start-from middle [u - O] :.start-from [middle - mc] [u - O]
:.set-width width 0 :.set-width width 0
:.heads-to LEFTWARD
:.arc-hv-to [l + O] [u - sma] :.arc-hv-to [l + O] [u - sma]
:.line-to [l + O] [d + smb] :.line-to [l + O] [d + smb]
:.arc-vh-to middle [d + O] :.arc-vh-to [middle + mc] [d + O]
:.heads-to RIGHTWARD
:.arc-hv-to [r - O] [d + sma] :.arc-hv-to [r - O] [d + sma]
:.line-to [r - O] [u - smb] :.line-to [r - O] [u - smb]
:.arc-vh-to middle [u - O] :.arc-vh-to [middle - mc] [u - O]
:.heads-to LEFTWARD
} }
else : begin { else : begin {
local ymiddlea : mix d u [smb / [sma + smb]] local ymiddlea : mix d u [smb / [sma + smb]]
local ymiddleb : mix d u [sma / [sma + smb]] local ymiddleb : mix d u [sma / [sma + smb]]
include : create-stroke include : create-stroke
:.set-transform globalTransform :.set-transform globalTransform
:.start-from middle [u - O] :.start-from [middle - mc] [u - O]
:.set-width width 0 :.set-width width 0
:.heads-to LEFTWARD
:.arc-hv-to [l + O] ymiddlea :.arc-hv-to [l + O] ymiddlea
:.arc-vh-to middle [d + O] :.arc-vh-to [middle + mc] [d + O]
:.heads-to RIGHTWARD
:.arc-hv-to [r - O] ymiddleb :.arc-hv-to [r - O] ymiddleb
:.arc-vh-to middle [u - O] :.arc-vh-to [middle - mc] [u - O]
:.heads-to LEFTWARD
} }
} }
} }

View file

@ -139,12 +139,10 @@ create-glyph 'cyrve.italic' : glyph-construction {
:.set-width STROKE 0 :.set-width STROKE 0
:.line-to MIDDLE [XH / 2 - HALFSTROKE] :.line-to MIDDLE [XH / 2 - HALFSTROKE]
:.arc-hv-to [RIGHTSB + O] [XH - SMOOTHB * 0.87] KAPPA :.arc-hv-to [RIGHTSB + O] [XH - SMOOTHB * 0.87] KAPPA
:.arc-vh-to MIDDLE XO :.arc-vh-to [MIDDLE - OMIDCOR_S] XO
:.heads-to LEFTWARD
:.arc-hv-to [SB + O] [XH - SMALLSMOOTHA] :.arc-hv-to [SB + O] [XH - SMALLSMOOTHA]
:.line-to [SB + O] SMALLSMOOTHB :.line-to [SB + O] SMALLSMOOTHB
:.arc-vh-to MIDDLE O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.heads-to RIGHTWARD
:.arc-hv-to [RIGHTSB - O] [SMOOTHA * 0.87] :.arc-hv-to [RIGHTSB - O] [SMOOTHA * 0.87]
:.arc-vh-to MIDDLE [XH / 2 + HALFSTROKE] KAPPA :.arc-vh-to MIDDLE [XH / 2 + HALFSTROKE] KAPPA
:.line-to mid [XH / 2 + HALFSTROKE] :.line-to mid [XH / 2 + HALFSTROKE]

View file

@ -68,7 +68,7 @@ create-glyph 'cyrTshe' : glyph-construction {
local left : mix SB RIGHTSB 0.15 local left : mix SB RIGHTSB 0.15
include : nBowl [left + STROKE * ITALICCOR] [mix left RIGHTSB 0.5] RIGHTSB [STROKE * 0.4] include : nShoulder [left + STROKE * ITALICCOR] [mix left RIGHTSB 0.5] RIGHTSB [STROKE * 0.4]
include : VBarLeft left 0 CAP include : VBarLeft left 0 CAP
include : HBarTop SB [mix left RIGHTSB 0.5] CAP include : HBarTop SB [mix left RIGHTSB 0.5] CAP
} }
@ -80,7 +80,7 @@ create-glyph 'cyrDje' : glyph-construction {
local left : mix SB RIGHTSB 0.15 local left : mix SB RIGHTSB 0.15
include : nBowl [left + STROKE * ITALICCOR] [mix left RIGHTSB 0.5] RIGHTSB [STROKE * 0.4] XH [HOOK + HALFSTROKE + O] SMOOTHA SMOOTHB include : nShoulder [left + STROKE * ITALICCOR] [mix left RIGHTSB 0.5] RIGHTSB [STROKE * 0.4] XH [HOOK + HALFSTROKE + O] SMOOTHA SMOOTHB
include : VBarLeft left 0 CAP include : VBarLeft left 0 CAP
include : HBarTop SB [mix left RIGHTSB 0.5] CAP include : HBarTop SB [mix left RIGHTSB 0.5] CAP
include : VerticalHook [RIGHTSB - HALFSTROKE * ITALICCOR] [HOOK + HALFSTROKE + O] [Math.max [[left - RIGHTSB] / 2 + HALFSTROKE] [-HOOK * 1.2]] HOOK include : VerticalHook [RIGHTSB - HALFSTROKE * ITALICCOR] [HOOK + HALFSTROKE + O] [Math.max [[left - RIGHTSB] / 2 + HALFSTROKE] [-HOOK * 1.2]] HOOK

View file

@ -147,13 +147,12 @@ create-glyph 'Omega' : glyph-construction {
:.start-from [mix SB RIGHTSB 0.4] STROKE :.start-from [mix SB RIGHTSB 0.4] STROKE
:.set-width fine 0 :.set-width fine 0
:.heads-to LEFTWARD :.heads-to LEFTWARD
:.arc-hv-to [SB + STROKE * ITALICCOR] SMALLSMOOTHB :.arc-hv-to [SB + STROKE * ITALICCOR] [SMALLSMOOTHB - ITALICCORS]
:.set-width STROKE 0 :.set-width STROKE 0
:.line-to [SB + STROKE * ITALICCOR] [CAP - SMOOTHA] :.line-to [SB + STROKE * ITALICCOR] [CAP - SMOOTHA - ITALICCORS]
:.arc-vh-to MIDDLE [CAP - STROKE] :.arc-vh-to [MIDDLE - OMIDCOR_S + ITALICCORS][CAP - STROKE]
:.heads-to RIGHTWARD :.arc-hv-to [RIGHTSB - STROKE * ITALICCOR] [CAP - SMOOTHB + ITALICCORS]
:.arc-hv-to [RIGHTSB - STROKE * ITALICCOR] [CAP - SMOOTHB] :.line-to [RIGHTSB - STROKE * ITALICCOR] [SMALLSMOOTHA + ITALICCORS]
:.line-to [RIGHTSB - STROKE * ITALICCOR] SMALLSMOOTHA
:.arc-vh-to [mix RIGHTSB SB 0.4] STROKE :.arc-vh-to [mix RIGHTSB SB 0.4] STROKE
:.set-width fine 0 :.set-width fine 0
:.heads-to LEFTWARD :.heads-to LEFTWARD
@ -206,7 +205,7 @@ create-glyph 'eta' : glyph-construction {
include pMarks include pMarks
set-anchor 'lf' BASE [SB + HALFSTROKE] 0 set-anchor 'lf' BASE [SB + HALFSTROKE] 0
include : nBowl [SB + STROKE] MIDDLE RIGHTSB [STROKE * 0.3] XH DESCENDER SMALLSMOOTHA SMALLSMOOTHB include : nShoulder [SB + STROKE] MIDDLE RIGHTSB [STROKE * 0.3] XH DESCENDER SMALLSMOOTHA SMALLSMOOTHB
include : VBar [SB + HALFSTROKE * ITALICCOR] 0 XH include : VBar [SB + HALFSTROKE * ITALICCOR] 0 XH
} }
create-glyph 'kappa' : glyph-construction { create-glyph 'kappa' : glyph-construction {
@ -433,8 +432,7 @@ create-glyph 'upsilon' : glyph-construction {
:.heads-to DOWNWARD :.heads-to DOWNWARD
:.set-width STROKE 0 :.set-width STROKE 0
:.line-to SB SMALLSMOOTHB :.line-to SB SMALLSMOOTHB
:.arc-vh-to MIDDLE O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.heads-to RIGHTWARD
:.arc-hv-to RIGHTSB SMALLSMOOTHA :.arc-hv-to RIGHTSB SMALLSMOOTHA
:.line-to RIGHTSB XH :.line-to RIGHTSB XH
:.heads-to UPWARD :.heads-to UPWARD
@ -532,7 +530,7 @@ create-glyph 'phi' : glyph-construction {
:.arc-vh-to [mix [WIDTH - x1] [MIDDLE + fine / 2] 0.5] [XH - fine - O] :.arc-vh-to [mix [WIDTH - x1] [MIDDLE + fine / 2] 0.5] [XH - fine - O]
:.arc-hv-to [MIDDLE + fine / 2] y3 :.arc-hv-to [MIDDLE + fine / 2] y3
:.line-to [MIDDLE + fine / 2] 0 :.line-to [MIDDLE + fine / 2] 0
include : VBar MIDDLE DESCENDER 0 include : VBar MIDDLE DESCENDER [fine * 0.2]
} }
create-glyph 'psi' : glyph-construction { create-glyph 'psi' : glyph-construction {

View file

@ -307,12 +307,10 @@ create-glyph 'C' : glyph-construction {
include : create-stroke include : create-stroke
:.start-from [RIGHTSB - OXHOOK] [CAP - HOOK] :.start-from [RIGHTSB - OXHOOK] [CAP - HOOK]
:.set-width STROKE 0 :.set-width STROKE 0
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO MIDDLE CAPO :.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO [MIDDLE - OMIDCOR_S] CAPO
:.heads-to LEFTWARD
:.arc-hv-to SB [CAP - SMOOTHA] :.arc-hv-to SB [CAP - SMOOTHA]
:.line-to SB SMOOTHB :.line-to SB SMOOTHB
:.arc-vh-to MIDDLE O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.heads-to RIGHTWARD
:.curve-to [MIDDLE + ITALICCORS + KAPPA_HOOK * [MIDDLE - SB]] O [RIGHTSB - OXHOOK] HOOK :.curve-to [MIDDLE + ITALICCORS + KAPPA_HOOK * [MIDDLE - SB]] O [RIGHTSB - OXHOOK] HOOK
} }
@ -324,12 +322,10 @@ create-glyph 'G' : glyph-construction {
include : create-stroke include : create-stroke
:.start-from [RIGHTSB - OXHOOK] [CAP - HOOK] :.start-from [RIGHTSB - OXHOOK] [CAP - HOOK]
:.set-width STROKE 0 :.set-width STROKE 0
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO MIDDLE CAPO :.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO [MIDDLE - OMIDCOR_S] CAPO
:.heads-to LEFTWARD
:.arc-hv-to SB [CAP - SMOOTHA] :.arc-hv-to SB [CAP - SMOOTHA]
:.line-to SB SMOOTHB :.line-to SB SMOOTHB
:.arc-vh-to MIDDLE O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.heads-to RIGHTWARD
:.arc-hv-to RIGHTSB SMOOTHA :.arc-hv-to RIGHTSB SMOOTHA
:.line-to RIGHTSB [CAP / 2 + STROKE / 2] :.line-to RIGHTSB [CAP / 2 + STROKE / 2]
:.heads-to UPWARD :.heads-to UPWARD
@ -347,17 +343,14 @@ create-glyph 'O' : glyph-construction {
include capitalMarks include capitalMarks
include : create-stroke include : create-stroke
:.start-from MIDDLE CAPO :.start-from [MIDDLE - OMIDCOR_S] CAPO
:.heads-to LEFTWARD
:.set-width STROKE 0 :.set-width STROKE 0
:.arc-hv-to SB [CAP - SMOOTHA] :.arc-hv-to SB [CAP - SMOOTHA]
:.line-to SB SMOOTHB :.line-to SB SMOOTHB
:.arc-vh-to MIDDLE O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.heads-to RIGHTWARD
:.arc-hv-to RIGHTSB SMOOTHA :.arc-hv-to RIGHTSB SMOOTHA
:.line-to RIGHTSB [CAP - SMOOTHB] :.line-to RIGHTSB [CAP - SMOOTHB]
:.arc-vh-to MIDDLE CAPO :.arc-vh-to [MIDDLE - OMIDCOR_S] CAPO
:.heads-to LEFTWARD
} }
create-glyph 'Q' : glyph-construction { create-glyph 'Q' : glyph-construction {
@ -379,8 +372,7 @@ define [UShape top bottom stroke] : glyph-construction {
:.heads-to DOWNWARD :.heads-to DOWNWARD
:.set-width [fallback stroke STROKE] 0 :.set-width [fallback stroke STROKE] 0
:.line-to SB [bottom + SMOOTHB] :.line-to SB [bottom + SMOOTHB]
:.arc-vh-to MIDDLE [bottom + O] :.arc-vh-to [MIDDLE + OMIDCOR_S] [bottom + O]
:.heads-to RIGHTWARD
:.arc-hv-to RIGHTSB [bottom + SMOOTHA] :.arc-hv-to RIGHTSB [bottom + SMOOTHA]
:.line-to RIGHTSB top :.line-to RIGHTSB top
:.heads-to UPWARD :.heads-to UPWARD

View file

@ -6,64 +6,18 @@ create-glyph 'o' : glyph-construction {
assign-unicode 'o' assign-unicode 'o'
include eMarks include eMarks
include : create-stroke include : smallo XH 0 SB RIGHTSB
:.start-from MIDDLE XO
:.set-width STROKE 0
:.heads-to LEFTWARD
:.arc-hv-to [SB + O] [XH - SMALLSMOOTHA]
:.line-to [SB + O] SMALLSMOOTHB
:.arc-vh-to MIDDLE O
:.heads-to RIGHTWARD
:.arc-hv-to [RIGHTSB - O] SMALLSMOOTHA
:.line-to [RIGHTSB - O] [XH - SMALLSMOOTHB]
:.arc-vh-to MIDDLE XO
:.heads-to LEFTWARD
} }
define [oLeft] : glyph-construction { define [oLeft] : glyph-construction {
# right half include : list {
include : create-stroke ORing XO O [SB + HALFSTROKE] [RIGHTSB - O] SMALLSMOOTHA SMALLSMOOTHB 0
:.start-from MIDDLE XO ORing [XO - STROKE] [O + STROKE] [SB + STROKE * ITALICCOR] [RIGHTSB - STROKE * ITALICCOR - O] [SMALLSMOOTHA - STROKE] [SMALLSMOOTHB - STROKE] 0
:.heads-to RIGHTWARD }
:.set-width 0 STROKE reverse-last
:.arc-hv-to [RIGHTSB - O] [XH - SMALLSMOOTHB]
:.line-to [RIGHTSB - O] SMALLSMOOTHA
:.arc-vh-to MIDDLE O
:.heads-to LEFTWARD
# left half
include : create-stroke
:.start-from MIDDLE [O + STROKE]
:.heads-to LEFTWARD
:.set-width STROKE 0
:.arc-hv-to [SB + STROKE * ITALICCOR] [SMALLSMOOTHB - STROKE * 0.05]
:.set-width [STROKE * 0.25] 0
:.line-to [SB + STROKE * ITALICCOR] [XH - SMALLSMOOTHA + STROKE * 0.05]
:.set-width [STROKE * 0.25] 0
:.arc-vh-to MIDDLE [XO - STROKE]
:.set-width STROKE 0
:.heads-to RIGHTWARD
} }
define [oRight] : glyph-construction { define [oRight] : glyph-construction {
# left half include : create-glyph [oLeft]
include : create-stroke include : FlipAround MIDDLE [XH / 2]
:.start-from MIDDLE XO
:.heads-to LEFTWARD
:.set-width STROKE 0
:.arc-hv-to [SB + O] [XH - SMALLSMOOTHA]
:.line-to [SB + O] SMALLSMOOTHB
:.arc-vh-to MIDDLE O
:.heads-to RIGHTWARD
# right half
include : create-stroke
:.start-from MIDDLE [O + STROKE]
:.heads-to RIGHTWARD
:.set-width 0 STROKE
:.arc-hv-to [RIGHTSB - STROKE * ITALICCOR] [SMALLSMOOTHA - STROKE * 0.05]
:.set-width 0 [STROKE * 0.25]
:.line-to [RIGHTSB - STROKE * ITALICCOR] [XH - SMALLSMOOTHB + STROKE * 0.05]
:.set-width 0 [STROKE * 0.25]
:.arc-vh-to MIDDLE [XO - STROKE]
:.set-width 0 STROKE
:.heads-to LEFTWARD
} }
create-glyph 'p' : glyph-construction { create-glyph 'p' : glyph-construction {
set-width WIDTH set-width WIDTH
@ -156,18 +110,16 @@ create-glyph 'c' : glyph-construction {
include : create-stroke include : create-stroke
:.start-from [RIGHTSB - OXHOOK] [XH - HOOK] :.start-from [RIGHTSB - OXHOOK] [XH - HOOK]
:.set-width STROKE 0 :.set-width STROKE 0
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] XO MIDDLE XO :.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] XO [MIDDLE - OMIDCOR_S] XO
:.heads-to LEFTWARD
:.arc-hv-to [SB + O] [XH - SMALLSMOOTHA] :.arc-hv-to [SB + O] [XH - SMALLSMOOTHA]
:.line-to [SB + O] SMALLSMOOTHB :.line-to [SB + O] SMALLSMOOTHB
:.arc-vh-to MIDDLE O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.heads-to RIGHTWARD
:.curve-to [MIDDLE + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [MIDDLE - SB]] O [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx] [HOOK - TAILADJY * globalTransform.yx] :.curve-to [MIDDLE + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [MIDDLE - SB]] O [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx] [HOOK - TAILADJY * globalTransform.yx]
} }
define [SmallEShape top stroke barpos] : glyph-construction { define [SmallEShape top stroke barpos] : glyph-construction {
local barbottom [top * [fallback barpos EBARPOS]] local barbottom [top * [fallback barpos EBARPOS]]
local hookx [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx] local hookx [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx]
local hookmiddle [mix [SB + O] hookx 0.55] local hookmiddle : [mix [SB + O] hookx 0.55] + OMIDCOR_S
include : create-stroke include : create-stroke
:.start-from [RIGHTSB - O] barbottom :.start-from [RIGHTSB - O] barbottom
@ -175,11 +127,9 @@ define [SmallEShape top stroke barpos] : glyph-construction {
:.set-width stroke 0 :.set-width stroke 0
:.line-to [RIGHTSB - O] [top - SMALLSMOOTHB] :.line-to [RIGHTSB - O] [top - SMALLSMOOTHB]
:.arc-vh-to MIDDLE [top - O] :.arc-vh-to MIDDLE [top - O]
:.heads-to LEFTWARD
:.arc-hv-to [SB + O] [top - SMALLSMOOTHA] :.arc-hv-to [SB + O] [top - SMALLSMOOTHA]
:.line-to [SB + O] SMALLSMOOTHB :.line-to [SB + O] SMALLSMOOTHB
:.arc-vh-to hookmiddle O :.arc-vh-to hookmiddle O
:.heads-to RIGHTWARD
:.curve-to [mix hookmiddle hookx KAPPA_HOOK] O hookx [SHOOK - TAILADJY * globalTransform.yx] :.curve-to [mix hookmiddle hookx KAPPA_HOOK] O hookx [SHOOK - TAILADJY * globalTransform.yx]
include : create-stroke include : create-stroke
:.start-from [SB + [stroke / 2]] barbottom :.start-from [SB + [stroke / 2]] barbottom
@ -204,12 +154,10 @@ create-glyph 'e.italic' : glyph-construction {
:.start-from [SB + O + STROKE] barbottom :.start-from [SB + O + STROKE] barbottom
:.set-width STROKE 0 :.set-width STROKE 0
:.arc-hv-to [RIGHTSB - O] [XH - SMALLSMOOTHB * 0.95] :.arc-hv-to [RIGHTSB - O] [XH - SMALLSMOOTHB * 0.95]
:.arc-vh-to MIDDLE XO :.arc-vh-to [MIDDLE - OMIDCOR_S] XO
:.heads-to LEFTWARD
:.arc-hv-to [SB + O] [XH - SMALLSMOOTHA] :.arc-hv-to [SB + O] [XH - SMALLSMOOTHA]
:.line-to [SB + O] SMALLSMOOTHB :.line-to [SB + O] SMALLSMOOTHB
:.arc-vh-to MIDDLE O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.heads-to RIGHTWARD
:.curve-to [MIDDLE + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [MIDDLE - SB]] O [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx] [HOOK - TAILADJY * globalTransform.yx] :.curve-to [MIDDLE + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [MIDDLE - SB]] O [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx] [HOOK - TAILADJY * globalTransform.yx]
:.set-samples 4 :.set-samples 4
} }
@ -264,19 +212,17 @@ create-glyph 'a.upright' : glyph-construction {
:.heads-to UPWARD :.heads-to UPWARD
:.set-width STROKE 0 :.set-width STROKE 0
:.line-to RIGHTSB [XH - SMOOTHA] :.line-to RIGHTSB [XH - SMOOTHA]
:.arc-vh-to MIDDLE XO :.arc-vh-to [MIDDLE - OMIDCOR_S] XO
:.heads-to LEFTWARD
:.curve-to [MIDDLE - KAPPA_HOOK * [MIDDLE - SB]] XO [SB + OXHOOK] [XH - AHOOK] :.curve-to [MIDDLE - KAPPA_HOOK * [MIDDLE - SB]] XO [SB + OXHOOK] [XH - AHOOK]
include : create-stroke include : create-stroke
:.start-from lowmiddle O :.start-from [lowmiddle + OMIDCOR_S] O
:.set-width 0 STROKE :.set-width 0 STROKE
:.heads-to LEFTWARD
:.arc-hv-to [SB + O] [bartop * 0.45] :.arc-hv-to [SB + O] [bartop * 0.45]
:.arc-vh-to barsmooth bartop :.arc-vh-to barsmooth bartop
:.line-to RIGHTSB bartop :.line-to RIGHTSB bartop
:.heads-to RIGHTWARD :.heads-to RIGHTWARD
include : create-stroke include : create-stroke
:.start-from lowmiddle [O + STROKE] :.start-from [lowmiddle + OMIDCOR_S - ITALICCORS] [O + STROKE]
:.set-width 0 STROKE :.set-width 0 STROKE
:.heads-to RIGHTWARD :.heads-to RIGHTWARD
:.arc-hv-to [RIGHTSB - STROKE] [SMALLSMOOTHB * 0.65] :.arc-hv-to [RIGHTSB - STROKE] [SMALLSMOOTHB * 0.65]
@ -306,40 +252,14 @@ create-glyph 'a' : glyph-construction {
else : include glyphs.'a.upright' AS_BASE else : include glyphs.'a.upright' AS_BASE
} }
} }
create-glyph 'u' : glyph-construction {
set-width WIDTH
assign-unicode 'u'
include eMarks
set-anchor 'trailing' BASE [RIGHTSB - markHalfStroke] 0
include : create-stroke
:.start-from SB XH
:.heads-to DOWNWARD
:.set-width STROKE 0
:.line-to SB SMALLSMOOTHA
:.arc-vh-to MIDDLE O
:.heads-to RIGHTWARD
include : create-stroke
:.start-from MIDDLE [O + STROKE]
:.set-width 0 STROKE
:.heads-to RIGHTWARD
:.arc-hv-to [RIGHTSB - STROKE * ITALICCOR] SMALLSMOOTHA
:.heads-to UPWARD
:.set-width 0 [STROKE * 0.4]
include : create-stroke
:.start-from RIGHTSB 0
:.heads-to UPWARD
:.set-width STROKE 0
:.line-to RIGHTSB XH
:.heads-to UPWARD
}
### n h m ### n u h m
create-glyph 'n' : glyph-construction { create-glyph 'n' : glyph-construction {
set-width WIDTH set-width WIDTH
assign-unicode 'n' assign-unicode 'n'
include eMarks include eMarks
include : nBowl [SB + STROKE * ITALICCOR] MIDDLE RIGHTSB [STROKE * 0.4] include : nShoulder [SB + STROKE * ITALICCOR] MIDDLE RIGHTSB [STROKE * 0.4]
include : create-stroke include : create-stroke
:.start-from SB 0 :.start-from SB 0
:.heads-to UPWARD :.heads-to UPWARD
@ -347,12 +267,20 @@ create-glyph 'n' : glyph-construction {
:.line-to SB XH :.line-to SB XH
:.heads-to UPWARD :.heads-to UPWARD
} }
create-glyph 'u' : glyph-construction {
set-width WIDTH
assign-unicode 'u'
include eMarks
set-anchor 'trailing' BASE [RIGHTSB - markHalfStroke] 0
include glyphs.n
include : FlipAround MIDDLE [XH / 2]
}
create-glyph 'h' : glyph-construction { create-glyph 'h' : glyph-construction {
set-width WIDTH set-width WIDTH
assign-unicode 'h' assign-unicode 'h'
include bMarks include bMarks
include : nBowl [SB + STROKE * ITALICCOR] MIDDLE RIGHTSB [STROKE * 0.4] include : nShoulder [SB + STROKE * ITALICCOR] MIDDLE RIGHTSB [STROKE * 0.4]
include : create-stroke include : create-stroke
:.start-from SB 0 :.start-from SB 0
:.heads-to UPWARD :.heads-to UPWARD
@ -694,17 +622,15 @@ create-glyph 'r' : glyph-construction {
local coexpand [[1 - expand] / 2] local coexpand [[1 - expand] / 2]
local rhookx : RIGHTSB + JBALANCE / 2 local rhookx : RIGHTSB + JBALANCE / 2
local rmiddle : mix [SB + RBALANCE + STROKE] [rhookx - HALFSTROKE] 0.5 local rmiddle : [mix [SB + RBALANCE + STROKE] [rhookx - HALFSTROKE] 0.5] - OMIDCOR_S
include : create-stroke include : create-stroke
:.start-from rhookx [XH - RHOOK] :.start-from rhookx [XH - RHOOK]
:.set-width STROKE 0 :.set-width STROKE 0
:.curve-to [mix rmiddle rhookx KAPPA_AHOOK] XO rmiddle XO :.curve-to [mix rmiddle rhookx KAPPA_AHOOK] XO rmiddle XO
:.heads-to LEFTWARD
include : create-stroke include : create-stroke
:.start-from rmiddle [XO - STROKE] :.start-from [rmiddle + ITALICCORS] [XO - STROKE]
:.set-width 0 STROKE :.set-width 0 STROKE
:.heads-to LEFTWARD
:.arc-hv-to [SB + STROKE * ITALICCOR + RBALANCE] [XH - SMALLSMOOTHA] :.arc-hv-to [SB + STROKE * ITALICCOR + RBALANCE] [XH - SMALLSMOOTHA]
:.heads-to DOWNWARD :.heads-to DOWNWARD
:.set-width 0 [STROKE * 0.3] :.set-width 0 [STROKE * 0.3]

View file

@ -116,7 +116,7 @@ create-glyph 'ae-apart' : glyph-construction {
local smb : SMALLSMOOTHB * 0.6 local smb : SMALLSMOOTHB * 0.6
include : create-stroke include : create-stroke
:.start-from abarRight [XH - sma] :.start-from abarRight [XH - smb]
:.set-width sw 0 :.set-width sw 0
:.arc-vh-to m1 XO :.arc-vh-to m1 XO
:.curve-to [mix m1 SB KAPPA_HOOK] XO [SB + OXHOOK] [XH - SHOOK] :.curve-to [mix m1 SB KAPPA_HOOK] XO [SB + OXHOOK] [XH - SHOOK]
@ -403,7 +403,7 @@ create-glyph 'Eng' : glyph-construction {
assign-unicode 0x14A assign-unicode 0x14A
include capitalMarks include capitalMarks
include : nBowl [SB + STROKE] MIDDLE RIGHTSB [STROKE * 0.3] CAP [HOOK + HALFSTROKE + O] SMOOTHA SMOOTHB include : nShoulder [SB + STROKE] MIDDLE RIGHTSB [STROKE * 0.3] CAP [HOOK + HALFSTROKE + O] SMOOTHA SMOOTHB
include : VerticalHook [RIGHTSB - HALFSTROKE * ITALICCOR] [HOOK + HALFSTROKE + O] [Math.max [[SB - RIGHTSB] / 2 + HALFSTROKE] [-HOOK * 1.2]] HOOK include : VerticalHook [RIGHTSB - HALFSTROKE * ITALICCOR] [HOOK + HALFSTROKE + O] [Math.max [[SB - RIGHTSB] / 2 + HALFSTROKE] [-HOOK * 1.2]] HOOK
include : VBar [SB + HALFSTROKE * ITALICCOR] 0 CAP include : VBar [SB + HALFSTROKE * ITALICCOR] 0 CAP
} }

View file

@ -111,25 +111,18 @@ create-glyph 'five' : glyph-construction {
set-width WIDTH set-width WIDTH
assign-unicode '5' assign-unicode '5'
include : sHookLower 0 [[CAP * FIVEBARPOS + STROKE] / 2] HOOK local ycurly : [CAP * FIVEBARPOS + STROKE] / 2 - HALFSTROKE * globalTransform.yx
local xleft : SB + TBALANCE * [0.6 - globalTransform.yx * 2]
include : sHookLower 0 ycurly HOOK
include : create-stroke include : create-stroke
:.start-from RIGHTSB [[CAP * FIVEBARPOS + STROKE] / 2] :.start-from RIGHTSB ycurly
:.set-width STROKE 0 :.set-width STROKE 0
:.arc-vh-to MIDDLE [CAP * FIVEBARPOS + STROKE] :.arc-vh-to [MIDDLE - OMIDCOR_S] [CAP * FIVEBARPOS + STROKE]
:.line-to [SB + TBALANCE * [0.6 - globalTransform.yx * 2]] [CAP * FIVEBARPOS + STROKE] :.line-to xleft [CAP * FIVEBARPOS + STROKE]
:.heads-to LEFTWARD :.heads-to LEFTWARD
include : create-stroke include : VBarLeft xleft [CAP * FIVEBARPOS + STROKE] CAP
:.start-from [SB + TBALANCE * [0.6 - globalTransform.yx * 2]] CAP include : HBarTop xleft [RIGHTSB - TBALANCE / 2] CAP
:.set-width 0 STROKE
:.heads-to RIGHTWARD
:.line-to [RIGHTSB - TBALANCE / 2] CAP
:.heads-to RIGHTWARD
include : create-stroke
:.start-from [SB + TBALANCE * [0.6 - globalTransform.yx * 2]] [CAP * FIVEBARPOS + STROKE]
:.set-width 0 STROKE
:.heads-to UPWARD
:.line-to [SB + TBALANCE * [0.6 - globalTransform.yx * 2]] CAP
:.heads-to UPWARD
} }
create-glyph 'six' : glyph-construction { create-glyph 'six' : glyph-construction {
@ -177,13 +170,13 @@ create-glyph 'eight' : glyph-construction {
include : create-stroke include : create-stroke
:.start-from [mix SB RIGHTSB p] [CAP - smb * p] :.start-from [mix SB RIGHTSB p] [CAP - smb * p]
:.set-width STROKE 0 :.set-width STROKE 0
:.arc-vh-to [MIDDLE - STROKE * globalTransform.yx] [CAP - O] :.arc-vh-to [MIDDLE - OMIDCOR_S] [CAP - O]
:.arc-hv-to [mix RIGHTSB SB p] [CAP - sma * p] :.arc-hv-to [mix RIGHTSB SB p] [CAP - sma * p]
include : create-stroke include : create-stroke
:.start-from SB smb :.start-from SB smb
:.set-width STROKE 0 :.set-width STROKE 0
:.arc-vh-to [MIDDLE + STROKE * globalTransform.yx] O :.arc-vh-to [MIDDLE + OMIDCOR_S] O
:.arc-hv-to RIGHTSB sma :.arc-hv-to RIGHTSB sma
} }

View file

@ -86,7 +86,6 @@ create-glyph 'at' : glyph-construction {
:.set-width STROKE 0 :.set-width STROKE 0
:.heads-to RIGHTWARD :.heads-to RIGHTWARD
:.line-to [RIGHTSB - HALFSTROKE + globalTransform.yx * sw] [bot + O] :.line-to [RIGHTSB - HALFSTROKE + globalTransform.yx * sw] [bot + O]
:.set-samples 6
} }
### Brackets ### Brackets

View file

@ -57,6 +57,7 @@ create-glyph 'propto' : glyph-construction {
local s : [RIGHTSB - SB - O * 2] / [CAP - SMOOTH] local s : [RIGHTSB - SB - O * 2] / [CAP - SMOOTH]
include [Miniature ('eight') 5 s].eight include [Miniature ('eight') 5 s].eight
this.contours.pop this.contours.pop
this.contours.pop
apply-transform : Upright apply-transform : Upright
apply-transform : Translate [-MIDDLE] [-CAP / 2] apply-transform : Translate [-MIDDLE] [-CAP / 2]
apply-transform : Rotate [Math.PI / 2] apply-transform : Rotate [Math.PI / 2]

View file

@ -9,7 +9,7 @@ MAPS = $(subst .ttf,.charmap,$(TARGETS))
PASS0 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)) PASS0 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))
ABFEAT = $(subst .ttf,.ab.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))) ABFEAT = $(subst .ttf,.ab.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)))
FEATURE = $(subst .ttf,.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))) FEATURE = $(subst .ttf,.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)))
PASS1 = $(subst .ttf,.otf,$(subst $(OBJDIR)/,$(OBJDIR)/.pass1-,$(TARGETS))) PASS1 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass1-,$(TARGETS))
PASS2 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass2-,$(TARGETS)) PASS2 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass2-,$(TARGETS))
FILES = $(SUPPORT_FILES) buildglyphs.js FILES = $(SUPPORT_FILES) buildglyphs.js
@ -33,9 +33,10 @@ $(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.
cat $^ > $@ cat $^ > $@
# Pass 1 : Outline cleanup and merge # Pass 1 : Outline cleanup and merge
$(PASS1) : $(OBJDIR)/.pass1-%.otf : $(OBJDIR)/.pass0-%.ttf $(OBJDIR)/.pass0-%.fea $(PASS1) : $(OBJDIR)/.pass1-%.ttf : $(OBJDIR)/.pass0-%.ttf $(OBJDIR)/.pass0-%.fea
fontforge -script pass1-cleanup.py $^ $@ $(SUPPRESS_ERRORS) fontforge -script pass1-cleanup.py $^ $@ $(SUPPRESS_ERRORS)
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : $(OBJDIR)/.pass1-%.otf # Pass 2 : Curve simplification
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : $(OBJDIR)/.pass1-%.ttf
fontforge -script pass2-finalize.py $^ $@ fontforge -script pass2-finalize.py $^ $@
# Pass 3 : Simplify and output # Pass 3 : Simplify and output
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass2-%.ttf $(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass2-%.ttf

View file

@ -1,5 +1,5 @@
define regular ( define regular (
.upmscale 2.048 .upmscale 4
.width 500 .width 500
@ -21,7 +21,7 @@ define regular (
.smooth 192 .smooth 192
.smallsmooth 242 .smallsmooth 242
.smoothadjust 100 .smoothadjust 180
.o [-8] .o [-8]
.oxhook 0 .oxhook 0
@ -54,8 +54,7 @@ bold.dotsize = 160
bold.periodsize = 180 bold.periodsize = 180
bold.ebarpos = 0.4 bold.ebarpos = 0.4
bold.barpos = 0.42 bold.barpos = 0.42
bold.hook = 135 bold.shook = 120
bold.ahook = 100
bold.smooth = 200 bold.smooth = 200
bold.oxhook = [-8] bold.oxhook = [-8]
bold.kappa_hook = 0.7 bold.kappa_hook = 0.7
@ -65,7 +64,6 @@ bold.tbalance = 50
bold.rbalance = 18 bold.rbalance = 18
bold.weight = 700 bold.weight = 700
bold.bkappa = 0.5 bold.bkappa = 0.5
bold.smoothadjust = 130
define italic : Object.create regular define italic : Object.create regular
italic.italicangle = 10 italic.italicangle = 10

View file

@ -4,13 +4,23 @@ import sys
source = sys.argv[1] source = sys.argv[1]
font = fontforge.open(source) font = fontforge.open(source)
font.mergeFeature(sys.argv[2]) font.mergeFeature(sys.argv[2])
font.selection.all() # Replace accented characters into references
font.selection.select(("ranges", "unicode", None), 0x1FCD, 0x1FCF, 0x1FDD, 0x1FDF)
font.replaceWithReference(4) font.replaceWithReference(4)
font.selection.none()
font.selection.select(("ranges", "unicode", None), 0x0300, 0x036F)
font.replaceWithReference(4)
font.selection.none()
font.selection.select(("ranges", "unicode", None), 0x0000, 0xFFFF)
font.replaceWithReference(4)
font.selection.none()
font.selection.all()
font.removeOverlap() font.removeOverlap()
font.round() font.round()
font.removeOverlap() font.removeOverlap()
font.unlinkReferences() font.simplify(1)
font.removeOverlap() font.layers["Fore"].is_quadratic = False
font.simplify(4, ("smoothcurves", "removesingletonpoints", "setstarttoextremum"), 0.2)
font.canonicalContours() font.canonicalContours()
font.canonicalStart() font.canonicalStart()
font.generate(sys.argv[3], flags = ("short-post", "opentype")) font.generate(sys.argv[3], flags = ("short-post", "opentype"))

View file

@ -3,7 +3,11 @@ import sys
source = sys.argv[1] source = sys.argv[1]
font = fontforge.open(source) font = fontforge.open(source)
font.selection.all() font.selection.all()
font.replaceWithReference(4) font.removeOverlap()
font.simplify(4, ("smoothcurves", "removesingletonpoints", "setstarttoextremum"), 0.2) font.em = 1024
font.simplify(1)
font.canonicalContours()
font.canonicalStart()
font.generate(sys.argv[2], flags = ("short-post", "opentype")) font.generate(sys.argv[2], flags = ("short-post", "opentype"))