added white suit card symbols, more operators, etc.

This commit is contained in:
be5invis 2017-08-25 16:10:54 +08:00
parent 6323f7d562
commit c15e5c140e
6 changed files with 106 additions and 53 deletions

View file

@ -137,14 +137,17 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
local g : create-glyph name [lambda] local g : create-glyph name [lambda]
if g : begin if g : begin
g.include t AS_BASE g.include t AS_BASE
set g.advanceWidth t.advanceWidth if (t <@ Glyph) : begin
set g.shortName t.shortName set g.advanceWidth t.advanceWidth
set g.cmpPriority t.cmpPriority set g.shortName t.shortName
set g.cmpPriority t.cmpPriority
if name : set dependencyProfile.(name) : getDependencyProfile g if name : set dependencyProfile.(name) : getDependencyProfile g
if (g && unicode) : begin if (g && unicode) : begin
g.assign-unicode unicode g.assign-unicode unicode
set unicodeGlyphs.(g.unicode.((g.unicode.length - 1))) g set unicodeGlyphs.(g.unicode.((g.unicode.length - 1))) g
return g return g
define [save-glyph name unicode g] : $save$.call g name unicode
### Spiro constructions ### Spiro constructions
# Basic knots # Basic knots
@ -184,7 +187,7 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
save 'space' ' ' save 'space' ' '
# IDKY, but wrapping "metrics" prevents Node.js on Arch modifying it. # IDKY, but wrapping "metrics" prevents Node.js on Arch modifying it.
define capture : object [metrics : Object.create metrics] $NamedParameterPair$ $donothing$ para recursive recursiveCodes variantSelector font glyphs glyphList unicodeGlyphs create-glyph $save$ spirofns markset MARK BASE AS_BASE ALSO_METRICS pickHash dependencyProfile getDependencyProfile buildFont newtemp tagged TempFont includeGlyphPart compsiteMarkSet define capture : object [metrics : Object.create metrics] $NamedParameterPair$ $donothing$ para recursive recursiveCodes variantSelector font glyphs glyphList unicodeGlyphs create-glyph $save$ save-glyph spirofns markset MARK BASE AS_BASE ALSO_METRICS pickHash dependencyProfile getDependencyProfile buildFont newtemp tagged TempFont includeGlyphPart compsiteMarkSet
### HERE WE GO ### HERE WE GO
set capture.commonShapes : [import './glyphs/common-shapes.js'].apply.call capture set capture.commonShapes : [import './glyphs/common-shapes.js'].apply.call capture

View file

@ -76,6 +76,7 @@ export : define [apply] : begin
define [hcombine newid unicode id1 id2 spacing] : create-glyph [fallback newid : 'hcombine_' + id1 + '_' + id2] : glyph-construction define [hcombine newid unicode id1 id2 spacing] : create-glyph [fallback newid : 'hcombine_' + id1 + '_' + id2] : glyph-construction
if unicode : assign-unicode unicode if unicode : assign-unicode unicode
include glyphs.(id1) AS_BASE include glyphs.(id1) AS_BASE
set-width glyphs.(id1).advanceWidth
apply-transform : Translate (-spacing) 0 apply-transform : Translate (-spacing) 0
include glyphs.(id2) include glyphs.(id2)
apply-transform : Translate (spacing / 2) 0 apply-transform : Translate (spacing / 2) 0

View file

