diff --git a/buildglyphs.ptl b/buildglyphs.ptl index df69c36cb..460c23ed3 100644 --- a/buildglyphs.ptl +++ b/buildglyphs.ptl @@ -137,14 +137,17 @@ export as build : define [buildFont para recursive recursiveCodes] : begin local g : create-glyph name [lambda] if g : begin g.include t AS_BASE - set g.advanceWidth t.advanceWidth - set g.shortName t.shortName - set g.cmpPriority t.cmpPriority + if (t <@ Glyph) : begin + set g.advanceWidth t.advanceWidth + set g.shortName t.shortName + set g.cmpPriority t.cmpPriority if name : set dependencyProfile.(name) : getDependencyProfile g if (g && unicode) : begin g.assign-unicode unicode set unicodeGlyphs.(g.unicode.((g.unicode.length - 1))) g return g + + define [save-glyph name unicode g] : $save$.call g name unicode ### Spiro constructions # Basic knots @@ -184,7 +187,7 @@ export as build : define [buildFont para recursive recursiveCodes] : begin save 'space' ' ' # 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 set capture.commonShapes : [import './glyphs/common-shapes.js'].apply.call capture diff --git a/glyphs/common-shapes.ptl b/glyphs/common-shapes.ptl index 6e6d3fdef..9b6a91927 100644 --- a/glyphs/common-shapes.ptl +++ b/glyphs/common-shapes.ptl @@ -76,6 +76,7 @@ export : define [apply] : begin define [hcombine newid unicode id1 id2 spacing] : create-glyph [fallback newid : 'hcombine_' + id1 + '_' + id2] : glyph-construction if unicode : assign-unicode unicode include glyphs.(id1) AS_BASE + set-width glyphs.(id1).advanceWidth apply-transform : Translate (-spacing) 0 include glyphs.(id2) apply-transform : Translate (spacing / 2) 0 diff --git a/glyphs/symbol-geometric.ptl b/glyphs/symbol-geometric.ptl index b9c838579..45b36daae 100644 --- a/glyphs/symbol-geometric.ptl +++ b/glyphs/symbol-geometric.ptl @@ -375,6 +375,14 @@ export : define [apply] : begin line-to left (parenMid - squareRadius) include FullWidthify 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 start-from right (parenMid + squareRadius) line-to right (parenMid - squareRadius) @@ -497,7 +505,7 @@ export : define [apply] : begin line-to [mix MIDDLE left (2 / 3)] parenMid save 'hwBlackLonzenge' include FullWidthify - save 'blackLonzenge' + save 'blackLonzenge' 0x29EB sketch # whiteLonzenge 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 'smallwhitecircle' null 'smallblackcircle' [hollowScale : squareRadius * designParameters.geometric_small_x] 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' let [s : hollowScale squareRadius nothing (hollowSW * [Math.sqrt 2])] : begin hollow 'hwwhitediamond' null 'hwblackdiamond' s diff --git a/glyphs/symbol-math.ptl b/glyphs/symbol-math.ptl index 302e8e8e8..13e5a1bbe 100644 --- a/glyphs/symbol-math.ptl +++ b/glyphs/symbol-math.ptl @@ -197,7 +197,6 @@ export : define [apply] : begin include : DotAt [mix SB RIGHTSB (5/6)] (parenMid - equalHalfSpace * 2.5) DOTRADIUS save 'twodotapproxeq' 0x2252 - sketch # multiply include markset.plus local radius : (RIGHTSB - SB) / 2 @@ -239,7 +238,7 @@ export : define [apply] : begin local right : mix 0 FULLWIDTH (3 / 4) sketch 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 (right - radius + O) (right + radius - O) true save 'therefore' 0x2234 @@ -247,12 +246,12 @@ export : define [apply] : begin 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) (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 sketch set-width FULLWIDTH - include : Ring (PERIODRADIUS * 2 - O) O (MIDDLE - PERIODRADIUS + O) (MIDDLE + PERIODRADIUS - O) true - include : Ring (XH - O) (XH - PERIODRADIUS * 2 + 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) (FULLWIDTH / 2 - PERIODRADIUS + O) (FULLWIDTH / 2 + PERIODRADIUS - O) true save 'mathcolon' 0x2236 sketch # coloncolon set-width FULLWIDTH @@ -704,6 +703,15 @@ export : define [apply] : begin include : LongSShape parenTop parenBot HOOK (HOOK * 0.75) OPERATORSTROKE save 'integrate' 0x222B 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 include glyphs.integrate diff --git a/glyphs/symbol-other.ptl b/glyphs/symbol-other.ptl index 1b0275119..c678d544c 100644 --- a/glyphs/symbol-other.ptl +++ b/glyphs/symbol-other.ptl @@ -33,60 +33,92 @@ export : define [apply] : begin 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 - ### # Suit card - ### symbol-block 'Suit Cards' - local heartTop : mix parenMid parenTop 0.6 - local heartBot : mix parenMid parenBot 0.6 - - sketch # heart + do "Suit card" + local heartTop : mix parenMid parenTop 0.6 + local heartBot : mix parenMid parenBot 0.6 + local heartRight : mix RIGHTSB WIDTH 0.5 + local heartLeft : mix SB 0 0.5 + local sw : adviceBlackness 4.25 + local y1 : mix heartBot heartTop 0.5 local y2 : mix heartBot heartTop 0.75 local y3 : mix heartBot heartTop 0.75 - - include : spiro-outline - corner MIDDLE heartBot + + define [HeartInnerShape sw tip ext] : spiro-outline + corner MIDDLE (heartBot + sw * tip) quadcontrols 1 (2 / 3) - g4 (RIGHTSB - O) y2 + g4 (heartRight - O - sw) y2 arcvh - g4 [mix MIDDLE RIGHTSB 0.5] heartTop + g4 [mix MIDDLE heartRight 0.5] (heartTop - sw * tip / 1.75) 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 - g4 [mix MIDDLE SB 0.5] heartTop + g4 [mix MIDDLE heartLeft 0.5] (heartTop - sw * tip / 1.75) archv - g4 (SB + O) y2 + g4 (heartLeft + O + sw) y2 quadcontrols 0 (1 / 3) 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 - include : VBar MIDDLE heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)] - save 'spade' 0x2660 - - sketch # clubs - local circleRadius : (heartTop - heartBot) * 0.2 - include : RingAt MIDDLE (heartTop - circleRadius) circleRadius - include : RingAt (SB + O + circleRadius) [mix heartBot heartTop 0.45] circleRadius - include : RingAt (RIGHTSB - O - circleRadius) [mix heartBot heartTop 0.45] circleRadius + save-glyph 'heartSuit' 0x2665 : HeartInnerShape 0 0 0 + save-glyph 'whiteHeartSuit' 0x2661 : difference glyphs.heartSuit [HeartInnerShape sw 1.75 0.8] + save-glyph 'spadeSuit' 0x2660 : union + sketch + include glyphs.heartSuit + apply-transform : Upright + apply-transform : Translate (-MIDDLE) (-heartBot) + apply-transform : Scale 1 (-0.75) + 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 - include : VBar MIDDLE heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)] - save 'clubs' 0x2663 - - sketch # diamond - start-from MIDDLE heartTop - line-to RIGHTSB parenMid - line-to MIDDLE heartBot - line-to SB parenMid - save 'diamond' 0x2666 + save-glyph 'whiteSpadeSuit' 0x2664 : difference glyphs.spadeSuit : sketch + include : HeartInnerShape sw 2 0 + apply-transform : Upright + apply-transform : Translate (-MIDDLE) (-heartBot) + apply-transform : Scale 1 (-0.75) + apply-transform : Translate MIDDLE heartTop + apply-transform : Italify + + local clubTopY : mix heartTop heartBot 0.22 + 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' sketch # venus diff --git a/meta/macros.ptl b/meta/macros.ptl index d758d9f9b..653ba2dfe 100644 --- a/meta/macros.ptl +++ b/meta/macros.ptl @@ -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)) dirty `[begin \\ 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 UPM WIDTH SB CAP XH DESCENDER CONTRAST parenMid parenTop parenBot operTop operBot plusTop plusBot operMid Italify Upright Scale Translate Rotate globalTransform