From df3bf928ace6e4c418cbaabe0999723d576e80c4 Mon Sep 17 00:00:00 2001 From: Belleve Invis Date: Mon, 20 Jan 2020 23:55:36 -0800 Subject: [PATCH] Add more math symbols --- gen/build-glyphs.ptl | 3 + glyphs/autobuild-enclosure.ptl | 4 +- glyphs/autobuild-transformed.ptl | 49 +- glyphs/common-shapes.ptl | 25 +- glyphs/symbol-geometric.ptl | 47 +- glyphs/symbol-math.ptl | 16 +- glyphs/symbol-mosaic.ptl | 3 + glyphs/symbol-other.ptl | 1395 +++++++++++++++--------------- glyphs/symbol-punctuation.ptl | 9 +- meta/macros.ptl | 2 +- 10 files changed, 828 insertions(+), 725 deletions(-) diff --git a/gen/build-glyphs.ptl b/gen/build-glyphs.ptl index 5f564afb1..5f4459121 100644 --- a/gen/build-glyphs.ptl +++ b/gen/build-glyphs.ptl @@ -190,12 +190,15 @@ export as build : define [buildFont para recursive recursiveCodes] : begin line-to (RIGHTSB - STROKE) STROKE line-to (RIGHTSB - STROKE) (CAP - STROKE) line-to (SB + STROKE) (CAP - STROKE) + set currentGlyph.cmpPriority (9999) save '.notdef' + sketch # .null set-width 0 set currentGlyph.cmpPriority (9998) save '.null' + sketch # nonmarkingreturn set-width WIDTH set currentGlyph.cmpPriority (-1) diff --git a/glyphs/autobuild-enclosure.ptl b/glyphs/autobuild-enclosure.ptl index 99f7fdc42..b503c9b74 100644 --- a/glyphs/autobuild-enclosure.ptl +++ b/glyphs/autobuild-enclosure.ptl @@ -44,7 +44,7 @@ export : define [apply] : begin apply-transform : Translate (width / 2) (CAP / 2 * dscale) apply-transform : Italify set currentGlyph.cmpPriority 12 - refair this + refair currentGlyph set-width 0 return lg @@ -230,7 +230,7 @@ export : define [apply] : begin apply-transform : Translate (width / 2) (symbolMid * pscale - (CAP / 2 - shift) * dscale) apply-transform : Italify set currentGlyph.cmpPriority 11 - refair this + refair currentGlyph set-width 0 sketch diff --git a/glyphs/autobuild-transformed.ptl b/glyphs/autobuild-transformed.ptl index 3d13dd87a..f55ac53ce 100644 --- a/glyphs/autobuild-transformed.ptl +++ b/glyphs/autobuild-transformed.ptl @@ -32,7 +32,7 @@ export : define [apply] : begin apply-transform [Translate middle (CAP + ACCENT / 2)] true apply-transform [Italify] true if pri : set currentGlyph.cmpPriority pri - refair this + refair currentGlyph define [createSubscripts records] : begin local pendingGlyphs : records.map : [record] => record.1 @@ -52,7 +52,7 @@ export : define [apply] : begin apply-transform [Translate middle (DESCENDER / 2)] true apply-transform [Italify] true if pri : set currentGlyph.cmpPriority pri - refair this + refair currentGlyph define [createSMCPs records] : begin local pendingGlyphs : records.map : [record] => record.1 @@ -89,7 +89,7 @@ export : define [apply] : begin apply-transform : Scale 0.4 apply-transform : Translate markMiddle aboveMarkBot apply-transform : Italify - refair this + refair currentGlyph set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop if [not recursive] : createSuperscripts : list @@ -375,7 +375,7 @@ export : define [apply] : begin apply-transform : Scale (CAP / [fallback height CAP] * scaleFactor) apply-transform : Translate MIDDLE (symbolMid + dist / 2) apply-transform : Italify - refair this + refair currentGlyph if [not glyphs.(denid + suffix + ".denpart")] : begin save-glyph (denid + suffix + ".denpart") null : sketch @@ -385,7 +385,7 @@ export : define [apply] : begin apply-transform : Scale (CAP / [fallback height CAP] * scaleFactor) apply-transform : Translate MIDDLE (symbolMid - CAP * scaleFactor - dist / 2) apply-transform : Italify - refair this + refair currentGlyph foreach {unicode numid denid height} [items-of records] : do save-glyph [suggestName : numid + 'over' + denid] unicode : glyph-construction @@ -499,3 +499,42 @@ export : define [apply] : begin if [not recursive] : createLigatures 0.7 0.8 0.75 0.9 : list list 0x2103 'degree' 'C' list 0x2109 'degree' 'F' + + + define [createAccentedEquals crowd scale records] : begin + local pendingGlyphs : records.map : [record] => record.2 + local miniatureFont : Miniature + glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]] + crowd -- crowd + scale -- scale + unfair -- true + mono -- true + foreach {unicode base upper} [items-of records] : do + local innerGlyphName : suggestName : "inner_" + base + "_" + [upper.join "_"] + local fullGlyphName : suggestName : "comb_" + base + "_" + [upper.join "_"] + create-glyph innerGlyphName : glyph-construction + local totalWidth 0 + foreach [glyphid : items-of upper] : begin + local subGlyph miniatureFont.(glyphid) + include subGlyph + apply-transform : Translate (-subGlyph.advanceWidth) 0 + set totalWidth : totalWidth + subGlyph.advanceWidth + + apply-transform : Upright + apply-transform : Translate (totalWidth / 2) 0 + apply-transform : Scale scale + apply-transform : Translate MIDDLE aboveMarkBot + apply-transform : Italify + refair currentGlyph + + create-glyph fullGlyphName : glyph-construction + if unicode : assign-unicode unicode + include glyphs.(innerGlyphName) + include glyphs.(base) + + if [not recursive] : createAccentedEquals 7 0.4 : list + list 0x2257 "equal" {"o"} + list 0x225e "equal" {"m"} + list 0x225F "equal" {"question"} + if [not recursive] : createAccentedEquals 8 0.3 : list + list 0x225d "equal" {"d" "e" "f"} diff --git a/glyphs/common-shapes.ptl b/glyphs/common-shapes.ptl index fdd1b1213..3bc6e7972 100644 --- a/glyphs/common-shapes.ptl +++ b/glyphs/common-shapes.ptl @@ -775,4 +775,27 @@ export : define [apply] : begin include : difference background [union.apply null candidates] include overlay - return [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned dual hcombine vdual vcombine fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor] + define [CreateWaveShape dist sw] : begin + define WaveResolution 8 + define WaveMagnitude : dist * (3 / 4) - sw / 2 + define WaveAdj : TANSLANT * WaveMagnitude * (-0.75) + define [WaveShapeImpl] : params [left right ts te xsJoin xfJoin] : glyph-construction + local resolution : Math.ceil (WaveResolution * (te - ts)) + local knots {} + foreach [pr : range 0 till resolution] : begin + local theta : [mix ts te (pr / resolution)] * Math.PI * 2 + local waveRelY : (-1) * [Math.sin theta] - 0.075 * [Math.sin (theta * 3)] + local flat : [Math.abs ([mix ts te (pr / resolution)] * 2 % 1)] < 1 / WaveResolution + knots.push : g2 + (WaveAdj * waveRelY) + [mix left right (pr / resolution)] + symbolMid + WaveMagnitude * waveRelY + include : dispiro + widths.center sw + if (xsJoin !== nothing) {[straight.right.start xsJoin symbolMid]} {} + begin knots + if (xfJoin !== nothing) {[straight.right.end xfJoin symbolMid]} {} + + define [WaveShape] : params [left right xsJoin xfJoin [unitWidth WIDTH]] : WaveShapeImpl (unitWidth * -left) (unitWidth * (1 + right)) (-left * 2) (2 + right * 2) xsJoin xfJoin + return WaveShape + + return [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned dual hcombine vdual vcombine fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor CreateWaveShape] diff --git a/glyphs/symbol-geometric.ptl b/glyphs/symbol-geometric.ptl index bca0af752..3df3c39ec 100644 --- a/glyphs/symbol-geometric.ptl +++ b/glyphs/symbol-geometric.ptl @@ -8,13 +8,12 @@ import [designParameters] from '../meta/aesthetics' export : define [apply] : begin glyph-module-entry commonShapes overmarks - define WidthKinds {{'.hwid' WIDTH}} - if (para.spacing > 0) : WidthKinds.push {'.fwid' FULLWIDTH0} + define WidthKinds {{'.hwid' WIDTH WIDTH} {'.fwid' FULLWIDTH0 (FULLWIDTH0 / 2)}} local exportArrowShape nothing ### Arrowheads - foreach {suffix MosaicWidth} [items-of WidthKinds] : do 'Arrows' + foreach {suffix MosaicWidth MosaicUnitWidth} [items-of WidthKinds] : do 'Arrows' define [MangleUnicode unicode] : if (MosaicWidth == FULLWIDTH2) unicode nothing define [MangleName name] : name + suffix @@ -257,6 +256,45 @@ export : define [apply] : begin arrow [HalfArrowShape LHSHalfArrowHead] [MangleName 'arrowdownHL'] [MangleUnicode 0x21C2] arrowMidX arrowTop arrowMidX arrowBot arrow [HalfArrowShape RHSHalfArrowHead] [MangleName 'arrowdownHR'] [MangleUnicode 0x21C3] arrowMidX arrowTop arrowMidX arrowBot + do "Wave arrows" + define WaveShape : CreateWaveShape + doubleArrowStemWidth / 2 + Math.min OPERATORSTROKE (doubleArrowStemWidth / 3) + define rightTBias : (MosaicWidth / MosaicUnitWidth) - 1 + define freeCoT : arrowSB / MosaicWidth + define connectedCoT : (arrowSB / MosaicWidth) + (11 / 32) + sketch + set-width MosaicWidth + include : WaveShape + left -- (-connectedCoT) + right -- (rightTBias - connectedCoT) + xsJoin -- (arrowSB - o) + xfJoin -- (arrowRSB + o) + unitWidth -- MosaicUnitWidth + include : ArrowHead arrowSB symbolMid arrowRSB symbolMid + include : ArrowHead arrowRSB symbolMid arrowSB symbolMid + save [MangleName 'waveArrowLeftRight'] [MangleUnicode 0x21AD] + + sketch + set-width MosaicWidth + include : WaveShape + left -- (-connectedCoT) + right -- (rightTBias - freeCoT) + xsJoin -- (arrowSB - o) + unitWidth -- MosaicUnitWidth + include : ArrowHead arrowRSB symbolMid arrowSB symbolMid + save [MangleName 'waveArrowLeft'] [MangleUnicode 0x219C] + + sketch + set-width MosaicWidth + include : WaveShape + left -- (-freeCoT) + right -- (rightTBias - connectedCoT) + xfJoin -- (arrowRSB + o) + unitWidth -- MosaicUnitWidth + include : ArrowHead arrowSB symbolMid arrowRSB symbolMid + save [MangleName 'waveArrowRight'] [MangleUnicode 0x219D] + arrow [ThickArrowShape 'white'] [MangleName 'uni21E6'] [MangleUnicode 0x21E6] arrowRSB symbolMid arrowSB symbolMid arrow [ThickArrowShape 'white'] [MangleName 'uni21E7'] [MangleUnicode 0x21E7] arrowMidX arrowBot arrowMidX arrowTop arrow [ThickArrowShape 'white'] [MangleName 'uni21E8'] [MangleUnicode 0x21E8] arrowSB symbolMid arrowRSB symbolMid @@ -353,6 +391,9 @@ export : define [apply] : begin if (MosaicWidth == FULLWIDTH2) : set exportArrowShape ArrowShape + alias 'longArrowLeft' 0x27F5 'arrowleft.fwid' + alias 'longArrowRight' 0x27F6 'arrowright.fwid' + ### Standard geometric shapes foreach {suffix MosaicWidth} [items-of WidthKinds] : do 'Geometric' define [MangleUnicode unicode] : if (MosaicWidth == FULLWIDTH2) unicode nothing diff --git a/glyphs/symbol-math.ptl b/glyphs/symbol-math.ptl index ed2658232..f2cd034c1 100644 --- a/glyphs/symbol-math.ptl +++ b/glyphs/symbol-math.ptl @@ -68,7 +68,7 @@ export : define [apply] : begin apply-transform : Scale s apply-transform : Translate (fullWidth / 2) symbolMid apply-transform : Italify - refair this + refair currentGlyph save 'infty' 0x221E sketch # propto @@ -79,7 +79,7 @@ export : define [apply] : begin apply-transform : Scale s apply-transform : Translate (fullWidth / 2) symbolMid apply-transform : Italify - refair this + refair currentGlyph save 'propto' 0x221D sketch # partial @@ -191,6 +191,9 @@ export : define [apply] : begin include markset.plus include : HBar SB RIGHTSB symbolMid OPERATORSTROKE save 'minus' 0x2212 + include : DotAt MIDDLE plusTop DOTRADIUS + save 'minusDot' 0x2238 + sketch # innerMinus include markset.plus include : HBar SB RIGHTSB symbolMid GEOMETRYSTROKE @@ -287,7 +290,7 @@ export : define [apply] : begin local sbSquash 0.5 - local delta : Math.max 0 : WIDTH / 2 - DOTRADIUS + SB * sbSquash + local delta : Math.max 0 : WIDTH / 2 - DOTRADIUS - SB * sbSquash apply-transform : Upright apply-transform : Translate (-delta) (symbolMid - XH / 2) apply-transform : Italify @@ -475,7 +478,11 @@ export : define [apply] : begin sketch # cup include : UShape operTop operBot OPERATORSTROKE true save 'cup' 0x222A + branch + include : DotAt MIDDLE (operBot + SMOOTH) [Math.min DOTRADIUS ((RIGHTSB - SB - OPERATORSTROKE * HVCONTRAST * 2) * (1 / 3))] + save 'cupDot' 0x228E turned 'cap' 0x2229 'cup' MIDDLE symbolMid + turned 'capDot' 0x2A40 'cupDot' MIDDLE symbolMid sketch # squareCap include : PiShape operTop operBot (shrinkrate -- 0) (_fine -- OPERATORSTROKE) (div -- 1) @@ -547,6 +554,9 @@ export : define [apply] : begin include : HBarBottom SB RIGHTSB 0 OPERATORSTROKE include : VBar MIDDLE (symbolMid * 2) 0 OPERATORSTROKE save 'perpendicular' 0x27C2 + sketch # endOfProof + include : Rect tackTop tackBot SB RIGHTSB + save 'endOfProof' 0x220E do "Comparison" # Less and Greater diff --git a/glyphs/symbol-mosaic.ptl b/glyphs/symbol-mosaic.ptl index d1360dc6b..6dce68312 100644 --- a/glyphs/symbol-mosaic.ptl +++ b/glyphs/symbol-mosaic.ptl @@ -294,6 +294,7 @@ export : define [apply] : begin set-width MosaicWidth include : Shade 8 FillMedium : PatternPolygon22 bits save [BEGlyphName unicode] [MangleUnicode unicode] + define [InverseMediumShade unicode bits coBits] : sketch set-width MosaicWidth include : Shade (-8) (1 - FillMedium) : PatternPolygon22 bits @@ -301,6 +302,7 @@ export : define [apply] : begin FillBlock 0 1 0 1 PatternPolygon22 bits save [BEGlyphName unicode] [MangleUnicode unicode] + MediumShade 0x2592 {1 3 9 7} MediumShade 0x1FB8C {1 2 8 7} MediumShade 0x1FB8D {2 3 9 8} @@ -325,6 +327,7 @@ export : define [apply] : begin set-width MosaicWidth include : Shade (-4) FillHeavy save [MangleName 'upperLeftToLowerRightFill'] [MangleUnicode 0x1FB98] + sketch # upperRightToLowerLeftFill set-width MosaicWidth include : Shade 4 FillHeavy diff --git a/glyphs/symbol-other.ptl b/glyphs/symbol-other.ptl index a9b117e9a..d9f78b225 100644 --- a/glyphs/symbol-other.ptl +++ b/glyphs/symbol-other.ptl @@ -1,708 +1,689 @@ -###### Other symbols -$$include '../meta/macros.ptl' - -import [mix linreg clamp fallback] from '../support/utils' -import [designParameters] from '../meta/aesthetics' -import '../support/transform' as Transform -import '../support/mask-bit' as maskBit - - -export : define [apply] : begin - glyph-module-entry commonShapes overmarks geometricSymbols - - ### # IPA tonal marks - ### symbol-block 'Phonetic Symbols' - local triangleSize : Math.min (PERIODRADIUS) (XH / 5) - - sketch # trianglecolon - start-from (MIDDLE - triangleSize * 1.35) XH - line-to MIDDLE (XH - triangleSize * 2.75) - line-to (MIDDLE + triangleSize * 1.35) XH - start-from (MIDDLE - triangleSize * 1.35) 0 - line-to MIDDLE (0 + triangleSize * 2.75) - line-to (MIDDLE + triangleSize * 1.35) 0 - - save 'trianglecolon' 0x2D0 - - sketch # halftrianglecolon - start-from (MIDDLE - triangleSize * 1.35) XH - line-to MIDDLE (XH - triangleSize * 2.75) - line-to (MIDDLE + triangleSize * 1.35) XH - save 'halftrianglecolon' 0x2D1 - - foreach tone [range 4 downtill 0] : begin - create-glyph ('tone' + tone) : glyph-construction - assign-unicode (0x2E5 + 4 - tone) - 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 - - do "Suit card" - local df : DivFrame para.diversityM - local heartTop : mix symbolMid pictTop 0.75 - local heartBot : mix symbolMid pictBot 0.75 - local heartRight : df.middle + [mix RIGHTSB WIDTH (1 / 2)] - MIDDLE - local heartLeft : df.middle - (heartRight - df.middle) - 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 - - define [wrap g] : glyph-construction - set-width df.width - include g AS_BASE - - define [HeartInnerShape sw tip ext] : spiro-outline - corner df.middle (heartBot + sw * tip) - quadcontrols 1 (2 / 3) - g4 (heartRight - O - sw) y2 - arcvh - g4 [mix df.middle heartRight 0.5] (heartTop - sw * tip / 1.75) - archv - if sw - : then : list - corner (df.middle + sw / 3) (y3 - sw * ext) - corner (df.middle - sw / 3) (y3 - sw * ext) - : else : corner df.middle (y3 - sw) - arcvh - g4 [mix df.middle heartLeft 0.5] (heartTop - sw * tip / 1.75) - archv - g4 (heartLeft + O + sw) y2 - quadcontrols 0 (1 / 3) - close - - save-glyph 'heartSuit' 0x2665 : wrap : HeartInnerShape 0 0 0 - save-glyph 'whiteHeartSuit' 0x2661 : wrap : difference glyphs.heartSuit [HeartInnerShape sw 1.75 0.8] - save-glyph 'spadeSuit' 0x2660 : wrap : union - sketch - include glyphs.heartSuit - apply-transform : Upright - apply-transform : Translate (-df.middle) (-heartBot) - apply-transform : Scale 1 (-0.75) - apply-transform : Translate df.middle heartTop - apply-transform : Italify - HBarBottom [mix SB df.rightSB 0.25] [mix df.rightSB SB 0.25] heartBot sw - VBar df.middle heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)] sw - - save-glyph 'whiteSpadeSuit' 0x2664 : wrap : difference glyphs.spadeSuit : sketch - include : HeartInnerShape sw 2 0 - apply-transform : Upright - apply-transform : Translate (-df.middle) (-heartBot) - apply-transform : Scale 1 (-0.75) - apply-transform : Translate df.middle heartTop - apply-transform : Italify - - local clubTopY : mix heartTop heartBot 0.22 - local clubTriangleHeight : (heartTop - heartBot) * 0.3 - define [ClubTriangles r] : union - RingAt df.middle clubTopY r - RingAt (df.middle - clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) r - RingAt (df.middle + clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) r - spiro-outline - corner df.middle clubTopY - corner (df.middle - clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) - corner (df.middle + clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) - - define [ClubShape r] : sketch - include : ClubTriangles r - include : HBarBottom [mix SB df.rightSB 0.25] [mix df.rightSB SB 0.25] heartBot sw - include : VBar df.middle heartBot [mix heartBot heartTop 0.45] sw - - local circleRadius : (heartTop - heartBot) * 0.18 - save-glyph 'clubSuit' 0x2663 : wrap : ClubShape circleRadius - save-glyph 'whiteClubSuit' 0x2667 : wrap : sketch - local ro : circleRadius + sw / 2 - local ri : circleRadius - sw / 2 - include : difference [ClubShape ro] [ClubTriangles ri] - - save-glyph 'diamondSuit' 0x2666 : wrap : sketch - start-from df.middle heartTop - line-to (heartRight - O) symbolMid - line-to df.middle heartBot - line-to (heartLeft + O) symbolMid - - save-glyph 'whiteDiamondSuit' 0x2662 : wrap : intersection glyphs.diamondSuit - union - dispiro [widths.rhs sw] [flat df.middle heartTop] [curl (heartRight - O) symbolMid] - dispiro [widths.rhs sw] [flat (heartRight - O) symbolMid] [curl df.middle heartBot] - dispiro [widths.rhs sw] [flat df.middle heartBot] [curl (heartLeft + O) symbolMid] - dispiro [widths.rhs sw] [flat (heartLeft + O) symbolMid] [curl df.middle heartTop] - - ### symbol-block 'Planets' - sketch # venus - local obot : pictTop - RIGHTSB + SB - include : OShape pictTop obot SB RIGHTSB OPERATORSTROKE - include : VBar MIDDLE pictBot obot OPERATORSTROKE - include : HBar SB RIGHTSB [mix pictBot (obot + OPERATORSTROKE) 0.5] OPERATORSTROKE - - save 'venus' 0x2640 - turned 'earth' 0x2641 'venus' MIDDLE symbolMid - - sketch # mars - local otop : pictBot + RIGHTSB - SB - include : OShape otop pictBot SB RIGHTSB OPERATORSTROKE - include : ArrowShape MIDDLE (otop - OPERATORSTROKE / 3) MIDDLE pictTop ((RIGHTSB - SB) * 0.4) - save 'mars' 0x2642 - - ### symbol-block 'Musical' - do "Musical Notations" - define fine : adviceBlackness 6 - define noteSize : WIDTH * 0.4 + fine / 2 - define noteCompress 0.8 - define commonNoteBottom : pictBot + noteCompress / 2 * noteSize - define [BandShape z1 z2 l r h] : begin - local slope : (z2.y - z1.y) / (z2.x - z1.x) - local yl : z1.y + (l - z1.x) * slope - local yr : z1.y + (r - z1.x) * slope - return : spiro-outline - corner l yl - corner r yr - corner r (yr + h) - corner l (yl + h) - define [MusicalNoteAt size x y] : sketch - include : Ring (- noteCompress / 2 * size) (noteCompress / 2 * size) (-size) 0 - include : Upright - include : new Transform 1 0 0.15 1 0 0 - include : Translate x y - include : Italify - save-glyph 'crotchet' 0x2669 : union - MusicalNoteAt noteSize (MIDDLE + noteSize / 6 + fine / 2 * HVCONTRAST) commonNoteBottom - VBar (MIDDLE + noteSize / 6) commonNoteBottom pictTop fine - save-glyph 'quaver' 0x266A : sketch - local x3 : mix MIDDLE RIGHTSB 0.35 - local y3 : mix pictBot pictTop 0.25 - local y2 : mix y3 pictTop 0.25 - include : union - MusicalNoteAt noteSize MIDDLE commonNoteBottom - VBarRight MIDDLE commonNoteBottom pictTop fine - dispiro - widths.rhs fine - g4.down.start MIDDLE pictTop - g4.down.mid RIGHTSB y2 - g4 x3 y3 - do "Beamed Notes" - local x1 : MIDDLE - noteSize / 6 - local x2 : x1 + noteSize * 7 / 6 - local deltaY : noteCompress * noteSize / 2 - local lb1 : pictBot + noteCompress / 2 * noteSize - local bandWidth : noteSize * noteCompress * 0.75 - save-glyph 'beamQuaver' 0x266B : difference - union - MusicalNoteAt noteSize x1 commonNoteBottom - VBarRight x1 commonNoteBottom (pictTop - deltaY) fine - MusicalNoteAt noteSize x2 (commonNoteBottom + deltaY) - VBarRight x2 (commonNoteBottom + deltaY) pictTop fine - BandShape - object [x x1] [y : pictTop - deltaY] - object [x x2] [y pictTop] - x1 - fine * HVCONTRAST - x2 + 0 - 0 - bandWidth - BandShape - object [x x1] [y : pictTop - deltaY] - object [x x2] [y pictTop] - x1 - fine * HVCONTRAST - x2 + 0 - 0 + bandWidth - save-glyph 'beamSemiQuaver' 0x266C : union glyphs.beamQuaver - BandShape - object [x x1] [y : pictTop - deltaY - 1.5 * bandWidth] - object [x x2] [y : pictTop - 1.5 * bandWidth] - x1 - fine * HVCONTRAST - x2 + 0 - 0 - bandWidth - do "sharp, flat and neutral" - local nsTop pictTop - local nsBot pictBot - local fine : adviceBlackness 3.5 - local fine2 : adviceBlackness 4 - local l : SB - fine / 2 - local r : RIGHTSB + fine / 2 - local hsp : ((r - l) - (fine * 2 * HVCONTRAST)) * 0.3 - local skew 0.2 - save-glyph 'sharpTone' 0x266F : sketch - include : dispiro - widths.center - flat l ([mix nsTop nsBot 0.3] - (MIDDLE - l) * skew) [heading RIGHTWARD] - curl r ([mix nsTop nsBot 0.3] - (MIDDLE - r) * skew) [heading RIGHTWARD] - include : dispiro - widths.center - flat l ([mix nsTop nsBot 0.7] - (MIDDLE - l) * skew) [heading RIGHTWARD] - curl r ([mix nsTop nsBot 0.7] - (MIDDLE - r) * skew) [heading RIGHTWARD] - include : VBarLeft (l + hsp) (nsBot - (MIDDLE - l - hsp) * skew) (nsTop - (MIDDLE - l - hsp) * skew) fine - include : VBarRight (r - hsp) (nsBot - (MIDDLE - r + hsp) * skew) (nsTop - (MIDDLE - r + hsp) * skew) fine - save-glyph 'flatTone' 0x266D : sketch - local yTerminal : mix nsBot nsTop 0.55 - local curly 0.65 - local curly2 1.1 - local curly3 0.3 - local l [mix SB RIGHTSB 0.07] - local r [mix RIGHTSB SB 0.07] - include : difference - union - VBarLeft l nsBot nsTop fine - dispiro - widths.lhs fine - g4 l (nsBot - 1) - alsothru 0.5 curly3 - g4.up.mid (r - O + 1) ([mix nsBot yTerminal curly] + (r - l) * skew - TANSLANT * para.smoothadjust) [widths.lhs (fine + 1)] - g4.left.mid ([mix l r 0.5] - CORRECTION_OMIDX * fine) ([mix nsBot yTerminal curly2] + (r - l) * skew / 2 + 1) - g4 l (yTerminal + 1) - difference - spiro-outline - corner l (nsBot - UPM) - corner l nsBot - alsothru 0.5 curly3 - g4.up.mid (r - O) ([mix nsBot yTerminal curly] + (r - l) * skew - TANSLANT * para.smoothadjust) - g4.left.mid ([mix l r 0.5] - CORRECTION_OMIDX * fine) ([mix nsBot yTerminal curly2] + (r - l) * skew / 2) - corner l yTerminal - corner l (yTerminal + 1) - corner l nsTop - corner WIDTH nsTop - corner WIDTH (nsBot - UPM) - spiro-outline - corner 0 yTerminal - corner 0 nsTop - corner (l + fine * HVCONTRAST) nsTop - corner (l + fine * HVCONTRAST) yTerminal - spiro-outline - corner l (nsBot - UPM) - corner l nsTop - corner (l - UPM) nsTop - corner (l - UPM) (nsBot - UPM) - save-glyph 'neutralTone' 0x266E : sketch - local k : 0.25 - (STROKE * 0.25 / (nsTop - nsBot)) - local kr 0.5 - local ll (l + hsp * kr) - local rr (r - hsp * kr) - - local barLeft : VBarLeft ll [mix nsBot nsTop k] nsTop fine - local barRight : VBarRight rr nsBot [mix nsBot nsTop (1 - k)] fine - local diagLow : dispiro - widths.lhs fine - flat ll [mix nsBot nsTop k] - curl rr ([mix nsBot nsTop k] + (rr - ll) * skew) - local belowDiagLow : spiro-outline - corner ll [mix nsBot nsTop k] - corner rr ([mix nsBot nsTop k] + (rr - ll) * skew) - corner rr nsBot - corner ll nsBot - local diagHigh : dispiro - widths.lhs fine - flat rr [mix nsBot nsTop (1 - k)] - curl ll ([mix nsBot nsTop (1 - k)] - (rr - ll) * skew) - local aboveDiagHigh : spiro-outline - corner rr [mix nsBot nsTop (1 - k)] - corner ll ([mix nsBot nsTop (1 - k)] - (rr - ll) * skew) - corner ll nsTop - corner rr nsTop - local outsideBars : difference - spiro-outline - corner (ll - UPM) (nsBot - UPM) - corner (ll - UPM) (nsTop + UPM) - corner (rr + UPM) (nsTop + UPM) - corner (rr + UPM) (nsBot - UPM) - spiro-outline - corner ll nsBot - corner ll nsTop - corner rr nsTop - corner rr nsBot - - include : union - difference barLeft belowDiagLow - difference barRight aboveDiagHigh - difference diagLow barLeft barRight outsideBars - difference diagHigh barLeft barRight outsideBars - - ### symbol-block 'Metric marks' - sketch # metmark - include : VBar MIDDLE (-font.OS_2.usWinDescent) (font.OS_2.usWinAscent) SHOULDERFINE - include : HBar MIDDLE WIDTH 0 SHOULDERFINE - include : HBar MIDDLE WIDTH CAP SHOULDERFINE - include : HBar MIDDLE WIDTH XH SHOULDERFINE - include : HBar MIDDLE WIDTH DESCENDER SHOULDERFINE - include : HBar 0 MIDDLE symbolMid SHOULDERFINE - include : HBar 0 MIDDLE parenTop SHOULDERFINE - include : HBar 0 MIDDLE parenBot SHOULDERFINE - save 'metmark' 0xE09F - - ### symbol-block 'Flags' - do - local sw : adviceBlackness 5 - local flagDown : 0.07 * (parenTop - parenBot) - local delta 1 - local curliness 0.85 - define [FlagBar] : VBar SB pictBot pictTop sw - sketch # Black flag - include : spiro-outline - corner SB pictTop - curl (SB + delta) pictTop - alsothru 0.5 (1 - curliness) - g4 MIDDLE (pictTop - flagDown / 2) - alsothru 0.5 curliness - flat (RIGHTSB - delta) (pictTop - flagDown) - corner RIGHTSB (pictTop - flagDown) - corner RIGHTSB (symbolMid - flagDown) - curl (RIGHTSB - delta) (symbolMid - flagDown) - alsothru 0.5 (1 - curliness) - g4 MIDDLE (symbolMid - flagDown / 2) - alsothru 0.5 curliness - flat (SB + delta) symbolMid - corner SB symbolMid - close - include : Translate (sw / 2 * HVCONTRAST) 0 - include : FlagBar - save 'blackflag' 0x2691 - sketch # White flag - include : VBarRight RIGHTSB (symbolMid - flagDown) (pictTop - flagDown) sw - include : dispiro - widths.rhs sw - flat SB pictTop [heading RIGHTWARD] - curl (SB + delta) pictTop [heading RIGHTWARD] - alsothru 0.5 (1 - curliness) - g4 MIDDLE (pictTop - flagDown / 2) - alsothru 0.5 curliness - flat (RIGHTSB - delta) (pictTop - flagDown) [heading RIGHTWARD] - curl RIGHTSB (pictTop - flagDown) [heading RIGHTWARD] - include : dispiro - widths.rhs sw - flat RIGHTSB ((symbolMid - sw / 2) - flagDown) [heading LEFTWARD] - curl (RIGHTSB - delta) ((symbolMid - sw / 2) - flagDown) [heading LEFTWARD] - alsothru 0.5 (1 - curliness) - g4 MIDDLE ((symbolMid - sw / 2) - flagDown / 2) - alsothru 0.5 curliness - flat (SB + delta) (symbolMid - sw / 2) [heading LEFTWARD] - curl SB (symbolMid - sw / 2) [heading LEFTWARD] - include : Translate (sw / 2 * HVCONTRAST) 0 - include : FlagBar - save 'whiteflag' 0x2690 - - ### symbol-block 'Other typographic symbols' - sketch # Kome - local sw : adviceBlackness 3.75 - local radius : (RIGHTSB - SB) / 2 - include : dispiro - widths.center sw - flat (MIDDLE - radius) (symbolMid - radius) - curl (MIDDLE + radius) (symbolMid + radius) - - include : dispiro - widths.center sw - flat (MIDDLE + radius) (symbolMid - radius) - curl (MIDDLE - radius) (symbolMid + radius) - local r0 : Math.min ((RIGHTSB - SB + (sw / [Math.sqrt 2]) - sw * 3) / 4) DOTRADIUS - local r : radius - r0 + (sw / 2 / [Math.sqrt 2]) - include : RingAt (MIDDLE + r) symbolMid r0 - include : RingAt (MIDDLE - r) symbolMid r0 - include : RingAt MIDDLE (symbolMid + r) r0 - include : RingAt MIDDLE (symbolMid - r) r0 - save 'kome' 0x203B - - sketch - local sw : [adviceBlackness 3] / 2 - local kInside 0.5 - local kOutside 2.5 - local l : mix SB RIGHTSB 0.1 - local r : mix RIGHTSB SB 0.1 - start-from [mix l r 0.6] pictTop - line-to (l - sw * kInside) (symbolMid - sw) - line-to (r - sw * kOutside) (symbolMid - sw) - line-to [mix r l 0.6] pictBot - line-to (r + sw * kInside) (symbolMid + sw) - line-to (l + sw * kOutside) (symbolMid + sw) - save 'boltSymbol' 0x26A1 - - do "Checking marks" - local light : adviceBlackness 4.5 - local medium : Math.max (light * 1.75) (WIDTH * 0.2) - local heavy : Math.max (light * 2.5) (WIDTH * 0.3) - local shapesize 0.8 - local shapesizeCheck : shapesize * 1.1 - foreach [{unicode sw} : items-of {{0x2713 light} {0x2714 medium}} ] : sketch - include : dispiro - widths.center sw - g4 SB [mix symbolMid [mix pictBot pictTop 0.46] shapesizeCheck] - alsothru 0.5 0.4 - g4 [mix SB RIGHTSB 0.4] [mix symbolMid [mix pictBot pictTop 0.05] shapesizeCheck] [heading DOWNWARD] - include : dispiro - widths.center sw - g4 [mix SB RIGHTSB 0.4] [mix symbolMid [mix pictBot pictTop 0.05] shapesizeCheck] [heading UPWARD] - alsothru 0.5 0.6 - g4 RIGHTSB [mix symbolMid [mix pictBot pictTop 0.9] shapesizeCheck] - save null unicode - - foreach [{unicode sw} : items-of {{0x271A medium}} ] : sketch - include : dispiro - widths.center sw - g4 [mix WIDTH RIGHTSB 0.5] symbolMid - g4 [mix 0 SB 0.5] symbolMid - include : dispiro - widths.center sw - g4 MIDDLE [mix symbolMid pictTop (0.8 * shapesize * 7/8)] - g4 MIDDLE [mix symbolMid pictBot (0.9 * shapesize * 7/8)] - save null unicode - - foreach [{unicode sw} : items-of {{0x2715 light} {0x2716 medium}} ] : sketch - include : dispiro - widths.center sw - g4 RIGHTSB [mix symbolMid pictTop (0.8 * shapesize)] - g4 SB [mix symbolMid pictBot (0.9 * shapesize)] - include : dispiro - widths.center sw - g4 SB [mix symbolMid pictTop (0.8 * shapesize)] - g4 RIGHTSB [mix symbolMid pictBot (0.9 * shapesize)] - save null unicode - - foreach [{unicode sw} : items-of {{0x2717 light} {0x2718 medium}} ] : sketch - include : dispiro - widths.center sw - g4 RIGHTSB [mix symbolMid [mix pictBot pictTop 0.9] shapesize] - alsothru 0.53 0.45 - g4 SB [mix symbolMid pictBot (1.05 * shapesize)] - include : dispiro - widths.center sw - g4 [mix SB RIGHTSB 0.1] [mix symbolMid [mix pictBot pictTop 0.86] shapesize] - alsothru 0.47 0.5 - g4 [mix SB RIGHTSB 0.9] [mix symbolMid [mix pictBot pictTop 0.05] shapesize] - save null unicode - foreach [{unicode sw op} : items-of { - { 0x276C light 1 } - { 0x276D light 0 } - { 0x276E medium 1 } - { 0x276F medium 0 } - { 0x2770 heavy 1 } - { 0x2771 heavy 0 } - }] : sketch - include : dispiro - widths.center sw - corner [mix (SB + sw / 2) (RIGHTSB - sw / 2) op] pictTop [heading DOWNWARD] - corner [mix (SB + sw / 2) (RIGHTSB - sw / 2) (1 - op)] symbolMid [heading DOWNWARD] - corner [mix (SB + sw / 2) (RIGHTSB - sw / 2) op] pictBot [heading DOWNWARD] - save null unicode - - do "I-Ching" - # Trigrams - define [yin m n] : glyph-construction - local offsetY : (2 / 3) * (pictBot - pictTop) / n - local startY : symbolMid - offsetY * (n - 1) / 2 - local bar : adviceBlackness n - local fine : adviceBlackness 5 - local gap : Math.max (WIDTH / 8) (fine) - include : HBar SB (MIDDLE - gap / 2 * HVCONTRAST) (startY + offsetY * m) bar - include : HBar (MIDDLE + gap / 2 * HVCONTRAST) RIGHTSB (startY + offsetY * m) bar - - define [yang m n] : glyph-construction - local offsetY : (2 / 3) * (operBot - pictTop) / n - local startY : symbolMid - offsetY * (n - 1) / 2 - local bar : adviceBlackness n - include : HBar SB RIGHTSB (startY + offsetY * m) bar - - define [patterns n su] : foreach [offset: range 0 [Math.pow 2 n]] : sketch - foreach [bit : range 0 n] : begin - if [maskBit offset bit] - then : include : yin bit n - else : include : yang bit n - save null (su + offset) - - patterns 1 0x268A - patterns 2 0x268C - patterns 3 0x2630 - - - ### ### Ligature-orienteds - ### symbol-block 'Ligature-oriented Subglyphs' : if (para.spacing > 0) : begin - - local arrowheadsKern : (2 / 3) * [clamp 0 (WIDTH * 0.4) (WIDTH - OPERATORSTROKE * 3)] - - # arrows - # -> - define lessSlantness : (4 / 13) * (operTop - operBot) / (RIGHTSB - SB) - define dH : lessSlantness * (RIGHTSB - SB) - - define arrowheadSlope : 1 / lessSlantness - define [ArrowBarConfig extend kern join] : let [cleft O] [cright (WIDTH - O)] [arrowr : WIDTH + extend] [arrowl : 0 - extend] : list - list 'fr' SB arrowr - list 'lf' arrowl RIGHTSB - list 'cr' cleft arrowr - list 'lc' arrowl cright - list 'lxc' [mix arrowl 0 0.5] cright - list 'fr1' SB (arrowr + kern) - list 'l1f' (arrowl - kern) RIGHTSB - list 'cr1' cleft (arrowr + kern) - list 'l1c' (arrowl - kern) cright - list 'fr2' SB (arrowr + kern * 2) - list 'l2f' (arrowl - kern * 2) RIGHTSB - list 'cr2' cleft (arrowr + kern * 2) - list 'l2c' (arrowl - kern * 2) cright - list 'cf' cleft RIGHTSB - list 'fc' SB cright - list 'jf' (-join) RIGHTSB - list 'fj' SB (WIDTH + join) - list 'jr' (-join) arrowr - list 'jc' (-join) cright - list 'lj' arrowl (WIDTH + join) - list 'cj' cleft (WIDTH + join) - list 'j1f' (-join - kern) RIGHTSB - list 'fj1' SB (WIDTH + join + kern) - list 'lr' arrowl arrowr - list 'cc' cleft cright - list 'zf' (cleft - WIDTH + RIGHTSB) RIGHTSB - list 'zc' (cleft - WIDTH + RIGHTSB) cright - list 'fz' SB (cright + SB) - list 'cz' cleft (cright + SB) - - local arrowExtend [clamp 0 WIDTH (RIGHTSB - OPERATORSTROKE / 2 * arrowheadSlope)] - local arrowJ : clamp 0 WIDTH (SB + OPERATORSTROKE / 2 * arrowheadSlope) - foreach [{subclass left right} : items-of [ArrowBarConfig arrowExtend arrowheadsKern arrowJ]] : sketch - include : HBar left right symbolMid OPERATORSTROKE - set currentGlyph.cmpPriority (-3) - save ('lighyphen.' + subclass) - - # => - # local dblArrowD : XH * [linreg 18 0.15 126 0.275 STROKE] - # local sw : Math.min OPERATORSTROKE (dblArrowD * [clamp 0.45 0.75 ((1 - WHITENESS) * 1)]) - local dblArrowD ((parenTop - parenBot) * designParameters.equal_wideness + OPERATORSTROKE / 2) - local dblArrowSw : Math.min OPERATORSTROKE (dblArrowD * 2 / 3) - local dblExtend : clamp 0 WIDTH (RIGHTSB - (dblArrowD - dblArrowSw / 2) * arrowheadSlope) - local dblArrowJ : clamp 0 WIDTH (SB + (dblArrowD - dblArrowSw / 2) * arrowheadSlope) - foreach [{subclass left right} : items-of [ArrowBarConfig dblExtend arrowheadsKern dblArrowJ]] : sketch - include : HBarTop left right (symbolMid + dblArrowD) dblArrowSw - include : HBarBottom left right (symbolMid - dblArrowD) dblArrowSw - set currentGlyph.cmpPriority (-3) - save ('ligequal.' + subclass) - - sketch - include glyphs.exclam - include : Translate (((RIGHTSB - WIDTH) + (WIDTH - arrowExtend / 2)) / 2 - MIDDLE) 0 - include : HBar (-arrowExtend) (RIGHTSB - WIDTH) symbolMid OPERATORSTROKE - save 'ligexclam.htmlcommentstart' - - do "Waves" - define WaveResolution 8 - define WaveMagnitude : dblArrowD * (3 / 4) - dblArrowSw / 2 - define WaveAdj : TANSLANT * WaveMagnitude * (-0.75) - define [WaveShapeImpl] : params [left right ts te xsJoin xfJoin] : glyph-construction - local resolution : Math.ceil (WaveResolution * (te - ts)) - local knots {} - foreach [pr : range 0 till resolution] : begin - local theta : [mix ts te (pr / resolution)] * Math.PI * 2 - local waveRelY : (-1) * [Math.sin theta] - 0.075 * [Math.sin (theta * 3)] - local flat : [Math.abs ([mix ts te (pr / resolution)] * 2 % 1)] < 1 / WaveResolution - knots.push : g2 - (WaveAdj * waveRelY) + [mix left right (pr / resolution)] - symbolMid + WaveMagnitude * waveRelY - include : dispiro - widths.center dblArrowSw - if (xsJoin !== nothing) {[straight.right.start xsJoin symbolMid]} {} - begin knots - if (xfJoin !== nothing) {[straight.right.end xfJoin symbolMid]} {} - - define [WaveShape] : params [left right xsJoin xfJoin] : WaveShapeImpl (WIDTH * -left) (WIDTH * (1 + right)) (-left * 2) (2 + right * 2) xsJoin xfJoin - - define LR (3 / 16) - define Z (1 / 4) - define F (-1 / 4) - - sketch - include : WaveShape LR LR (xsJoin -- (-arrowExtend)) (xfJoin -- (WIDTH + arrowExtend)) - save 'wave.lr' - sketch - include : WaveShape LR F (xsJoin -- (-arrowExtend)) - save 'wave.lf' - sketch - include : WaveShape LR Z (xsJoin -- (-arrowExtend)) - save 'wave.lz' - sketch - include : WaveShape Z F - save 'wave.zf' - sketch - include : WaveShape F LR (xfJoin -- (WIDTH + arrowExtend)) - save 'wave.fr' - sketch - include : WaveShape Z LR (xfJoin -- (WIDTH + arrowExtend)) - save 'wave.zr' - sketch - include : WaveShape F Z - save 'wave.fz' - sketch - include : WaveShape Z Z - save 'wave.zz' - - do "Arrowheads" - # Right-shifted > - sketch - include glyphs.greater AS_BASE ALSO_METRICS - save 'liggreater.shift0' - include : Translate (arrowheadsKern / 2) 0 - save 'liggreater.shift0h' - include : Translate (arrowheadsKern / 2) 0 - save 'liggreater.shift1' - include : Translate (arrowheadsKern / 2) 0 - save 'liggreater.shift1h' - include : Translate (arrowheadsKern / 2) 0 - save 'liggreater.shift2' - - # Left-shifted > - sketch - include glyphs.greater AS_BASE ALSO_METRICS - save 'liggreater.shiftN0' - include : Translate (-arrowheadsKern / 2) 0 - save 'liggreater.shiftN0h' - include : Translate (-arrowheadsKern / 2) 0 - save 'liggreater.shiftN1' - include : Translate (-arrowheadsKern / 2) 0 - save 'liggreater.shiftN1h' - include : Translate (-arrowheadsKern / 2) 0 - save 'liggreater.shiftN2' - - # Left-shifted < - sketch - include glyphs.less AS_BASE ALSO_METRICS - save 'ligless.shift0' - include : Translate (-arrowheadsKern / 2) 0 - save 'ligless.shift0h' - include : Translate (-arrowheadsKern / 2) 0 - save 'ligless.shift1' - include : Translate (-arrowheadsKern / 2) 0 - save 'ligless.shift1h' - include : Translate (-arrowheadsKern / 2) 0 - save 'ligless.shift2' - - # Right-shifted < - sketch - include glyphs.less AS_BASE ALSO_METRICS - save 'ligless.shiftN0' - include : Translate (arrowheadsKern / 2) 0 - save 'ligless.shiftN0h' - include : Translate (arrowheadsKern / 2) 0 - save 'ligless.shiftN1' - include : Translate (arrowheadsKern / 2) 0 - save 'ligless.shiftN1h' - include : Translate (arrowheadsKern / 2) 0 - save 'ligless.shiftN2' - - define [ArrowHeadHole] : Rect (symbolMid + dblArrowD - dblArrowSw) (symbolMid - dblArrowD + dblArrowSw) (-WIDTH) (2 * WIDTH) - - sketch - include : difference - glyph-construction : include glyphs.less - ArrowHeadHole - save 'ligless.hole' - - sketch - include : difference - glyph-construction : include glyphs.greater - ArrowHeadHole - save 'liggreater.hole' - - sketch - include : difference - glyph-construction : include glyphs.'ligless.shiftN1' - ArrowHeadHole - save 'ligless.shiftN1.hole' - - sketch - include : difference - glyph-construction : include glyphs.'liggreater.shiftN1' - ArrowHeadHole +###### Other symbols +$$include '../meta/macros.ptl' + +import [mix linreg clamp fallback] from '../support/utils' +import [designParameters] from '../meta/aesthetics' +import '../support/transform' as Transform +import '../support/mask-bit' as maskBit + + +export : define [apply] : begin + glyph-module-entry commonShapes overmarks geometricSymbols + + ### # IPA tonal marks + ### symbol-block 'Phonetic Symbols' + local triangleSize : Math.min (PERIODRADIUS) (XH / 5) + + sketch # trianglecolon + start-from (MIDDLE - triangleSize * 1.35) XH + line-to MIDDLE (XH - triangleSize * 2.75) + line-to (MIDDLE + triangleSize * 1.35) XH + start-from (MIDDLE - triangleSize * 1.35) 0 + line-to MIDDLE (0 + triangleSize * 2.75) + line-to (MIDDLE + triangleSize * 1.35) 0 + + save 'trianglecolon' 0x2D0 + + sketch # halftrianglecolon + start-from (MIDDLE - triangleSize * 1.35) XH + line-to MIDDLE (XH - triangleSize * 2.75) + line-to (MIDDLE + triangleSize * 1.35) XH + save 'halftrianglecolon' 0x2D1 + + foreach tone [range 4 downtill 0] : begin + create-glyph ('tone' + tone) : glyph-construction + assign-unicode (0x2E5 + 4 - tone) + 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 + + do "Suit card" + local df : DivFrame para.diversityM + local heartTop : mix symbolMid pictTop 0.75 + local heartBot : mix symbolMid pictBot 0.75 + local heartRight : df.middle + [mix RIGHTSB WIDTH (1 / 2)] - MIDDLE + local heartLeft : df.middle - (heartRight - df.middle) + 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 + + define [wrap g] : glyph-construction + set-width df.width + include g AS_BASE + + define [HeartInnerShape sw tip ext] : spiro-outline + corner df.middle (heartBot + sw * tip) + quadcontrols 1 (2 / 3) + g4 (heartRight - O - sw) y2 + arcvh + g4 [mix df.middle heartRight 0.5] (heartTop - sw * tip / 1.75) + archv + if sw + : then : list + corner (df.middle + sw / 3) (y3 - sw * ext) + corner (df.middle - sw / 3) (y3 - sw * ext) + : else : corner df.middle (y3 - sw) + arcvh + g4 [mix df.middle heartLeft 0.5] (heartTop - sw * tip / 1.75) + archv + g4 (heartLeft + O + sw) y2 + quadcontrols 0 (1 / 3) + close + + save-glyph 'heartSuit' 0x2665 : wrap : HeartInnerShape 0 0 0 + save-glyph 'whiteHeartSuit' 0x2661 : wrap : difference glyphs.heartSuit [HeartInnerShape sw 1.75 0.8] + save-glyph 'spadeSuit' 0x2660 : wrap : union + sketch + include glyphs.heartSuit + apply-transform : Upright + apply-transform : Translate (-df.middle) (-heartBot) + apply-transform : Scale 1 (-0.75) + apply-transform : Translate df.middle heartTop + apply-transform : Italify + HBarBottom [mix SB df.rightSB 0.25] [mix df.rightSB SB 0.25] heartBot sw + VBar df.middle heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)] sw + + save-glyph 'whiteSpadeSuit' 0x2664 : wrap : difference glyphs.spadeSuit : sketch + include : HeartInnerShape sw 2 0 + apply-transform : Upright + apply-transform : Translate (-df.middle) (-heartBot) + apply-transform : Scale 1 (-0.75) + apply-transform : Translate df.middle heartTop + apply-transform : Italify + + local clubTopY : mix heartTop heartBot 0.22 + local clubTriangleHeight : (heartTop - heartBot) * 0.3 + define [ClubTriangles r] : union + RingAt df.middle clubTopY r + RingAt (df.middle - clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) r + RingAt (df.middle + clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) r + spiro-outline + corner df.middle clubTopY + corner (df.middle - clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) + corner (df.middle + clubTriangleHeight / [Math.sqrt 3]) (clubTopY - clubTriangleHeight) + + define [ClubShape r] : sketch + include : ClubTriangles r + include : HBarBottom [mix SB df.rightSB 0.25] [mix df.rightSB SB 0.25] heartBot sw + include : VBar df.middle heartBot [mix heartBot heartTop 0.45] sw + + local circleRadius : (heartTop - heartBot) * 0.18 + save-glyph 'clubSuit' 0x2663 : wrap : ClubShape circleRadius + save-glyph 'whiteClubSuit' 0x2667 : wrap : sketch + local ro : circleRadius + sw / 2 + local ri : circleRadius - sw / 2 + include : difference [ClubShape ro] [ClubTriangles ri] + + save-glyph 'diamondSuit' 0x2666 : wrap : sketch + start-from df.middle heartTop + line-to (heartRight - O) symbolMid + line-to df.middle heartBot + line-to (heartLeft + O) symbolMid + + save-glyph 'whiteDiamondSuit' 0x2662 : wrap : intersection glyphs.diamondSuit + union + dispiro [widths.rhs sw] [flat df.middle heartTop] [curl (heartRight - O) symbolMid] + dispiro [widths.rhs sw] [flat (heartRight - O) symbolMid] [curl df.middle heartBot] + dispiro [widths.rhs sw] [flat df.middle heartBot] [curl (heartLeft + O) symbolMid] + dispiro [widths.rhs sw] [flat (heartLeft + O) symbolMid] [curl df.middle heartTop] + + ### symbol-block 'Planets' + sketch # venus + local obot : pictTop - RIGHTSB + SB + include : OShape pictTop obot SB RIGHTSB OPERATORSTROKE + include : VBar MIDDLE pictBot obot OPERATORSTROKE + include : HBar SB RIGHTSB [mix pictBot (obot + OPERATORSTROKE) 0.5] OPERATORSTROKE + + save 'venus' 0x2640 + turned 'earth' 0x2641 'venus' MIDDLE symbolMid + + sketch # mars + local otop : pictBot + RIGHTSB - SB + include : OShape otop pictBot SB RIGHTSB OPERATORSTROKE + include : ArrowShape MIDDLE (otop - OPERATORSTROKE / 3) MIDDLE pictTop ((RIGHTSB - SB) * 0.4) + save 'mars' 0x2642 + + ### symbol-block 'Musical' + do "Musical Notations" + define fine : adviceBlackness 6 + define noteSize : WIDTH * 0.4 + fine / 2 + define noteCompress 0.8 + define commonNoteBottom : pictBot + noteCompress / 2 * noteSize + define [BandShape z1 z2 l r h] : begin + local slope : (z2.y - z1.y) / (z2.x - z1.x) + local yl : z1.y + (l - z1.x) * slope + local yr : z1.y + (r - z1.x) * slope + return : spiro-outline + corner l yl + corner r yr + corner r (yr + h) + corner l (yl + h) + define [MusicalNoteAt size x y] : sketch + include : Ring (- noteCompress / 2 * size) (noteCompress / 2 * size) (-size) 0 + include : Upright + include : new Transform 1 0 0.15 1 0 0 + include : Translate x y + include : Italify + save-glyph 'crotchet' 0x2669 : union + MusicalNoteAt noteSize (MIDDLE + noteSize / 6 + fine / 2 * HVCONTRAST) commonNoteBottom + VBar (MIDDLE + noteSize / 6) commonNoteBottom pictTop fine + save-glyph 'quaver' 0x266A : sketch + local x3 : mix MIDDLE RIGHTSB 0.35 + local y3 : mix pictBot pictTop 0.25 + local y2 : mix y3 pictTop 0.25 + include : union + MusicalNoteAt noteSize MIDDLE commonNoteBottom + VBarRight MIDDLE commonNoteBottom pictTop fine + dispiro + widths.rhs fine + g4.down.start MIDDLE pictTop + g4.down.mid RIGHTSB y2 + g4 x3 y3 + do "Beamed Notes" + local x1 : MIDDLE - noteSize / 6 + local x2 : x1 + noteSize * 7 / 6 + local deltaY : noteCompress * noteSize / 2 + local lb1 : pictBot + noteCompress / 2 * noteSize + local bandWidth : noteSize * noteCompress * 0.75 + save-glyph 'beamQuaver' 0x266B : difference + union + MusicalNoteAt noteSize x1 commonNoteBottom + VBarRight x1 commonNoteBottom (pictTop - deltaY) fine + MusicalNoteAt noteSize x2 (commonNoteBottom + deltaY) + VBarRight x2 (commonNoteBottom + deltaY) pictTop fine + BandShape + object [x x1] [y : pictTop - deltaY] + object [x x2] [y pictTop] + x1 - fine * HVCONTRAST + x2 + 0 + 0 - bandWidth + BandShape + object [x x1] [y : pictTop - deltaY] + object [x x2] [y pictTop] + x1 - fine * HVCONTRAST + x2 + 0 + 0 + bandWidth + save-glyph 'beamSemiQuaver' 0x266C : union glyphs.beamQuaver + BandShape + object [x x1] [y : pictTop - deltaY - 1.5 * bandWidth] + object [x x2] [y : pictTop - 1.5 * bandWidth] + x1 - fine * HVCONTRAST + x2 + 0 + 0 - bandWidth + do "sharp, flat and neutral" + local nsTop pictTop + local nsBot pictBot + local fine : adviceBlackness 3.5 + local fine2 : adviceBlackness 4 + local l : SB - fine / 2 + local r : RIGHTSB + fine / 2 + local hsp : ((r - l) - (fine * 2 * HVCONTRAST)) * 0.3 + local skew 0.2 + save-glyph 'sharpTone' 0x266F : sketch + include : dispiro + widths.center + flat l ([mix nsTop nsBot 0.3] - (MIDDLE - l) * skew) [heading RIGHTWARD] + curl r ([mix nsTop nsBot 0.3] - (MIDDLE - r) * skew) [heading RIGHTWARD] + include : dispiro + widths.center + flat l ([mix nsTop nsBot 0.7] - (MIDDLE - l) * skew) [heading RIGHTWARD] + curl r ([mix nsTop nsBot 0.7] - (MIDDLE - r) * skew) [heading RIGHTWARD] + include : VBarLeft (l + hsp) (nsBot - (MIDDLE - l - hsp) * skew) (nsTop - (MIDDLE - l - hsp) * skew) fine + include : VBarRight (r - hsp) (nsBot - (MIDDLE - r + hsp) * skew) (nsTop - (MIDDLE - r + hsp) * skew) fine + save-glyph 'flatTone' 0x266D : sketch + local yTerminal : mix nsBot nsTop 0.55 + local curly 0.65 + local curly2 1.1 + local curly3 0.3 + local l [mix SB RIGHTSB 0.07] + local r [mix RIGHTSB SB 0.07] + include : difference + union + VBarLeft l nsBot nsTop fine + dispiro + widths.lhs fine + g4 l (nsBot - 1) + alsothru 0.5 curly3 + g4.up.mid (r - O + 1) ([mix nsBot yTerminal curly] + (r - l) * skew - TANSLANT * para.smoothadjust) [widths.lhs (fine + 1)] + g4.left.mid ([mix l r 0.5] - CORRECTION_OMIDX * fine) ([mix nsBot yTerminal curly2] + (r - l) * skew / 2 + 1) + g4 l (yTerminal + 1) + difference + spiro-outline + corner l (nsBot - UPM) + corner l nsBot + alsothru 0.5 curly3 + g4.up.mid (r - O) ([mix nsBot yTerminal curly] + (r - l) * skew - TANSLANT * para.smoothadjust) + g4.left.mid ([mix l r 0.5] - CORRECTION_OMIDX * fine) ([mix nsBot yTerminal curly2] + (r - l) * skew / 2) + corner l yTerminal + corner l (yTerminal + 1) + corner l nsTop + corner WIDTH nsTop + corner WIDTH (nsBot - UPM) + spiro-outline + corner 0 yTerminal + corner 0 nsTop + corner (l + fine * HVCONTRAST) nsTop + corner (l + fine * HVCONTRAST) yTerminal + spiro-outline + corner l (nsBot - UPM) + corner l nsTop + corner (l - UPM) nsTop + corner (l - UPM) (nsBot - UPM) + save-glyph 'neutralTone' 0x266E : sketch + local k : 0.25 - (STROKE * 0.25 / (nsTop - nsBot)) + local kr 0.5 + local ll (l + hsp * kr) + local rr (r - hsp * kr) + + local barLeft : VBarLeft ll [mix nsBot nsTop k] nsTop fine + local barRight : VBarRight rr nsBot [mix nsBot nsTop (1 - k)] fine + local diagLow : dispiro + widths.lhs fine + flat ll [mix nsBot nsTop k] + curl rr ([mix nsBot nsTop k] + (rr - ll) * skew) + local belowDiagLow : spiro-outline + corner ll [mix nsBot nsTop k] + corner rr ([mix nsBot nsTop k] + (rr - ll) * skew) + corner rr nsBot + corner ll nsBot + local diagHigh : dispiro + widths.lhs fine + flat rr [mix nsBot nsTop (1 - k)] + curl ll ([mix nsBot nsTop (1 - k)] - (rr - ll) * skew) + local aboveDiagHigh : spiro-outline + corner rr [mix nsBot nsTop (1 - k)] + corner ll ([mix nsBot nsTop (1 - k)] - (rr - ll) * skew) + corner ll nsTop + corner rr nsTop + local outsideBars : difference + spiro-outline + corner (ll - UPM) (nsBot - UPM) + corner (ll - UPM) (nsTop + UPM) + corner (rr + UPM) (nsTop + UPM) + corner (rr + UPM) (nsBot - UPM) + spiro-outline + corner ll nsBot + corner ll nsTop + corner rr nsTop + corner rr nsBot + + include : union + difference barLeft belowDiagLow + difference barRight aboveDiagHigh + difference diagLow barLeft barRight outsideBars + difference diagHigh barLeft barRight outsideBars + + ### symbol-block 'Metric marks' + sketch # metmark + include : VBar MIDDLE (-font.OS_2.usWinDescent) (font.OS_2.usWinAscent) SHOULDERFINE + include : HBar MIDDLE WIDTH 0 SHOULDERFINE + include : HBar MIDDLE WIDTH CAP SHOULDERFINE + include : HBar MIDDLE WIDTH XH SHOULDERFINE + include : HBar MIDDLE WIDTH DESCENDER SHOULDERFINE + include : HBar 0 MIDDLE symbolMid SHOULDERFINE + include : HBar 0 MIDDLE parenTop SHOULDERFINE + include : HBar 0 MIDDLE parenBot SHOULDERFINE + save 'metmark' 0xE09F + + ### symbol-block 'Flags' + do + local sw : adviceBlackness 5 + local flagDown : 0.07 * (parenTop - parenBot) + local delta 1 + local curliness 0.85 + define [FlagBar] : VBar SB pictBot pictTop sw + sketch # Black flag + include : spiro-outline + corner SB pictTop + curl (SB + delta) pictTop + alsothru 0.5 (1 - curliness) + g4 MIDDLE (pictTop - flagDown / 2) + alsothru 0.5 curliness + flat (RIGHTSB - delta) (pictTop - flagDown) + corner RIGHTSB (pictTop - flagDown) + corner RIGHTSB (symbolMid - flagDown) + curl (RIGHTSB - delta) (symbolMid - flagDown) + alsothru 0.5 (1 - curliness) + g4 MIDDLE (symbolMid - flagDown / 2) + alsothru 0.5 curliness + flat (SB + delta) symbolMid + corner SB symbolMid + close + include : Translate (sw / 2 * HVCONTRAST) 0 + include : FlagBar + save 'blackflag' 0x2691 + sketch # White flag + include : VBarRight RIGHTSB (symbolMid - flagDown) (pictTop - flagDown) sw + include : dispiro + widths.rhs sw + flat SB pictTop [heading RIGHTWARD] + curl (SB + delta) pictTop [heading RIGHTWARD] + alsothru 0.5 (1 - curliness) + g4 MIDDLE (pictTop - flagDown / 2) + alsothru 0.5 curliness + flat (RIGHTSB - delta) (pictTop - flagDown) [heading RIGHTWARD] + curl RIGHTSB (pictTop - flagDown) [heading RIGHTWARD] + include : dispiro + widths.rhs sw + flat RIGHTSB ((symbolMid - sw / 2) - flagDown) [heading LEFTWARD] + curl (RIGHTSB - delta) ((symbolMid - sw / 2) - flagDown) [heading LEFTWARD] + alsothru 0.5 (1 - curliness) + g4 MIDDLE ((symbolMid - sw / 2) - flagDown / 2) + alsothru 0.5 curliness + flat (SB + delta) (symbolMid - sw / 2) [heading LEFTWARD] + curl SB (symbolMid - sw / 2) [heading LEFTWARD] + include : Translate (sw / 2 * HVCONTRAST) 0 + include : FlagBar + save 'whiteflag' 0x2690 + + ### symbol-block 'Other typographic symbols' + sketch # Kome + local sw : adviceBlackness 3.75 + local radius : (RIGHTSB - SB) / 2 + include : dispiro + widths.center sw + flat (MIDDLE - radius) (symbolMid - radius) + curl (MIDDLE + radius) (symbolMid + radius) + + include : dispiro + widths.center sw + flat (MIDDLE + radius) (symbolMid - radius) + curl (MIDDLE - radius) (symbolMid + radius) + local r0 : Math.min ((RIGHTSB - SB + (sw / [Math.sqrt 2]) - sw * 3) / 4) DOTRADIUS + local r : radius - r0 + (sw / 2 / [Math.sqrt 2]) + include : RingAt (MIDDLE + r) symbolMid r0 + include : RingAt (MIDDLE - r) symbolMid r0 + include : RingAt MIDDLE (symbolMid + r) r0 + include : RingAt MIDDLE (symbolMid - r) r0 + save 'kome' 0x203B + + sketch + local sw : [adviceBlackness 3] / 2 + local kInside 0.5 + local kOutside 2.5 + local l : mix SB RIGHTSB 0.1 + local r : mix RIGHTSB SB 0.1 + start-from [mix l r 0.6] pictTop + line-to (l - sw * kInside) (symbolMid - sw) + line-to (r - sw * kOutside) (symbolMid - sw) + line-to [mix r l 0.6] pictBot + line-to (r + sw * kInside) (symbolMid + sw) + line-to (l + sw * kOutside) (symbolMid + sw) + save 'boltSymbol' 0x26A1 + + do "Checking marks" + local light : adviceBlackness 4.5 + local medium : Math.max (light * 1.75) (WIDTH * 0.2) + local heavy : Math.max (light * 2.5) (WIDTH * 0.3) + local shapesize 0.8 + local shapesizeCheck : shapesize * 1.1 + foreach [{unicode sw} : items-of {{0x2713 light} {0x2714 medium}} ] : sketch + include : dispiro + widths.center sw + g4 SB [mix symbolMid [mix pictBot pictTop 0.46] shapesizeCheck] + alsothru 0.5 0.4 + g4 [mix SB RIGHTSB 0.4] [mix symbolMid [mix pictBot pictTop 0.05] shapesizeCheck] [heading DOWNWARD] + include : dispiro + widths.center sw + g4 [mix SB RIGHTSB 0.4] [mix symbolMid [mix pictBot pictTop 0.05] shapesizeCheck] [heading UPWARD] + alsothru 0.5 0.6 + g4 RIGHTSB [mix symbolMid [mix pictBot pictTop 0.9] shapesizeCheck] + save null unicode + + foreach [{unicode sw} : items-of {{0x271A medium}} ] : sketch + include : dispiro + widths.center sw + g4 [mix WIDTH RIGHTSB 0.5] symbolMid + g4 [mix 0 SB 0.5] symbolMid + include : dispiro + widths.center sw + g4 MIDDLE [mix symbolMid pictTop (0.8 * shapesize * 7/8)] + g4 MIDDLE [mix symbolMid pictBot (0.9 * shapesize * 7/8)] + save null unicode + + foreach [{unicode sw} : items-of {{0x2715 light} {0x2716 medium}} ] : sketch + include : dispiro + widths.center sw + g4 RIGHTSB [mix symbolMid pictTop (0.8 * shapesize)] + g4 SB [mix symbolMid pictBot (0.9 * shapesize)] + include : dispiro + widths.center sw + g4 SB [mix symbolMid pictTop (0.8 * shapesize)] + g4 RIGHTSB [mix symbolMid pictBot (0.9 * shapesize)] + save null unicode + + foreach [{unicode sw} : items-of {{0x2717 light} {0x2718 medium}} ] : sketch + include : dispiro + widths.center sw + g4 RIGHTSB [mix symbolMid [mix pictBot pictTop 0.9] shapesize] + alsothru 0.53 0.45 + g4 SB [mix symbolMid pictBot (1.05 * shapesize)] + include : dispiro + widths.center sw + g4 [mix SB RIGHTSB 0.1] [mix symbolMid [mix pictBot pictTop 0.86] shapesize] + alsothru 0.47 0.5 + g4 [mix SB RIGHTSB 0.9] [mix symbolMid [mix pictBot pictTop 0.05] shapesize] + save null unicode + foreach [{unicode sw op} : items-of { + { 0x276C light 1 } + { 0x276D light 0 } + { 0x276E medium 1 } + { 0x276F medium 0 } + { 0x2770 heavy 1 } + { 0x2771 heavy 0 } + }] : sketch + include : dispiro + widths.center sw + corner [mix (SB + sw / 2) (RIGHTSB - sw / 2) op] pictTop [heading DOWNWARD] + corner [mix (SB + sw / 2) (RIGHTSB - sw / 2) (1 - op)] symbolMid [heading DOWNWARD] + corner [mix (SB + sw / 2) (RIGHTSB - sw / 2) op] pictBot [heading DOWNWARD] + save null unicode + + do "I-Ching" + # Trigrams + define [yin m n] : glyph-construction + local offsetY : (2 / 3) * (pictBot - pictTop) / n + local startY : symbolMid - offsetY * (n - 1) / 2 + local bar : adviceBlackness n + local fine : adviceBlackness 5 + local gap : Math.max (WIDTH / 8) (fine) + include : HBar SB (MIDDLE - gap / 2 * HVCONTRAST) (startY + offsetY * m) bar + include : HBar (MIDDLE + gap / 2 * HVCONTRAST) RIGHTSB (startY + offsetY * m) bar + + define [yang m n] : glyph-construction + local offsetY : (2 / 3) * (operBot - pictTop) / n + local startY : symbolMid - offsetY * (n - 1) / 2 + local bar : adviceBlackness n + include : HBar SB RIGHTSB (startY + offsetY * m) bar + + define [patterns n su] : foreach [offset: range 0 [Math.pow 2 n]] : sketch + foreach [bit : range 0 n] : begin + if [maskBit offset bit] + then : include : yin bit n + else : include : yang bit n + save null (su + offset) + + patterns 1 0x268A + patterns 2 0x268C + patterns 3 0x2630 + + + ### ### Ligature-orienteds + ### symbol-block 'Ligature-oriented Subglyphs' : if (para.spacing > 0) : begin + + local arrowheadsKern : (2 / 3) * [clamp 0 (WIDTH * 0.4) (WIDTH - OPERATORSTROKE * 3)] + + # arrows + # -> + define lessSlantness : (4 / 13) * (operTop - operBot) / (RIGHTSB - SB) + define dH : lessSlantness * (RIGHTSB - SB) + + define arrowheadSlope : 1 / lessSlantness + define [ArrowBarConfig extend kern join] : let [cleft O] [cright (WIDTH - O)] [arrowr : WIDTH + extend] [arrowl : 0 - extend] : list + list 'fr' SB arrowr + list 'lf' arrowl RIGHTSB + list 'cr' cleft arrowr + list 'lc' arrowl cright + list 'lxc' [mix arrowl 0 0.5] cright + list 'fr1' SB (arrowr + kern) + list 'l1f' (arrowl - kern) RIGHTSB + list 'cr1' cleft (arrowr + kern) + list 'l1c' (arrowl - kern) cright + list 'fr2' SB (arrowr + kern * 2) + list 'l2f' (arrowl - kern * 2) RIGHTSB + list 'cr2' cleft (arrowr + kern * 2) + list 'l2c' (arrowl - kern * 2) cright + list 'cf' cleft RIGHTSB + list 'fc' SB cright + list 'jf' (-join) RIGHTSB + list 'fj' SB (WIDTH + join) + list 'jr' (-join) arrowr + list 'jc' (-join) cright + list 'lj' arrowl (WIDTH + join) + list 'cj' cleft (WIDTH + join) + list 'j1f' (-join - kern) RIGHTSB + list 'fj1' SB (WIDTH + join + kern) + list 'lr' arrowl arrowr + list 'cc' cleft cright + list 'zf' (cleft - WIDTH + RIGHTSB) RIGHTSB + list 'zc' (cleft - WIDTH + RIGHTSB) cright + list 'fz' SB (cright + SB) + list 'cz' cleft (cright + SB) + + local arrowExtend [clamp 0 WIDTH (RIGHTSB - OPERATORSTROKE / 2 * arrowheadSlope)] + local arrowJ : clamp 0 WIDTH (SB + OPERATORSTROKE / 2 * arrowheadSlope) + foreach [{subclass left right} : items-of [ArrowBarConfig arrowExtend arrowheadsKern arrowJ]] : sketch + include : HBar left right symbolMid OPERATORSTROKE + set currentGlyph.cmpPriority (-3) + save ('lighyphen.' + subclass) + + # => + # local dblArrowD : XH * [linreg 18 0.15 126 0.275 STROKE] + # local sw : Math.min OPERATORSTROKE (dblArrowD * [clamp 0.45 0.75 ((1 - WHITENESS) * 1)]) + local dblArrowD ((parenTop - parenBot) * designParameters.equal_wideness + OPERATORSTROKE / 2) + local dblArrowSw : Math.min OPERATORSTROKE (dblArrowD * 2 / 3) + local dblExtend : clamp 0 WIDTH (RIGHTSB - (dblArrowD - dblArrowSw / 2) * arrowheadSlope) + local dblArrowJ : clamp 0 WIDTH (SB + (dblArrowD - dblArrowSw / 2) * arrowheadSlope) + foreach [{subclass left right} : items-of [ArrowBarConfig dblExtend arrowheadsKern dblArrowJ]] : sketch + include : HBarTop left right (symbolMid + dblArrowD) dblArrowSw + include : HBarBottom left right (symbolMid - dblArrowD) dblArrowSw + set currentGlyph.cmpPriority (-3) + save ('ligequal.' + subclass) + + sketch + include glyphs.exclam + include : Translate (((RIGHTSB - WIDTH) + (WIDTH - arrowExtend / 2)) / 2 - MIDDLE) 0 + include : HBar (-arrowExtend) (RIGHTSB - WIDTH) symbolMid OPERATORSTROKE + save 'ligexclam.htmlcommentstart' + + do "Waves" + define WaveShape : CreateWaveShape dblArrowD dblArrowSw + + define LR (3 / 16) + define Z (1 / 4) + define F (-1 / 4) + + sketch + include : WaveShape LR LR (xsJoin -- (-arrowExtend)) (xfJoin -- (WIDTH + arrowExtend)) + save 'wave.lr' + sketch + include : WaveShape LR F (xsJoin -- (-arrowExtend)) + save 'wave.lf' + sketch + include : WaveShape LR Z (xsJoin -- (-arrowExtend)) + save 'wave.lz' + sketch + include : WaveShape Z F + save 'wave.zf' + sketch + include : WaveShape F LR (xfJoin -- (WIDTH + arrowExtend)) + save 'wave.fr' + sketch + include : WaveShape Z LR (xfJoin -- (WIDTH + arrowExtend)) + save 'wave.zr' + sketch + include : WaveShape F Z + save 'wave.fz' + sketch + include : WaveShape Z Z + save 'wave.zz' + + do "Arrowheads" + # Right-shifted > + sketch + include glyphs.greater AS_BASE ALSO_METRICS + save 'liggreater.shift0' + include : Translate (arrowheadsKern / 2) 0 + save 'liggreater.shift0h' + include : Translate (arrowheadsKern / 2) 0 + save 'liggreater.shift1' + include : Translate (arrowheadsKern / 2) 0 + save 'liggreater.shift1h' + include : Translate (arrowheadsKern / 2) 0 + save 'liggreater.shift2' + + # Left-shifted > + sketch + include glyphs.greater AS_BASE ALSO_METRICS + save 'liggreater.shiftN0' + include : Translate (-arrowheadsKern / 2) 0 + save 'liggreater.shiftN0h' + include : Translate (-arrowheadsKern / 2) 0 + save 'liggreater.shiftN1' + include : Translate (-arrowheadsKern / 2) 0 + save 'liggreater.shiftN1h' + include : Translate (-arrowheadsKern / 2) 0 + save 'liggreater.shiftN2' + + # Left-shifted < + sketch + include glyphs.less AS_BASE ALSO_METRICS + save 'ligless.shift0' + include : Translate (-arrowheadsKern / 2) 0 + save 'ligless.shift0h' + include : Translate (-arrowheadsKern / 2) 0 + save 'ligless.shift1' + include : Translate (-arrowheadsKern / 2) 0 + save 'ligless.shift1h' + include : Translate (-arrowheadsKern / 2) 0 + save 'ligless.shift2' + + # Right-shifted < + sketch + include glyphs.less AS_BASE ALSO_METRICS + save 'ligless.shiftN0' + include : Translate (arrowheadsKern / 2) 0 + save 'ligless.shiftN0h' + include : Translate (arrowheadsKern / 2) 0 + save 'ligless.shiftN1' + include : Translate (arrowheadsKern / 2) 0 + save 'ligless.shiftN1h' + include : Translate (arrowheadsKern / 2) 0 + save 'ligless.shiftN2' + + define [ArrowHeadHole] : Rect (symbolMid + dblArrowD - dblArrowSw) (symbolMid - dblArrowD + dblArrowSw) (-WIDTH) (2 * WIDTH) + + sketch + include : difference + glyph-construction : include glyphs.less + ArrowHeadHole + save 'ligless.hole' + + sketch + include : difference + glyph-construction : include glyphs.greater + ArrowHeadHole + save 'liggreater.hole' + + sketch + include : difference + glyph-construction : include glyphs.'ligless.shiftN1' + ArrowHeadHole + save 'ligless.shiftN1.hole' + + sketch + include : difference + glyph-construction : include glyphs.'liggreater.shiftN1' + ArrowHeadHole save 'liggreater.shiftN1.hole' \ No newline at end of file diff --git a/glyphs/symbol-punctuation.ptl b/glyphs/symbol-punctuation.ptl index 88b61249b..0c7383300 100644 --- a/glyphs/symbol-punctuation.ptl +++ b/glyphs/symbol-punctuation.ptl @@ -65,10 +65,13 @@ export : define [apply] : begin sketch # zNotationParenLeft local dim : ParenDim 0 - include : ParenShape OPERATORSTROKE include : intersection - VBarRight dim.inside dim.bottom dim.top OPERATORSTROKE - ParenShapeMask O + Rect [mix dim.bottom dim.top 2] [mix dim.top dim.bottom 2] 0 dim.inside + union + ParenShape OPERATORSTROKE + intersection + VBarRight dim.inside dim.bottom dim.top OPERATORSTROKE + ParenShapeMask O save 'zNotationParenLeft' 0x2987 sketch # zNotationParenRight diff --git a/meta/macros.ptl b/meta/macros.ptl index a40b11779..4f1ff0572 100644 --- a/meta/macros.ptl +++ b/meta/macros.ptl @@ -135,7 +135,7 @@ define-macro save : syntax-rules define-macro glyph-module-entry : syntax-rules `[glyph-module-entry @::_opts] : begin define optionalImports : object - commonShapes `[define [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned hcombine vcombine dual vdual fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor] $capture.commonShapes] + commonShapes `[define [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned hcombine vcombine dual vdual fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor CreateWaveShape] $capture.commonShapes] overmarks `[define [object markExtend markHalfStroke markStress markFine markMiddle markDotsRadius aboveMarkTop aboveMarkBot aboveMarkMid belowMarkBot belowMarkTop commaOvershoot commaOvershoot2 commaAboveRadius TildeShape HornShape HornMarkAnchor HornBaseAnchor] $capture.overmarks]