@ -375,6 +375,14 @@ export : define [apply] : begin
line-to left (parenMid - squareRadius) line-to left (parenMid - squareRadius)
include FullWidthify include FullWidthify
save 'blacksquare' 0x25A0 save 'blacksquare' 0x25A0
sketch # smallblacksquare
local r : squareRadius * designParameters.geometric_small_x
start-from (MIDDLE - r) (parenMid + r)
line-to (MIDDLE + r) (parenMid + r)
line-to (MIDDLE + r) (parenMid - r)
line-to (MIDDLE - r) (parenMid - r)
include FullWidthify
save 'smallblacksquare' 0x25AA
sketch # blacktrianglerb sketch # blacktrianglerb
start-from right (parenMid + squareRadius) start-from right (parenMid + squareRadius)
line-to right (parenMid - squareRadius) line-to right (parenMid - squareRadius)
@ -497,7 +505,7 @@ export : define [apply] : begin
line-to [mix MIDDLE left (2 / 3)] parenMid line-to [mix MIDDLE left (2 / 3)] parenMid
save 'hwBlackLonzenge' save 'hwBlackLonzenge'
include FullWidthify include FullWidthify
save 'blackLonzenge' save 'blackLonzenge' 0x29EB
sketch # whiteLonzenge sketch # whiteLonzenge
define w : hollowSW * (WIDTH / shapeWidth) define w : hollowSW * (WIDTH / shapeWidth)
@ -616,6 +624,7 @@ export : define [apply] : begin
hollow 'hwbigwhitecircle' null 'hwbigblackcircle' [hollowScale (squareRadius * designParameters.geometric_large_x) 1] hollow 'hwbigwhitecircle' null 'hwbigblackcircle' [hollowScale (squareRadius * designParameters.geometric_large_x) 1]
hollow 'smallwhitecircle' null 'smallblackcircle' [hollowScale : squareRadius * designParameters.geometric_small_x] hollow 'smallwhitecircle' null 'smallblackcircle' [hollowScale : squareRadius * designParameters.geometric_small_x]
hollow 'hwsmallwhitecircle' null 'hwsmallblackcircle' [hollowScale (squareRadius * designParameters.geometric_small_x) 1] hollow 'hwsmallwhitecircle' null 'hwsmallblackcircle' [hollowScale (squareRadius * designParameters.geometric_small_x) 1]
hollow 'smallwhitesquare' 0x25AB 'smallblacksquare' [hollowScale : squareRadius * designParameters.geometric_small_x]
hollow 'hwwhitecircle' null 'hwblackcircle' hollow 'hwwhitecircle' null 'hwblackcircle'
let [s : hollowScale squareRadius nothing (hollowSW * [Math.sqrt 2])] : begin let [s : hollowScale squareRadius nothing (hollowSW * [Math.sqrt 2])] : begin
hollow 'hwwhitediamond' null 'hwblackdiamond' s hollow 'hwwhitediamond' null 'hwblackdiamond' s

View file

@ -197,7 +197,6 @@ export : define [apply] : begin
include : DotAt [mix SB RIGHTSB (5/6)] (parenMid - equalHalfSpace * 2.5) DOTRADIUS include : DotAt [mix SB RIGHTSB (5/6)] (parenMid - equalHalfSpace * 2.5) DOTRADIUS
save 'twodotapproxeq' 0x2252 save 'twodotapproxeq' 0x2252
sketch # multiply sketch # multiply
include markset.plus include markset.plus
local radius : (RIGHTSB - SB) / 2 local radius : (RIGHTSB - SB) / 2
@ -239,7 +238,7 @@ export : define [apply] : begin
local right : mix 0 FULLWIDTH (3 / 4) local right : mix 0 FULLWIDTH (3 / 4)
sketch sketch
set-width FULLWIDTH set-width FULLWIDTH
include : Ring (XH - O) (XH - radius * 2 + O) (MIDDLE - radius + O) (MIDDLE + radius - O) true include : Ring (XH - O) (XH - radius * 2 + O) (FULLWIDTH / 2 - radius + O) (FULLWIDTH / 2 + radius - O) true
include : Ring (radius * 2 - O) O (left - radius + O) (left + radius - O) true include : Ring (radius * 2 - O) O (left - radius + O) (left + radius - O) true
include : Ring (radius * 2 - O) O (right - radius + O) (right + radius - O) true include : Ring (radius * 2 - O) O (right - radius + O) (right + radius - O) true
save 'therefore' 0x2234 save 'therefore' 0x2234
@ -247,12 +246,12 @@ export : define [apply] : begin
set-width FULLWIDTH set-width FULLWIDTH
include : Ring (XH - O) (XH - radius * 2 + O) (left - radius + O) (left + radius - O) true include : Ring (XH - O) (XH - radius * 2 + O) (left - radius + O) (left + radius - O) true
include : Ring (XH - O) (XH - radius * 2 + O) (right - radius + O) (right + radius - O) true include : Ring (XH - O) (XH - radius * 2 + O) (right - radius + O) (right + radius - O) true
include : Ring (radius * 2 - O) O (MIDDLE - radius + O) (MIDDLE + radius - O) true include : Ring (radius * 2 - O) O (FULLWIDTH / 2 - radius + O) (FULLWIDTH / 2 + radius - O) true
save 'because' 0x2235 save 'because' 0x2235
sketch sketch
set-width FULLWIDTH set-width FULLWIDTH
include : Ring (PERIODRADIUS * 2 - O) O (MIDDLE - PERIODRADIUS + O) (MIDDLE + PERIODRADIUS - O) true include : Ring (PERIODRADIUS * 2 - O) O (FULLWIDTH / 2 - PERIODRADIUS + O) (FULLWIDTH / 2 + PERIODRADIUS - O) true
include : Ring (XH - O) (XH - PERIODRADIUS * 2 + O) (MIDDLE - PERIODRADIUS + O) (MIDDLE + PERIODRADIUS - O) true include : Ring (XH - O) (XH - PERIODRADIUS * 2 + O) (FULLWIDTH / 2 - PERIODRADIUS + O) (FULLWIDTH / 2 + PERIODRADIUS - O) true
save 'mathcolon' 0x2236 save 'mathcolon' 0x2236
sketch # coloncolon sketch # coloncolon
set-width FULLWIDTH set-width FULLWIDTH
@ -704,6 +703,15 @@ export : define [apply] : begin
include : LongSShape parenTop parenBot HOOK (HOOK * 0.75) OPERATORSTROKE include : LongSShape parenTop parenBot HOOK (HOOK * 0.75) OPERATORSTROKE
save 'integrate' 0x222B save 'integrate' 0x222B
dual 'doubleintegrate' 0x222C 'integrate' (0.5 * WIDTH) dual 'doubleintegrate' 0x222C 'integrate' (0.5 * WIDTH)
sketch
define [shape] : LongSShape parenTop parenBot HOOK (HOOK * 0.75) [adviceBlackness 3.75]
include [shape]
include : Translate (-WIDTH / 3) 0
include [shape]
include : Translate (-WIDTH / 3) 0
include [shape]
include : Translate (WIDTH / 3) 0
save 'tripleintegrate' 0x222D
sketch # ringintegrate sketch # ringintegrate
include glyphs.integrate include glyphs.integrate

