Separated common shapes into glyphs/common-shapes.patel
This commit is contained in:
parent
625b22273a
commit
b24242e59c
7 changed files with 1481 additions and 1505 deletions
|
@ -122,69 +122,6 @@ set font.'OS/2'.bProportion 9 # Monospaced
|
||||||
### Font names
|
### Font names
|
||||||
|
|
||||||
### Useful shapes
|
### Useful shapes
|
||||||
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 [leftwardTopSerif x y length] : begin {
|
|
||||||
return : new Stroke
|
|
||||||
:.set-transform globalTransform
|
|
||||||
:.start-from [x + HALFSTROKE] y
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.set-width STROKE 0
|
|
||||||
:.line-to [x - length - globalTransform.yx * STROKE] y
|
|
||||||
:.to-outline
|
|
||||||
}
|
|
||||||
define [leftwardBottomSerif x y length] : begin {
|
|
||||||
return : new Stroke
|
|
||||||
:.set-transform globalTransform
|
|
||||||
:.start-from [x + HALFSTROKE] y
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.set-width 0 STROKE
|
|
||||||
:.line-to [x - length + globalTransform.yx * STROKE] y
|
|
||||||
:.to-outline
|
|
||||||
}
|
|
||||||
define [rightwardTopSerif x y length] : begin {
|
|
||||||
return : new Stroke
|
|
||||||
:.set-transform globalTransform
|
|
||||||
:.start-from [x - HALFSTROKE] y
|
|
||||||
:.heads-to RIGHTWARD
|
|
||||||
:.set-width 0 STROKE
|
|
||||||
:.line-to [x + length - globalTransform.yx * STROKE] y
|
|
||||||
:.to-outline
|
|
||||||
}
|
|
||||||
define [rightwardBottomSerif x y length] : begin {
|
|
||||||
return : new Stroke
|
|
||||||
:.set-transform globalTransform
|
|
||||||
:.start-from [x - HALFSTROKE] y
|
|
||||||
:.heads-to RIGHTWARD
|
|
||||||
:.set-width STROKE 0
|
|
||||||
:.line-to [x + length + globalTransform.yx * STROKE] y
|
|
||||||
:.to-outline
|
|
||||||
}
|
|
||||||
|
|
||||||
define-macro glyph-construction : syntax-rules {
|
define-macro glyph-construction : syntax-rules {
|
||||||
@`[glyph-construction @::steps] ('.syntactic-closure' @`[lambda [] [begin {
|
@`[glyph-construction @::steps] ('.syntactic-closure' @`[lambda [] [begin {
|
||||||
|
|
2680
buildglyphs.js
2680
buildglyphs.js
File diff suppressed because it is too large
Load diff
139
glyphs/common-shapes.patel
Normal file
139
glyphs/common-shapes.patel
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
|
||||||
|
### COMMON SHAPES
|
||||||
|
|
||||||
|
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 [leftwardTopSerif x y length] : begin {
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from [x + HALFSTROKE] y
|
||||||
|
:.heads-to LEFTWARD
|
||||||
|
:.set-width STROKE 0
|
||||||
|
:.line-to [x - length - globalTransform.yx * STROKE] y
|
||||||
|
:.to-outline
|
||||||
|
}
|
||||||
|
define [leftwardBottomSerif x y length] : begin {
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from [x + HALFSTROKE] y
|
||||||
|
:.heads-to LEFTWARD
|
||||||
|
:.set-width 0 STROKE
|
||||||
|
:.line-to [x - length + globalTransform.yx * STROKE] y
|
||||||
|
:.to-outline
|
||||||
|
}
|
||||||
|
define [rightwardTopSerif x y length] : begin {
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from [x - HALFSTROKE] y
|
||||||
|
:.heads-to RIGHTWARD
|
||||||
|
:.set-width 0 STROKE
|
||||||
|
:.line-to [x + length - globalTransform.yx * STROKE] y
|
||||||
|
:.to-outline
|
||||||
|
}
|
||||||
|
define [rightwardBottomSerif x y length] : begin {
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from [x - HALFSTROKE] y
|
||||||
|
:.heads-to RIGHTWARD
|
||||||
|
:.set-width STROKE 0
|
||||||
|
:.line-to [x + length + globalTransform.yx * STROKE] y
|
||||||
|
:.to-outline
|
||||||
|
}
|
||||||
|
|
||||||
|
define [sStrand leftlimit rightlimit _expansion _roundp] : begin {
|
||||||
|
local expansion : _expansion || 0.25
|
||||||
|
local roundsize : [SMOOTHA * [_roundp || 0.4]] * [if [leftlimit < rightlimit] [-1] 1]
|
||||||
|
local roundleft [leftlimit - roundsize]
|
||||||
|
local roundright [rightlimit + roundsize]
|
||||||
|
local sxleft [SB + HALFSTROKE + [RIGHTSB - SB - STROKE] * [0.5 - expansion]]
|
||||||
|
local sxright [WIDTH - sxleft]
|
||||||
|
local syleft [roundleft + [roundright - roundleft] * [0.5 - expansion]]
|
||||||
|
local syright [roundleft + [roundright - roundleft] * [0.5 + expansion]]
|
||||||
|
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from [SB + HALFSTROKE] leftlimit
|
||||||
|
:.set-width HALFSTROKE HALFSTROKE
|
||||||
|
:.curve-to [SB + HALFSTROKE] roundleft sxleft syleft
|
||||||
|
:.line-to sxright syright
|
||||||
|
:.curve-to [RIGHTSB - HALFSTROKE] roundright [RIGHTSB - HALFSTROKE] rightlimit
|
||||||
|
:.to-outline
|
||||||
|
}
|
||||||
|
|
||||||
|
define [nBowl left middle right fine] : begin {
|
||||||
|
local bandLeft : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from right 0
|
||||||
|
:.heads-to UPWARD
|
||||||
|
:.set-width STROKE 0
|
||||||
|
:.line-to right [XH - SMALLSMOOTHB]
|
||||||
|
:.arc-vh-to middle XO
|
||||||
|
:.heads-to LEFTWARD
|
||||||
|
:.to-outline
|
||||||
|
local bandRight : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from middle [XO - STROKE]
|
||||||
|
:.set-width 0 STROKE
|
||||||
|
:.heads-to LEFTWARD
|
||||||
|
:.arc-hv-to left [XH - SMALLSMOOTHA]
|
||||||
|
:.heads-to DOWNWARD
|
||||||
|
:.set-width 0 fine
|
||||||
|
:.to-outline
|
||||||
|
return : bandLeft.concat bandRight
|
||||||
|
}
|
||||||
|
|
||||||
|
define [sHookUpper top smooth hook] : begin {
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from [RIGHTSB - OXHOOK] [top - hook]
|
||||||
|
:.set-width STROKE 0
|
||||||
|
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] [top - O] MIDDLE [top - O]
|
||||||
|
:.heads-to LEFTWARD
|
||||||
|
:.arc-hv-to SB [top - smooth]
|
||||||
|
:.to-outline
|
||||||
|
}
|
||||||
|
define [twoHookUpper top smooth hook] : begin {
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from [SB + OXHOOK] [top - hook]
|
||||||
|
:.set-width 0 STROKE
|
||||||
|
:.curve-to [MIDDLE - KAPPA_HOOK * [MIDDLE - para.sb]] [top - O] MIDDLE [top - O]
|
||||||
|
:.heads-to RIGHTWARD
|
||||||
|
:.arc-hv-to RIGHTSB [top - smooth]
|
||||||
|
:.to-outline
|
||||||
|
}
|
||||||
|
define [sHookLower bottom smooth hook] : begin {
|
||||||
|
return : new Stroke
|
||||||
|
:.set-transform globalTransform
|
||||||
|
:.start-from RIGHTSB smooth
|
||||||
|
:.set-width 0 STROKE
|
||||||
|
:.arc-vh-to MIDDLE [bottom + O]
|
||||||
|
:.heads-to LEFTWARD
|
||||||
|
:.curve-to [MIDDLE - KAPPA_HOOK * [MIDDLE - para.sb]] [bottom + O] [SB + OXHOOK] [bottom + hook]
|
||||||
|
:.to-outline
|
||||||
|
}
|
|
@ -645,51 +645,15 @@ create-glyph 'M' : glyph-construction {
|
||||||
:.to-outline
|
:.to-outline
|
||||||
}
|
}
|
||||||
|
|
||||||
define [sStrand leftlimit rightlimit _expansion _roundp] : begin {
|
|
||||||
local strand : new Stroke
|
|
||||||
strand.gizmo = globalTransform
|
|
||||||
|
|
||||||
local expansion : _expansion || 0.25
|
|
||||||
local roundsize : [SMOOTHA * [_roundp || 0.4]] * [if [leftlimit < rightlimit] [-1] 1]
|
|
||||||
local roundleft [leftlimit - roundsize]
|
|
||||||
local roundright [rightlimit + roundsize]
|
|
||||||
local sxleft [SB + HALFSTROKE + [RIGHTSB - SB - STROKE] * [0.5 - expansion]]
|
|
||||||
local sxright [WIDTH - sxleft]
|
|
||||||
local syleft [roundleft + [roundright - roundleft] * [0.5 - expansion]]
|
|
||||||
local syright [roundleft + [roundright - roundleft] * [0.5 + expansion]]
|
|
||||||
|
|
||||||
return : strand.start-from [SB + HALFSTROKE] leftlimit
|
|
||||||
:.set-width HALFSTROKE HALFSTROKE
|
|
||||||
:.curve-to [SB + HALFSTROKE] roundleft sxleft syleft
|
|
||||||
:.line-to sxright syright
|
|
||||||
:.curve-to [RIGHTSB - HALFSTROKE] roundright [RIGHTSB - HALFSTROKE] rightlimit
|
|
||||||
:.to-outline
|
|
||||||
}
|
|
||||||
|
|
||||||
### S
|
### S
|
||||||
create-glyph 'S' : glyph-construction {
|
create-glyph 'S' : glyph-construction {
|
||||||
set-width WIDTH
|
set-width WIDTH
|
||||||
assign-unicode 'S'
|
assign-unicode 'S'
|
||||||
include capitalMarks
|
include capitalMarks
|
||||||
|
|
||||||
local ssmootha SMOOTHA
|
|
||||||
|
|
||||||
local bowltop : create-stroke
|
put-shapes : sHookUpper CAP SMOOTHA HOOK
|
||||||
bowltop.start-from [RIGHTSB - OXHOOK] [CAP - HOOK]
|
put-shapes : sHookLower 0 SMOOTHA HOOK
|
||||||
:.set-width STROKE 0
|
put-shapes : sStrand [CAP - SMOOTHA] SMOOTHA
|
||||||
:.curve-to [MIDDLE + KAPPA_HOOK * [MIDDLE - para.sb]] CAPO MIDDLE CAPO
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.arc-hv-to SB [CAP - ssmootha]
|
|
||||||
|
|
||||||
local bowlbottom : create-stroke
|
|
||||||
bowlbottom.start-from RIGHTSB ssmootha :.set-width 0 STROKE
|
|
||||||
:.arc-vh-to MIDDLE O
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.curve-to [MIDDLE - KAPPA_HOOK * [MIDDLE - para.sb]] O [SB + OXHOOK] HOOK
|
|
||||||
|
|
||||||
put-shapes : bowltop.to-outline
|
|
||||||
put-shapes : bowlbottom.to-outline
|
|
||||||
put-shapes : sStrand [CAP - ssmootha] ssmootha
|
|
||||||
}
|
}
|
||||||
create-glyph 'dollar' : glyph-construction {
|
create-glyph 'dollar' : glyph-construction {
|
||||||
set-width WIDTH; assign-unicode '$'
|
set-width WIDTH; assign-unicode '$'
|
||||||
|
|
|
@ -354,30 +354,12 @@ create-glyph 'u' : glyph-construction {
|
||||||
}
|
}
|
||||||
|
|
||||||
### n h m
|
### n h m
|
||||||
create-glyph 'nbowl' : glyph-construction {
|
|
||||||
put-shapes : create-stroke
|
|
||||||
:.start-from RIGHTSB 0
|
|
||||||
:.heads-to UPWARD
|
|
||||||
:.set-width STROKE 0
|
|
||||||
:.line-to RIGHTSB [XH - SMALLSMOOTHB]
|
|
||||||
:.arc-vh-to MIDDLE XO
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.to-outline
|
|
||||||
put-shapes : create-stroke
|
|
||||||
:.start-from MIDDLE [XO - STROKE]
|
|
||||||
:.set-width 0 STROKE
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.arc-hv-to [SB + STROKE * ITALICCOR] [XH - SMALLSMOOTHA]
|
|
||||||
:.heads-to DOWNWARD
|
|
||||||
:.set-width 0 [STROKE * 0.4]
|
|
||||||
:.to-outline
|
|
||||||
}
|
|
||||||
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 glyphs.nbowl
|
put-shapes : nBowl [SB + STROKE * ITALICCOR] MIDDLE RIGHTSB [STROKE * 0.4]
|
||||||
put-shapes : create-stroke
|
put-shapes : create-stroke
|
||||||
:.start-from SB 0
|
:.start-from SB 0
|
||||||
:.heads-to UPWARD
|
:.heads-to UPWARD
|
||||||
|
@ -391,7 +373,7 @@ create-glyph 'h' : glyph-construction {
|
||||||
assign-unicode 'h'
|
assign-unicode 'h'
|
||||||
include bMarks
|
include bMarks
|
||||||
|
|
||||||
include glyphs.nbowl
|
put-shapes : nBowl [SB + STROKE * ITALICCOR] MIDDLE RIGHTSB [STROKE * 0.4]
|
||||||
put-shapes : create-stroke
|
put-shapes : create-stroke
|
||||||
:.start-from SB 0
|
:.start-from SB 0
|
||||||
:.heads-to UPWARD
|
:.heads-to UPWARD
|
||||||
|
@ -812,28 +794,10 @@ create-glyph 's' : glyph-construction {
|
||||||
assign-unicode 's'
|
assign-unicode 's'
|
||||||
include eMarks
|
include eMarks
|
||||||
|
|
||||||
local slope 0.015
|
put-shapes : sHookUpper XH [SMOOTHA * 0.87] SHOOK
|
||||||
local expand 0.175
|
put-shapes : sHookLower 0 [SMOOTHA * 0.87] SHOOK
|
||||||
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
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.arc-hv-to SB [XH - ssmootha]
|
|
||||||
|
|
||||||
local bowlbottom : create-stroke
|
put-shapes : sStrand [XH - [SMOOTHA * 0.87]] [SMOOTHA * 0.87] 0.2 0.45
|
||||||
bowlbottom.start-from RIGHTSB ssmootha :.set-width 0 STROKE
|
|
||||||
:.arc-vh-to MIDDLE O
|
|
||||||
:.heads-to LEFTWARD
|
|
||||||
:.curve-to [MIDDLE - [KAPPA_AHOOK + TAILADJSKAPPA * globalTransform.yx] * [MIDDLE - para.sb]] O [SB + OXHOOK - + TAILADJSX * globalTransform.yx] [SHOOK - TAILADJSY * globalTransform.yx]
|
|
||||||
|
|
||||||
put-shapes : bowltop.to-outline
|
|
||||||
put-shapes : bowlbottom.to-outline
|
|
||||||
|
|
||||||
put-shapes : sStrand [XH - ssmootha] ssmootha 0.2 0.45
|
|
||||||
}
|
}
|
||||||
|
|
||||||
### r
|
### r
|
||||||
|
|
|
@ -52,18 +52,8 @@ create-glyph 'two' : glyph-construction {
|
||||||
assign-unicode '2'
|
assign-unicode '2'
|
||||||
include capitalMarks
|
include capitalMarks
|
||||||
|
|
||||||
|
put-shapes : twoHookUpper CAP SMOOTHA HOOK
|
||||||
local ssmootha SMOOTHA
|
put-shapes : sStrand STROKE [CAP - SMOOTHA]
|
||||||
|
|
||||||
put-shapes : create-stroke
|
|
||||||
:.start-from [SB + OXHOOK] [CAP - HOOK]
|
|
||||||
:.set-width 0 STROKE
|
|
||||||
:.curve-to [MIDDLE - KAPPA_HOOK * [MIDDLE - SB]] CAPO MIDDLE CAPO
|
|
||||||
:.heads-to RIGHTWARD
|
|
||||||
:.arc-hv-to RIGHTSB [CAP - ssmootha]
|
|
||||||
:.to-outline
|
|
||||||
|
|
||||||
put-shapes : sStrand STROKE [CAP - ssmootha]
|
|
||||||
|
|
||||||
put-shapes : create-stroke
|
put-shapes : create-stroke
|
||||||
:.start-from SB 0
|
:.start-from SB 0
|
||||||
|
|
2
makefile
2
makefile
|
@ -1,5 +1,5 @@
|
||||||
SUPPORT_FILES = support/glyph.js support/stroke.js parameters.js
|
SUPPORT_FILES = support/glyph.js support/stroke.js parameters.js
|
||||||
GLYPH_SEGMENTS = glyphs/latin-capital.patel glyphs/latin-lower.patel glyphs/numbers.patel
|
GLYPH_SEGMENTS = glyphs/common-shapes.patel glyphs/latin-capital.patel glyphs/latin-lower.patel glyphs/numbers.patel
|
||||||
|
|
||||||
FILES = $(SUPPORT_FILES) buildglyphs.js
|
FILES = $(SUPPORT_FILES) buildglyphs.js
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue