963 lines
29 KiB
Plaintext
963 lines
29 KiB
Plaintext
define font [require './empty.json']
|
|
define glyphList font.glyf
|
|
define glyphs (.'.notdef' glyphList.0)
|
|
|
|
|
|
define Glyph [require './support/glyph'].Glyph
|
|
define Stroke [require './support/stroke'].Stroke
|
|
|
|
define para (
|
|
.width 500
|
|
.stroke 120
|
|
.dotsize 100
|
|
.sb 50
|
|
.cap 771
|
|
.xheight 560
|
|
.hook 145
|
|
.ahook 125
|
|
.shook 100
|
|
.smooth 192
|
|
.smallsmooth 242
|
|
.smoothadjust 100
|
|
.o [-8]
|
|
.oxhook 0
|
|
.descender [-178]
|
|
.kappa 0.515
|
|
.italicangle 10
|
|
.barpos 0.44
|
|
.gbarpos 0.37
|
|
)
|
|
|
|
define variantSelector (
|
|
.zero 'slashed'
|
|
)
|
|
|
|
define globalTransform (
|
|
.xx 1
|
|
.yx [Math.tan [para.italicangle / 180 * Math.PI]]
|
|
.xy 0
|
|
.yy 1
|
|
.x 0
|
|
.y 0
|
|
)
|
|
|
|
define UPWARD (.x [-1] .y 0)
|
|
define DOWNWARD (.x 1 .y 0)
|
|
define RIGHTWARD (.x globalTransform.yx .y 1)
|
|
define LEFTWARD (.x [- globalTransform.yx] .y [-1])
|
|
|
|
# metrics
|
|
define DESCENDER para.descender
|
|
define WIDTH para.width
|
|
define CAP para.cap
|
|
define XH para.xheight
|
|
define O para.o
|
|
define OXHOOK para.oxhook
|
|
define SB para.sb
|
|
define HOOK para.hook
|
|
define AHOOK para.ahook
|
|
define SHOOK para.shook
|
|
define SMOOTH para.smooth
|
|
define SMALLSMOOTH para.smallsmooth
|
|
define STROKE para.stroke
|
|
define DOTSIZE para.dotsize
|
|
define BARPOS para.barpos
|
|
define GBARPOS para.gbarpos
|
|
|
|
|
|
# derived metrics
|
|
define XO : XH - O
|
|
define CAPO : CAP - O
|
|
define HALFSTROKE : STROKE / 2
|
|
define RIGHTSB : WIDTH - SB
|
|
define MIDDLE : WIDTH / 2
|
|
define CAPMIDDLE : CAP / 2
|
|
define CAP_SMOOTH : CAP - SMOOTH
|
|
define DOTRADIUS : para.dotsize / 2
|
|
|
|
define SMOOTHA : SMOOTH - globalTransform.yx * para.smoothadjust
|
|
define SMOOTHB : SMOOTH + globalTransform.yx * para.smoothadjust
|
|
define SMALLSMOOTHA : SMALLSMOOTH - globalTransform.yx * para.smoothadjust
|
|
define SMALLSMOOTHB : SMALLSMOOTH + globalTransform.yx * para.smoothadjust
|
|
define ITALICCORS : STROKE * globalTransform.yx
|
|
|
|
# style parameters
|
|
define KAPPA para.kappa
|
|
define COKAPPA : 1 - KAPPA
|
|
define BKAPPA : KAPPA + 0.1
|
|
define COBKAPPA : 1 - BKAPPA
|
|
define KAPPA_HOOK 0.7
|
|
define KAPPA_AHOOK BKAPPA
|
|
|
|
Stroke.bindParameters para
|
|
|
|
define [Ring u d l r] : begin {
|
|
local my [[u + d] / 2]
|
|
local mx [[l + r] / 2]
|
|
local s : new Stroke
|
|
:.set-transform globalTransform
|
|
:.start-from mx d
|
|
:.cubic-to [mx + [l - mx] * BKAPPA] d l [my + [d - my] * BKAPPA] l my
|
|
:.cubic-to l [my + [u - my] * BKAPPA] [mx + [l - mx] * BKAPPA] u mx u
|
|
:.cubic-to [mx + [r - mx] * BKAPPA] u r [my + [u - my] * BKAPPA] r my
|
|
:.cubic-to r [my + [d - my] * BKAPPA] [mx + [r - mx] * BKAPPA] d mx d
|
|
return s.points
|
|
}
|
|
define [ORing u d l r smooth] : begin {
|
|
local myu [u - smooth]
|
|
local myd [d + smooth]
|
|
local mx [[l + r] / 2]
|
|
local s : new Stroke
|
|
:.set-transform globalTransform
|
|
:.start-from mx d
|
|
:.cubic-to [mx + [l - mx] * BKAPPA] d l [myd + [d - myd] * BKAPPA] l myd
|
|
:.line-to l myu
|
|
:.cubic-to l [myu + [u - myu] * BKAPPA] [mx + [l - mx] * BKAPPA] u mx u
|
|
:.cubic-to [mx + [r - mx] * BKAPPA] u r [myu + [u - myu] * BKAPPA] r myu
|
|
:.line-to r myd
|
|
:.cubic-to r [myd + [d - myd] * BKAPPA] [mx + [r - mx] * BKAPPA] d mx d
|
|
return s.points
|
|
}
|
|
|
|
define-macro glyph-construction : syntax-rules {
|
|
@`[glyph-construction @::steps] ('.syntactic-closure' @`[lambda [] [begin {
|
|
local set-width : this.set-width.bind this
|
|
local assign-unicode : this.assign-unicode.bind this
|
|
local start-from : this.start-from.bind this
|
|
local line-to : this.line-to.bind this
|
|
local curve-to : this.curve-to.bind this
|
|
local cubic-to : this.cubic-to.bind this
|
|
local put-shapes : this.put-shapes.bind this
|
|
local reverse-last : this.reverse-last.bind this
|
|
local include-glyph : this.include-glyph.bind this
|
|
local create-stroke : this.create-stroke.bind this
|
|
this.gizmo = globalTransform
|
|
this.set-width WIDTH
|
|
begin @::[steps.map formOf]
|
|
return nothing
|
|
}]] env)
|
|
}
|
|
|
|
define [create-glyph name actions] : begin {
|
|
define glyphObject [new Glyph name]
|
|
glyphList.push glyphObject
|
|
glyphs`name = glyphObject
|
|
actions.call glyphObject
|
|
return glyphObject
|
|
}
|
|
|
|
###### SYMBOLS
|
|
|
|
create-glyph 'space' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode ' '
|
|
}
|
|
|
|
create-glyph 'bar' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode '|'
|
|
put-shapes : create-stroke :.start-from MIDDLE [DESCENDER / 2]
|
|
:.set-width [STROKE / 2] [STROKE / 2]
|
|
:.line-to MIDDLE [CAP - DESCENDER / 2]
|
|
:.form-stroke
|
|
}
|
|
|
|
###### UPPER CASE
|
|
|
|
### A X Y : Capital letters with curly stands
|
|
create-glyph 'A' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'A'
|
|
|
|
local TURN [XH * 0.1]
|
|
|
|
local leftbar : create-stroke
|
|
leftbar.start-from SB 0
|
|
:.pen-direction UPWARD
|
|
:.set-width 0 STROKE
|
|
:.line-to SB TURN
|
|
:.pen-direction UPWARD
|
|
:.curve-to SB [TURN + 0.27 * [CAP - TURN]] [MIDDLE - STROKE / 2] CAP
|
|
:.set-width 0 [STROKE * 0.8]
|
|
|
|
local rightbar : create-stroke
|
|
rightbar.start-from RIGHTSB 0
|
|
:.pen-direction UPWARD
|
|
:.set-width STROKE 0
|
|
:.line-to RIGHTSB TURN
|
|
:.pen-direction UPWARD
|
|
:.curve-to RIGHTSB [TURN + 0.27 * [CAP - TURN]] [MIDDLE + STROKE / 2] CAP
|
|
:.set-width [STROKE * 0.8] 0
|
|
|
|
local hbar : create-stroke
|
|
:.start-from [SB + STROKE] [XH / 2]
|
|
:.pen-direction RIGHTWARD
|
|
:.set-width 0 STROKE
|
|
:.line-to [RIGHTSB - STROKE] [XH / 2]
|
|
:.pen-direction RIGHTWARD
|
|
|
|
put-shapes : leftbar.form-stroke
|
|
put-shapes : hbar.form-stroke
|
|
put-shapes : rightbar.form-stroke
|
|
|
|
#top cap
|
|
start-from [MIDDLE - STROKE / 2] CAP
|
|
line-to [MIDDLE + STROKE / 2] CAP
|
|
line-to MIDDLE [CAP - STROKE]
|
|
}
|
|
create-glyph 'X' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'X'
|
|
|
|
local TURN [XH * 0.05]
|
|
local straight 0.6
|
|
local strench 0.125
|
|
|
|
local barone : create-stroke
|
|
:.start-from [SB + HALFSTROKE] 0
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.pen-direction UPWARD
|
|
:.line-to [SB + HALFSTROKE] TURN
|
|
:.curve-to [SB + HALFSTROKE] [TURN + strench * [CAP - TURN]] [MIDDLE + straight * [SB + HALFSTROKE - MIDDLE]] [CAPMIDDLE + straight * [TURN + strench * [CAP - TURN] - CAPMIDDLE]]
|
|
:.line-to [MIDDLE + straight * [RIGHTSB - HALFSTROKE - MIDDLE]] [CAPMIDDLE + straight * [CAP - TURN - strench * [CAP - TURN] - CAPMIDDLE]]
|
|
:.curve-to [RIGHTSB - HALFSTROKE] [CAP - TURN - strench * [CAP - TURN]] [RIGHTSB - HALFSTROKE] [CAP - TURN]
|
|
:.line-to [RIGHTSB - HALFSTROKE] CAP
|
|
:.pen-direction UPWARD
|
|
|
|
local bartwo : create-stroke
|
|
:.start-from [RIGHTSB - HALFSTROKE] 0
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.pen-direction UPWARD
|
|
:.line-to [RIGHTSB - HALFSTROKE] TURN
|
|
:.curve-to [RIGHTSB - HALFSTROKE] [TURN + strench * [CAP - TURN]] [MIDDLE + straight * [RIGHTSB - HALFSTROKE - MIDDLE]] [CAPMIDDLE + straight * [TURN + strench * [CAP - TURN] - CAPMIDDLE]]
|
|
:.line-to [MIDDLE + straight * [SB + HALFSTROKE - MIDDLE]] [CAPMIDDLE + straight * [CAP - TURN - strench * [CAP - TURN] - CAPMIDDLE]]
|
|
:.curve-to [SB + HALFSTROKE] [CAP - TURN - strench * [CAP - TURN]] [SB + HALFSTROKE] [CAP - TURN]
|
|
:.line-to [SB + HALFSTROKE] CAP
|
|
:.pen-direction UPWARD
|
|
|
|
put-shapes : barone.form-stroke
|
|
put-shapes : bartwo.form-stroke
|
|
}
|
|
create-glyph 'Y' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'Y'
|
|
|
|
local TURN [XH * 0.05]
|
|
local straight 0.6
|
|
local strench 0.15
|
|
local cross [CAP * 0.4]
|
|
|
|
local barone : create-stroke
|
|
:.start-from MIDDLE cross
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.line-to [MIDDLE + straight * [RIGHTSB - HALFSTROKE - MIDDLE]] [cross + straight * [CAP - TURN - strench * [CAP - TURN] - cross]]
|
|
:.curve-to [RIGHTSB - HALFSTROKE] [CAP - TURN - strench * [CAP - TURN]] [RIGHTSB - HALFSTROKE] [CAP - TURN]
|
|
:.line-to [RIGHTSB - HALFSTROKE] CAP
|
|
:.pen-direction UPWARD
|
|
|
|
local bartwo : create-stroke
|
|
:.start-from MIDDLE cross
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.line-to [MIDDLE + straight * [SB + HALFSTROKE - MIDDLE]] [cross + straight * [CAP - TURN - strench * [CAP - TURN] - cross]]
|
|
:.curve-to [SB + HALFSTROKE] [CAP - TURN - strench * [CAP - TURN]] [SB + HALFSTROKE] [CAP - TURN]
|
|
:.line-to [SB + HALFSTROKE] CAP
|
|
:.pen-direction UPWARD
|
|
|
|
put-shapes : barone.form-stroke
|
|
put-shapes : bartwo.form-stroke
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE 0
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.pen-direction UPWARD
|
|
:.line-to MIDDLE [cross + HALFSTROKE]
|
|
:.pen-direction UPWARD
|
|
:.form-stroke
|
|
}
|
|
|
|
### B D P R
|
|
create-glyph 'B' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'B'
|
|
|
|
local bowl 451
|
|
local tkappa [COKAPPA - 0.22]
|
|
local bkappa [COKAPPA - 0.2]
|
|
|
|
local turntop : [CAP + [bowl - STROKE]] / 2
|
|
local turnbottom : bowl / 2
|
|
|
|
local topbowl : create-stroke
|
|
topbowl.start-from SB CAP
|
|
:.pen-direction RIGHTWARD
|
|
:.line-to [RIGHTSB - SB * 0.5 - turnbottom] CAP
|
|
:.cubic-to [RIGHTSB - SB * 0.5 - tkappa * turnbottom] CAP [RIGHTSB - SB * 0.5] [turntop + [CAP - turntop] * KAPPA] [RIGHTSB - SB * 0.5] turntop
|
|
:.cubic-to [RIGHTSB - SB * 0.5] [turntop + KAPPA * [bowl - STROKE - turntop]] [RIGHTSB - SB * 0.5 - tkappa * turnbottom] [bowl - STROKE] [RIGHTSB - SB * 0.5 - turnbottom] [bowl - STROKE]
|
|
:.line-to SB [bowl - STROKE]
|
|
:.pen-direction LEFTWARD
|
|
|
|
local bottombowl : create-stroke
|
|
bottombowl.start-from SB 0
|
|
:.pen-direction RIGHTWARD
|
|
:.line-to [RIGHTSB - turnbottom] 0
|
|
:.cubic-to [RIGHTSB - bkappa * turnbottom] 0 RIGHTSB [turnbottom * KAPPA] RIGHTSB turnbottom
|
|
:.cubic-to RIGHTSB [turnbottom + KAPPA * [bowl - turnbottom]] [RIGHTSB - bkappa * turnbottom] bowl [RIGHTSB - turnbottom] bowl
|
|
:.line-to SB bowl
|
|
:.pen-direction LEFTWARD
|
|
|
|
local leftbar : create-stroke
|
|
:.start-from SB 0
|
|
:.pen-direction UPWARD
|
|
:.line-to SB CAP
|
|
:.pen-direction UPWARD
|
|
|
|
put-shapes : topbowl.form-stroke 0 STROKE
|
|
put-shapes : bottombowl.form-stroke STROKE 0
|
|
put-shapes : leftbar.form-stroke 0 STROKE
|
|
}
|
|
|
|
create-glyph 'D' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'D'
|
|
|
|
local dsmooth [SMOOTH * 1.55]
|
|
local bsmooth [SMOOTH * 1.3]
|
|
local bkappa [COKAPPA - 0.2]
|
|
|
|
local leftbar : create-stroke
|
|
:.start-from SB 0
|
|
:.pen-direction UPWARD
|
|
:.line-to SB CAP
|
|
:.pen-direction UPWARD
|
|
|
|
local bowl : create-stroke
|
|
bowl.start-from SB 0
|
|
:.pen-direction RIGHTWARD
|
|
:.line-to [RIGHTSB - bsmooth] 0
|
|
:.cubic-to [RIGHTSB - bkappa * bsmooth] 0 RIGHTSB [COBKAPPA * dsmooth] RIGHTSB dsmooth
|
|
:.line-to RIGHTSB [CAP - dsmooth]
|
|
:.cubic-to RIGHTSB [CAP - COBKAPPA * dsmooth] [RIGHTSB - bkappa * bsmooth] CAP [RIGHTSB - bsmooth] CAP
|
|
:.line-to SB CAP
|
|
:.pen-direction LEFTWARD
|
|
|
|
|
|
put-shapes : bowl.form-stroke STROKE 0
|
|
put-shapes : leftbar.form-stroke 0 STROKE
|
|
}
|
|
create-glyph 'P' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'P'
|
|
|
|
local bowl CAPMIDDLE
|
|
local bkappa [COKAPPA - 0.2]
|
|
|
|
local turntop : [CAP + [bowl - HALFSTROKE]] / 2
|
|
local turnbottom : bowl / 2
|
|
|
|
local topbowl : create-stroke
|
|
:.start-from SB CAP
|
|
:.pen-direction RIGHTWARD
|
|
:.line-to [RIGHTSB - turnbottom] CAP
|
|
:.cubic-to [RIGHTSB - bkappa * turnbottom] CAP RIGHTSB [turntop + [CAP - turntop] * KAPPA] RIGHTSB turntop
|
|
:.cubic-to RIGHTSB [turntop + KAPPA * [bowl - HALFSTROKE - turntop]] [RIGHTSB - bkappa * turnbottom] [bowl - HALFSTROKE] [RIGHTSB - turnbottom] [bowl - HALFSTROKE]
|
|
:.line-to SB [bowl - HALFSTROKE]
|
|
:.pen-direction LEFTWARD
|
|
|
|
local leftbar : create-stroke
|
|
:.start-from SB 0 :.pen-direction UPWARD
|
|
:.line-to SB CAP :.pen-direction UPWARD
|
|
|
|
put-shapes : topbowl.form-stroke 0 STROKE
|
|
put-shapes : leftbar.form-stroke 0 STROKE
|
|
}
|
|
create-glyph 'R' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'R'
|
|
include-glyph glyphs.P
|
|
|
|
local TURN [XH * 0.1]
|
|
local right [RIGHTSB + O]
|
|
put-shapes : create-stroke
|
|
:.start-from [right - HALFSTROKE] 0
|
|
:.pen-direction UPWARD
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.curve-to [right - HALFSTROKE] [TURN + 0.1 * [XH - TURN]] MIDDLE CAPMIDDLE
|
|
:.form-stroke
|
|
}
|
|
|
|
### C G O zero Q U
|
|
|
|
create-glyph 'C' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'C'
|
|
local outline : create-stroke
|
|
outline.start-from [RIGHTSB - OXHOOK] [CAP - HOOK]
|
|
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO MIDDLE CAPO
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [CAP - SMOOTHA]
|
|
:.line-to SB SMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.curve-to [MIDDLE + ITALICCORS + KAPPA_HOOK * [MIDDLE - SB]] O [RIGHTSB - OXHOOK] HOOK
|
|
put-shapes : outline.form-stroke STROKE 0
|
|
}
|
|
|
|
create-glyph 'G' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'G'
|
|
local outline : create-stroke
|
|
outline.start-from [RIGHTSB - OXHOOK] [CAP - HOOK]
|
|
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO MIDDLE CAPO
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [CAP - SMOOTHA]
|
|
:.line-to SB SMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.arc-hv-to RIGHTSB SMOOTHA
|
|
:.line-to RIGHTSB [CAP / 2 + STROKE / 2]
|
|
:.pen-direction UPWARD
|
|
put-shapes : outline.form-stroke STROKE 0
|
|
|
|
local bar : create-stroke
|
|
:.start-from MIDDLE [CAP / 2 + STROKE / 2]
|
|
:.line-to RIGHTSB [CAP / 2 + STROKE / 2]
|
|
:.pen-direction RIGHTWARD
|
|
put-shapes : bar.form-stroke 0 STROKE
|
|
}
|
|
|
|
create-glyph 'O' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'O'
|
|
local outline : create-stroke
|
|
outline.start-from MIDDLE CAPO
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [CAP - SMOOTHA]
|
|
:.line-to SB SMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.arc-hv-to RIGHTSB SMOOTHA
|
|
:.line-to RIGHTSB [CAP - SMOOTHB]
|
|
:.arc-vh-to MIDDLE CAPO
|
|
:.pen-direction LEFTWARD
|
|
put-shapes : outline.form-stroke STROKE 0
|
|
}
|
|
|
|
create-glyph 'zero.slashed' : glyph-construction {
|
|
set-width WIDTH
|
|
|
|
put-shapes glyphs.O.contours
|
|
|
|
local bar : create-stroke :.start-from [SB + STROKE / 2] [CAP * [1 - 0.65]] :.line-to [RIGHTSB - STROKE / 2] [CAP * 0.65]
|
|
put-shapes : bar.form-stroke [STROKE / 2] [STROKE / 2]
|
|
}
|
|
create-glyph 'zero.unslashed' : glyph-construction {
|
|
include-glyph glyphs.O
|
|
}
|
|
create-glyph 'zero.dotted' : glyph-construction {
|
|
include-glyph glyphs.O
|
|
put-shapes : list {
|
|
Ring [CAPMIDDLE + DOTRADIUS] [CAPMIDDLE - DOTRADIUS] [MIDDLE + DOTRADIUS] [MIDDLE - DOTRADIUS]
|
|
}
|
|
}
|
|
create-glyph 'zero' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode '0'
|
|
include-glyph glyphs.[match variantSelector.zero {
|
|
'slashed' 'zero.slashed'
|
|
'dotted' 'zero.dotted'
|
|
'unslahsed' 'zero.unslashed'
|
|
otherwise 'zero.slashed'
|
|
}]
|
|
}
|
|
|
|
create-glyph 'Q' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'Q'
|
|
|
|
put-shapes glyphs.O.contours
|
|
start-from MIDDLE 0
|
|
line-to [MIDDLE + STROKE / 2] [-CAP * 0.2]
|
|
line-to [MIDDLE + STROKE / 2 + STROKE] [-CAP * 0.2]
|
|
line-to [MIDDLE + STROKE] 0
|
|
line-to [MIDDLE + STROKE * [1 - 0.5 / 3]] [STROKE * 0.5]
|
|
reverse-last
|
|
}
|
|
|
|
create-glyph 'U' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'U'
|
|
local outline : create-stroke
|
|
outline.start-from SB CAP
|
|
:.pen-direction DOWNWARD
|
|
:.line-to SB SMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.arc-hv-to RIGHTSB SMOOTHA
|
|
:.line-to RIGHTSB CAP
|
|
:.pen-direction UPWARD
|
|
put-shapes : outline.form-stroke STROKE 0
|
|
}
|
|
|
|
|
|
### F E H L I
|
|
create-glyph 'F' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'F'
|
|
put-shapes : create-stroke :.start-from SB 0 :.pen-direction UPWARD :.set-width 0 STROKE
|
|
:.line-to SB CAP :.pen-direction UPWARD :.form-stroke
|
|
put-shapes : create-stroke :.start-from SB CAP :.set-width 0 STROKE :.pen-direction RIGHTWARD
|
|
:.line-to RIGHTSB CAP :.pen-direction RIGHTWARD :.form-stroke
|
|
put-shapes : create-stroke :.start-from SB CAPMIDDLE :.set-width HALFSTROKE HALFSTROKE :.pen-direction RIGHTWARD
|
|
:.line-to [RIGHTSB - STROKE] CAPMIDDLE :.pen-direction RIGHTWARD :.form-stroke
|
|
}
|
|
create-glyph 'E' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'E'
|
|
include-glyph glyphs.F
|
|
put-shapes : create-stroke :.start-from SB 0 :.set-width STROKE 0 :.pen-direction RIGHTWARD
|
|
:.line-to RIGHTSB 0 :.pen-direction RIGHTWARD :.form-stroke
|
|
}
|
|
create-glyph 'H' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'H'
|
|
|
|
put-shapes : create-stroke :.start-from SB 0 :.pen-direction UPWARD :.set-width 0 STROKE
|
|
:.line-to SB CAP :.pen-direction UPWARD :.form-stroke
|
|
put-shapes : create-stroke :.start-from RIGHTSB 0 :.pen-direction UPWARD :.set-width STROKE 0
|
|
:.line-to RIGHTSB CAP :.pen-direction UPWARD :.form-stroke
|
|
put-shapes : create-stroke :.start-from SB [CAP / 2] :.set-width HALFSTROKE HALFSTROKE :.pen-direction RIGHTWARD
|
|
:.line-to RIGHTSB [CAP / 2] :.pen-direction RIGHTWARD :.form-stroke
|
|
}
|
|
|
|
create-glyph 'L' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'L'
|
|
|
|
put-shapes : create-stroke
|
|
:.start-from [SB * 1.5] CAP
|
|
:.set-width STROKE 0
|
|
:.pen-direction DOWNWARD
|
|
:.line-to [SB * 1.5] 0
|
|
:.pen-direction DOWNWARD
|
|
:.form-stroke
|
|
put-shapes : create-stroke
|
|
:.start-from [SB * 1.5] 0
|
|
:.set-width STROKE 0
|
|
:.pen-direction RIGHTWARD
|
|
:.line-to RIGHTSB 0
|
|
:.pen-direction RIGHTWARD
|
|
:.form-stroke
|
|
}
|
|
|
|
create-glyph 'dotlessI.straight' : glyph-construction {
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE 0
|
|
:.pen-direction UPWARD
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.line-to MIDDLE CAP
|
|
:.pen-direction UPWARD
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'dotlessI.symmetric' : glyph-construction {
|
|
include-glyph glyphs.'dotlessI.straight'
|
|
# Top serif
|
|
put-shapes : create-stroke
|
|
:.start-from [MIDDLE - WIDTH * 0.26 - STROKE * globalTransform.yx] CAP
|
|
:.set-width 0 STROKE
|
|
:.line-to [MIDDLE + WIDTH * 0.26 - STROKE * globalTransform.yx] CAP
|
|
:.form-stroke
|
|
# Bottom serif
|
|
put-shapes : create-stroke
|
|
:.start-from [MIDDLE - WIDTH * 0.26 + STROKE * globalTransform.yx] 0
|
|
:.set-width STROKE 0
|
|
:.line-to [MIDDLE + WIDTH * 0.26 + STROKE * globalTransform.yx] 0
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'I' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'I'
|
|
|
|
include-glyph glyphs.'dotlessI.symmetric'
|
|
}
|
|
|
|
|
|
### S
|
|
create-glyph 'S' : glyph-construction {
|
|
set-width WIDTH; assign-unicode 'S'
|
|
|
|
local slope [STROKE * 0.00092]
|
|
local expand 0.35
|
|
local coexpand [[1 - expand] / 2]
|
|
local ssmootha SMOOTHA
|
|
|
|
local bowltop : create-stroke
|
|
bowltop.start-from [RIGHTSB - OXHOOK] [CAP - HOOK]
|
|
:.set-width STROKE 0
|
|
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO MIDDLE CAPO
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [CAP - ssmootha]
|
|
|
|
local strokemiddle : create-stroke
|
|
strokemiddle.start-from [SB + STROKE / 2] [CAP - ssmootha]
|
|
:.set-width [STROKE / 2] [STROKE / 2]
|
|
:.curve-to [SB + STROKE / 2] [[0.5 + slope] * CAP + [2 * slope * CAP] / [expand * WIDTH] * [coexpand * WIDTH - SB - STROKE / 2]] [coexpand * WIDTH] [[0.5 + slope] * CAP]
|
|
:.line-to [[1 - coexpand] * WIDTH] [[0.5 - slope] * CAP]
|
|
:.curve-to [RIGHTSB - STROKE / 2] [[0.5 - slope] * CAP - [2 * slope * CAP] / [expand * WIDTH] * [coexpand * WIDTH - SB - STROKE / 2]] [RIGHTSB - STROKE / 2] ssmootha
|
|
|
|
local bowlbottom : create-stroke
|
|
bowlbottom.start-from RIGHTSB ssmootha :.set-width 0 STROKE
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction LEFTWARD
|
|
:.curve-to [MIDDLE - KAPPA_HOOK * [MIDDLE - para.sb]] O [SB + OXHOOK] HOOK
|
|
|
|
put-shapes : bowltop.form-stroke
|
|
put-shapes : strokemiddle.form-stroke
|
|
put-shapes : bowlbottom.form-stroke
|
|
}
|
|
create-glyph 'dollar' : glyph-construction {
|
|
set-width WIDTH; assign-unicode '$'
|
|
put-shapes glyphs.S.contours
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE [CAP - HALFSTROKE]
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.line-to MIDDLE [CAP - DESCENDER / 2]
|
|
:.form-stroke
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE [DESCENDER / 2]
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.line-to MIDDLE HALFSTROKE
|
|
:.form-stroke
|
|
}
|
|
|
|
|
|
###### LOWER CASE
|
|
|
|
### o b d p q g
|
|
create-glyph 'o' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'o'
|
|
local outline : create-stroke
|
|
:.start-from MIDDLE XO
|
|
:.set-width STROKE 0
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [XH - SMALLSMOOTHA]
|
|
:.line-to SB SMALLSMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.arc-hv-to RIGHTSB SMALLSMOOTHA
|
|
:.line-to RIGHTSB [XH - SMALLSMOOTHB]
|
|
:.arc-vh-to MIDDLE XO
|
|
:.pen-direction LEFTWARD
|
|
put-shapes : outline.form-stroke
|
|
}
|
|
create-glyph 'o.left' : glyph-construction {
|
|
set-width WIDTH
|
|
# right half
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE XO
|
|
:.pen-direction RIGHTWARD
|
|
:.set-width 0 STROKE
|
|
:.arc-hv-to RIGHTSB [XH - SMALLSMOOTHB]
|
|
:.line-to RIGHTSB SMALLSMOOTHA
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction LEFTWARD
|
|
:.form-stroke
|
|
# left half
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE [O + STROKE]
|
|
:.pen-direction LEFTWARD
|
|
:.set-width STROKE 0
|
|
:.arc-hv-to [SB + STROKE] [SMALLSMOOTHB - STROKE * 0.05]
|
|
:.set-width HALFSTROKE 0
|
|
:.line-to [SB + STROKE] [XH - SMALLSMOOTHA + STROKE * 0.05]
|
|
:.set-width HALFSTROKE 0
|
|
:.arc-vh-to MIDDLE [XO - STROKE]
|
|
:.set-width STROKE 0
|
|
:.pen-direction RIGHTWARD
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'o.right' : glyph-construction {
|
|
set-width WIDTH
|
|
# left half
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE XO
|
|
:.pen-direction LEFTWARD
|
|
:.set-width STROKE 0
|
|
:.arc-hv-to SB [XH - SMALLSMOOTHA]
|
|
:.line-to SB SMALLSMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.form-stroke
|
|
# right half
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE [O + STROKE]
|
|
:.pen-direction RIGHTWARD
|
|
:.set-width 0 STROKE
|
|
:.arc-hv-to [RIGHTSB - STROKE] [SMALLSMOOTHA - STROKE * 0.05]
|
|
:.set-width 0 HALFSTROKE
|
|
:.line-to [RIGHTSB - STROKE] [XH - SMALLSMOOTHB + STROKE * 0.05]
|
|
:.set-width 0 HALFSTROKE
|
|
:.arc-vh-to MIDDLE [XO - STROKE]
|
|
:.set-width 0 STROKE
|
|
:.pen-direction LEFTWARD
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'p' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'p'
|
|
include-glyph glyphs.'o.left'
|
|
put-shapes : create-stroke
|
|
:.start-from SB XH
|
|
:.pen-direction DOWNWARD
|
|
:.set-width STROKE 0
|
|
:.line-to SB DESCENDER
|
|
:.pen-direction DOWNWARD
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'b' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'b'
|
|
put-shapes glyphs.'o.left'.contours
|
|
put-shapes : create-stroke
|
|
:.start-from SB 0
|
|
:.pen-direction UPWARD
|
|
:.set-width 0 STROKE
|
|
:.line-to SB CAP
|
|
:.pen-direction UPWARD
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'q' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'q'
|
|
put-shapes glyphs.'o.right'.contours
|
|
put-shapes : create-stroke
|
|
:.start-from RIGHTSB XH
|
|
:.pen-direction DOWNWARD
|
|
:.set-width 0 STROKE
|
|
:.line-to RIGHTSB DESCENDER
|
|
:.pen-direction DOWNWARD
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'd' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'd'
|
|
put-shapes glyphs.'o.right'.contours
|
|
put-shapes : create-stroke
|
|
:.start-from RIGHTSB 0
|
|
:.pen-direction UPWARD
|
|
:.set-width STROKE 0
|
|
:.line-to RIGHTSB CAP
|
|
:.pen-direction UPWARD
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'g' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'g'
|
|
|
|
put-shapes : list {
|
|
Ring XO [XH * GBARPOS] [SB * 1.25] [RIGHTSB - 0.25 * SB] SMALLSMOOTH
|
|
Ring [XO - STROKE] [[XH * GBARPOS] + STROKE] [SB * 1.25 + STROKE] [[RIGHTSB - 0.25 * SB] - STROKE] [SMALLSMOOTH - STROKE]
|
|
}
|
|
reverse-last
|
|
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE [XH * GBARPOS]
|
|
:.set-width 0 [STROKE * 0.75]
|
|
:.arc-hv-to [SB * 1.5 + STROKE] [[O - DESCENDER * 0.85 + XH * GBARPOS] * 0.47]
|
|
:.set-width 0 STROKE
|
|
:.arc-vh-to [MIDDLE + DESCENDER * 0.15] [O - DESCENDER * 0.85]
|
|
:.line-to [MIDDLE - DESCENDER * 0.15] [O - DESCENDER * 0.85]
|
|
:.arc-hv-to [RIGHTSB - O * 2] [[-STROKE] * globalTransform.yx * 2]
|
|
:.arc-vh-to MIDDLE [DESCENDER + O]
|
|
:.arc-hv-to SB [DESCENDER * 0.1]
|
|
:.arc-vh-to [MIDDLE + DESCENDER * 0.15] [O - DESCENDER * 0.85]
|
|
:.form-stroke
|
|
|
|
start-from [RIGHTSB + 0.5 * SB] XH
|
|
line-to [RIGHTSB + 0.5 * SB] [XH - STROKE]
|
|
line-to MIDDLE [XH - STROKE - O]
|
|
line-to MIDDLE XH
|
|
}
|
|
### c e
|
|
create-glyph 'c' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'c'
|
|
local outline : create-stroke
|
|
outline.start-from [RIGHTSB - OXHOOK] [XH - HOOK]
|
|
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] XO MIDDLE XO
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [XH - SMALLSMOOTHA]
|
|
:.line-to SB SMALLSMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - SB]] O [RIGHTSB - OXHOOK] HOOK
|
|
put-shapes : outline.form-stroke STROKE 0
|
|
}
|
|
create-glyph 'e' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'e'
|
|
|
|
local barbottom [XH * BARPOS]
|
|
|
|
local outline : create-stroke
|
|
:.start-from RIGHTSB barbottom
|
|
:.pen-direction UPWARD
|
|
:.set-width STROKE 0
|
|
:.line-to RIGHTSB [XH - SMALLSMOOTHB]
|
|
:.arc-vh-to MIDDLE XO
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [XH - SMALLSMOOTHA]
|
|
:.line-to SB SMALLSMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - SB]] O [RIGHTSB - OXHOOK] HOOK
|
|
|
|
local bar : create-stroke
|
|
:.start-from [SB + HALFSTROKE] barbottom
|
|
:.set-width STROKE 0
|
|
:.pen-direction RIGHTWARD
|
|
:.line-to [RIGHTSB - HALFSTROKE] barbottom
|
|
:.pen-direction RIGHTWARD
|
|
|
|
put-shapes : outline.form-stroke
|
|
put-shapes : bar.form-stroke
|
|
}
|
|
|
|
### a u
|
|
create-glyph 'a.upright' : glyph-construction {
|
|
set-width WIDTH
|
|
local bartop [XH * BARPOS + STROKE]
|
|
put-shapes : create-stroke
|
|
:.start-from RIGHTSB 0
|
|
:.pen-direction UPWARD
|
|
:.set-width STROKE 0
|
|
:.line-to RIGHTSB [XH - SMOOTHA]
|
|
:.arc-vh-to MIDDLE XO
|
|
:.pen-direction LEFTWARD
|
|
:.curve-to [MIDDLE - KAPPA_AHOOK * [MIDDLE - SB]] XO [SB + OXHOOK] [XH - AHOOK]
|
|
:.form-stroke
|
|
put-shapes : create-stroke
|
|
:.start-from [WIDTH * 0.47] O
|
|
:.set-width 0 STROKE
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [bartop * 0.45]
|
|
:.arc-vh-to [WIDTH * 0.6] bartop
|
|
:.line-to RIGHTSB bartop
|
|
:.pen-direction RIGHTWARD
|
|
:.form-stroke
|
|
put-shapes : create-stroke
|
|
:.start-from [WIDTH * 0.47] [O + STROKE]
|
|
:.set-width 0 STROKE
|
|
:.pen-direction RIGHTWARD
|
|
:.arc-hv-to [RIGHTSB - STROKE] [SMALLSMOOTHA * 0.65]
|
|
:.pen-direction UPWARD
|
|
:.set-width 0 [STROKE * 0.4]
|
|
:.form-stroke
|
|
}
|
|
create-glyph 'a.italic' : glyph-construction {
|
|
set-width WIDTH
|
|
include-glyph glyphs.'o.right'
|
|
put-shapes : create-stroke
|
|
:.start-from RIGHTSB 0
|
|
:.pen-direction UPWARD
|
|
:.set-width STROKE 0
|
|
:.line-to RIGHTSB XH
|
|
:.pen-direction UPWARD
|
|
:.form-stroke
|
|
}
|
|
|
|
create-glyph 'a' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'a'
|
|
if [para.italicangle > 0] {
|
|
then : include-glyph glyphs.'a.italic'
|
|
else : include-glyph glyphs.'a.upright'
|
|
}
|
|
}
|
|
create-glyph 'u' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'u'
|
|
put-shapes : create-stroke
|
|
:.start-from SB XH
|
|
:.pen-direction DOWNWARD
|
|
:.set-width STROKE 0
|
|
:.line-to SB SMALLSMOOTHB
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction RIGHTWARD
|
|
:.form-stroke
|
|
put-shapes : create-stroke
|
|
:.start-from MIDDLE [O + STROKE]
|
|
:.set-width 0 STROKE
|
|
:.pen-direction RIGHTWARD
|
|
:.arc-hv-to [RIGHTSB - STROKE] SMALLSMOOTHA
|
|
:.pen-direction UPWARD
|
|
:.set-width 0 [STROKE * 0.4]
|
|
:.form-stroke
|
|
put-shapes : create-stroke
|
|
:.start-from RIGHTSB 0
|
|
:.pen-direction UPWARD
|
|
:.set-width STROKE 0
|
|
:.line-to RIGHTSB XH
|
|
:.pen-direction UPWARD
|
|
:.form-stroke
|
|
}
|
|
|
|
### x
|
|
create-glyph 'x' : glyph-construction {
|
|
set-width WIDTH
|
|
assign-unicode 'x'
|
|
|
|
local TURN [XH * 0.1]
|
|
|
|
local barone : create-stroke
|
|
:.start-from [SB + HALFSTROKE] 0
|
|
:.pen-direction UPWARD
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.cubic-to [SB + HALFSTROKE] [TURN + 0.17 * [XH - TURN]] [RIGHTSB - HALFSTROKE] [XH - TURN - 0.17 * [XH - TURN]] [RIGHTSB - HALFSTROKE] XH
|
|
:.pen-direction UPWARD
|
|
|
|
local bartwo : create-stroke
|
|
:.start-from [RIGHTSB - HALFSTROKE] 0
|
|
:.pen-direction UPWARD
|
|
:.set-width HALFSTROKE HALFSTROKE
|
|
:.cubic-to [RIGHTSB - HALFSTROKE] [TURN + 0.17 * [XH - TURN]] [SB + HALFSTROKE] [XH - TURN - 0.17 * [XH - TURN]] [SB + HALFSTROKE] XH
|
|
:.pen-direction UPWARD
|
|
|
|
put-shapes : barone.form-stroke
|
|
put-shapes : bartwo.form-stroke
|
|
}
|
|
|
|
### s
|
|
create-glyph 's' : glyph-construction {
|
|
set-width WIDTH; assign-unicode 's'
|
|
|
|
local slope 0.015
|
|
local expand 0.175
|
|
local coexpand [[1 - expand] / 2]
|
|
local ssmootha [SMOOTHA * 0.87]
|
|
|
|
local bowltop : create-stroke
|
|
bowltop.start-from [RIGHTSB - OXHOOK] [XH - SHOOK]
|
|
:.set-width STROKE 0
|
|
:.curve-to [MIDDLE + KAPPA_AHOOK * [MIDDLE - para.sb]] XO MIDDLE XO
|
|
:.pen-direction LEFTWARD
|
|
:.arc-hv-to SB [XH - ssmootha]
|
|
|
|
local strokemiddle : create-stroke
|
|
strokemiddle.start-from [SB + STROKE / 2] [XH - ssmootha]
|
|
:.set-width [STROKE / 2] [STROKE / 2]
|
|
:.curve-to [SB + STROKE / 2] [[0.5 + slope] * XH + [2 * slope * XH] / [expand * WIDTH] * [coexpand * WIDTH - SB - STROKE / 2]] [coexpand * WIDTH] [[0.5 + slope] * XH]
|
|
:.line-to [[1 - coexpand] * WIDTH] [[0.5 - slope] * XH]
|
|
:.curve-to [RIGHTSB - STROKE / 2] [[0.5 - slope] * XH - [2 * slope * XH] / [expand * WIDTH] * [coexpand * WIDTH - SB - STROKE / 2]] [RIGHTSB - STROKE / 2] ssmootha
|
|
|
|
local bowlbottom : create-stroke
|
|
bowlbottom.start-from RIGHTSB ssmootha :.set-width 0 STROKE
|
|
:.arc-vh-to MIDDLE O
|
|
:.pen-direction LEFTWARD
|
|
:.curve-to [MIDDLE - KAPPA_AHOOK * [MIDDLE - para.sb]] O [SB + OXHOOK] SHOOK
|
|
|
|
put-shapes : bowltop.form-stroke
|
|
put-shapes : strokemiddle.form-stroke
|
|
put-shapes : bowlbottom.form-stroke
|
|
}
|
|
|
|
exports.font = font |