View file

@ -33,60 +33,92 @@ export : define [apply] : begin
include : VBarRight [mix SB RIGHTSB 0.9] 0 CAP OPERATORSTROKE include : VBarRight [mix SB RIGHTSB 0.9] 0 CAP OPERATORSTROKE
include : HBar [mix SB RIGHTSB 0.1] ([mix SB RIGHTSB 0.9] - 1) [mix (OPERATORSTROKE / 2) (CAP - OPERATORSTROKE / 2) (tone / 4)] OPERATORSTROKE include : HBar [mix SB RIGHTSB 0.1] ([mix SB RIGHTSB 0.9] - 1) [mix (OPERATORSTROKE / 2) (CAP - OPERATORSTROKE / 2) (tone / 4)] OPERATORSTROKE
### # Suit card do "Suit card"
### symbol-block 'Suit Cards' local heartTop : mix parenMid parenTop 0.6
local heartTop : mix parenMid parenTop 0.6 local heartBot : mix parenMid parenBot 0.6
local heartBot : mix parenMid parenBot 0.6 local heartRight : mix RIGHTSB WIDTH 0.5
local heartLeft : mix SB 0 0.5
sketch # heart local sw : adviceBlackness 4.25
local y1 : mix heartBot heartTop 0.5 local y1 : mix heartBot heartTop 0.5
local y2 : mix heartBot heartTop 0.75 local y2 : mix heartBot heartTop 0.75
local y3 : mix heartBot heartTop 0.75 local y3 : mix heartBot heartTop 0.75
include : spiro-outline define [HeartInnerShape sw tip ext] : spiro-outline
corner MIDDLE heartBot corner MIDDLE (heartBot + sw * tip)
quadcontrols 1 (2 / 3) quadcontrols 1 (2 / 3)
g4 (RIGHTSB - O) y2 g4 (heartRight - O - sw) y2
arcvh arcvh
g4 [mix MIDDLE RIGHTSB 0.5] heartTop g4 [mix MIDDLE heartRight 0.5] (heartTop - sw * tip / 1.75)
archv archv
corner MIDDLE y3 if sw
: then : list
corner (MIDDLE + sw / 3) (y3 - sw * ext)
corner (MIDDLE - sw / 3) (y3 - sw * ext)
: else : corner MIDDLE (y3 - sw)
arcvh arcvh
g4 [mix MIDDLE SB 0.5] heartTop g4 [mix MIDDLE heartLeft 0.5] (heartTop - sw * tip / 1.75)
archv archv
g4 (SB + O) y2 g4 (heartLeft + O + sw) y2
quadcontrols 0 (1 / 3) quadcontrols 0 (1 / 3)
close close
save 'heart' 0x2665
sketch # spade
include glyphs.heart
apply-transform : Upright
apply-transform : Translate (-MIDDLE) (-heartBot)
apply-transform : Scale 1 (-0.75)
apply-transform : Translate MIDDLE heartTop
apply-transform : Italify
include : HBarBottom [mix SB RIGHTSB 0.25] [mix RIGHTSB SB 0.25] heartBot save-glyph 'heartSuit' 0x2665 : HeartInnerShape 0 0 0
include : VBar MIDDLE heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)] save-glyph 'whiteHeartSuit' 0x2661 : difference glyphs.heartSuit [HeartInnerShape sw 1.75 0.8]
save 'spade' 0x2660 save-glyph 'spadeSuit' 0x2660 : union
sketch
sketch # clubs include glyphs.heartSuit
local circleRadius : (heartTop - heartBot) * 0.2 apply-transform : Upright
include : RingAt MIDDLE (heartTop - circleRadius) circleRadius apply-transform : Translate (-MIDDLE) (-heartBot)
include : RingAt (SB + O + circleRadius) [mix heartBot heartTop 0.45] circleRadius apply-transform : Scale 1 (-0.75)
include : RingAt (RIGHTSB - O - circleRadius) [mix heartBot heartTop 0.45] circleRadius apply-transform : Translate MIDDLE heartTop
apply-transform : Italify
HBarBottom [mix SB RIGHTSB 0.25] [mix RIGHTSB SB 0.25] heartBot
VBar MIDDLE heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)]
include : HBarBottom [mix SB RIGHTSB 0.25] [mix RIGHTSB SB 0.25] heartBot save-glyph 'whiteSpadeSuit' 0x2664 : difference glyphs.spadeSuit : sketch
include : VBar MIDDLE heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)] include : HeartInnerShape sw 2 0
save 'clubs' 0x2663 apply-transform : Upright
apply-transform : Translate (-MIDDLE) (-heartBot)
sketch # diamond apply-transform : Scale 1 (-0.75)
start-from MIDDLE heartTop apply-transform : Translate MIDDLE heartTop
line-to RIGHTSB parenMid apply-transform : Italify
line-to MIDDLE heartBot
line-to SB parenMid local clubTopY : mix heartTop heartBot 0.22
save 'diamond' 0x2666 local clubTriangleHeight : (heartTop - heartBot) * 0.3
define [ClubTriangles r] : union
RingAt MIDDLE clubTopY r
RingAt (MIDDLE - clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) r
RingAt (MIDDLE + clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) r
spiro-outline
corner MIDDLE clubTopY
corner (MIDDLE - clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight)
corner (MIDDLE + clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight)
define [ClubShape r] : sketch
include : ClubTriangles r
include : HBarBottom [mix SB RIGHTSB 0.25] [mix RIGHTSB SB 0.25] heartBot
include : VBar MIDDLE heartBot [mix heartBot heartTop 0.45]
local circleRadius : (heartTop - heartBot) * 0.18
save-glyph 'clubSuit' 0x2663 : ClubShape circleRadius
save-glyph 'whiteClubSuit' 0x2667 : sketch
local ro : circleRadius + sw / 2
local ri : circleRadius - sw / 2
include : difference [ClubShape ro] [ClubTriangles ri]
save-glyph 'diamondSuit' 0x2666 : sketch
start-from MIDDLE heartTop
line-to (heartRight - O) parenMid
line-to MIDDLE heartBot
line-to (heartLeft + O) parenMid
save-glyph 'whiteDiamondSuit' 0x2662 : intersection glyphs.diamondSuit
union
dispiro [widths.rhs sw] [flat MIDDLE heartTop] [curl (heartRight - O) parenMid]
dispiro [widths.rhs sw] [flat (heartRight - O) parenMid] [curl MIDDLE heartBot]
dispiro [widths.rhs sw] [flat MIDDLE heartBot] [curl (heartLeft + O) parenMid]
dispiro [widths.rhs sw] [flat (heartLeft + O) parenMid] [curl MIDDLE heartTop]
### symbol-block 'Planets' ### symbol-block 'Planets'
sketch # venus sketch # venus

View file

@ -148,7 +148,7 @@ define-macro glyph-module-entry : syntax-rules
for [local j 0] (j < opts.length) [inc j] : if optionalImports.(opts.(j)) : optionalImportStatements.push optionalImports.(opts.(j)) for [local j 0] (j < opts.length) [inc j] : if optionalImports.(opts.(j)) : optionalImportStatements.push optionalImports.(opts.(j))
dirty `[begin \\ dirty `[begin \\
define $capture this define $capture this
define [object metrics $NamedParameterPair$ $donothing$ para recursive recursiveCodes variantSelector font glyphs glyphList unicodeGlyphs create-glyph $save$ spirofns markset MARK BASE AS_BASE ALSO_METRICS pickHash dependencyProfile getDependencyProfile buildFont newtemp tagged TempFont includeGlyphPart compsiteMarkSet] $capture define [object metrics $NamedParameterPair$ $donothing$ para recursive recursiveCodes variantSelector font glyphs glyphList unicodeGlyphs create-glyph $save$ save-glyph spirofns markset MARK BASE AS_BASE ALSO_METRICS pickHash dependencyProfile getDependencyProfile buildFont newtemp tagged TempFont includeGlyphPart compsiteMarkSet] $capture
define [object define [object
UPM WIDTH SB CAP XH DESCENDER CONTRAST UPM WIDTH SB CAP XH DESCENDER CONTRAST
parenMid parenTop parenBot operTop operBot plusTop plusBot operMid Italify Upright Scale Translate Rotate globalTransform parenMid parenTop parenBot operTop operBot plusTop plusBot operMid Italify Upright Scale Translate Rotate globalTransform