From 384a6fb10e67ed31f47360abeb3f8e333b41569d Mon Sep 17 00:00:00 2001 From: be5invis Date: Mon, 15 Jan 2024 23:07:46 -0800 Subject: [PATCH] Adjust serif shapes for lowercase italic Yeri glyphs with corner body shape (#2151). --- changes/28.0.6.md | 1 + packages/font-glyphs/src/common/shapes.ptl | 30 +- .../font-glyphs/src/letter/cyrillic/yeri.ptl | 327 ++++++++++-------- packages/font-glyphs/src/letter/shared.ptl | 21 +- packages/font-glyphs/src/meta/macros.ptl | 54 ++- verdafile.mjs | 2 +- 6 files changed, 248 insertions(+), 187 deletions(-) diff --git a/changes/28.0.6.md b/changes/28.0.6.md index 4c0607762..a56b98ac9 100644 --- a/changes/28.0.6.md +++ b/changes/28.0.6.md @@ -1 +1,2 @@ * Fix application of `APLF` for several [Uiua](https://www.uiua.org/) operators. +* Adjust serif shapes for lowercase italic Yeri glyphs with corner body shape (#2151). diff --git a/packages/font-glyphs/src/common/shapes.ptl b/packages/font-glyphs/src/common/shapes.ptl index 326c09b60..66809a4cb 100644 --- a/packages/font-glyphs/src/common/shapes.ptl +++ b/packages/font-glyphs/src/common/shapes.ptl @@ -515,25 +515,23 @@ glyph-block CommonShapes : begin return : HookShape before after false args glyph-block-export hookstart - define [hookstart] : begin - postulate - y - tight - sw -- Stroke - swItalicAdj -- sw - noAdjTerminalY -- false - turnSlope -- nothing + define flex-params [hookstart] : begin + local-parameter : y + local-parameter : tight + local-parameter : sw -- Stroke + local-parameter : swItalicAdj -- sw + local-parameter : noAdjTerminalY -- false + local-parameter : turnSlope -- nothing return : Interpolator hookStartBlender : object y tight sw swItalicAdj noAdjTerminalY turnSlope glyph-block-export hookend - define [hookend] : begin - postulate - y - tight - sw -- Stroke - swItalicAdj -- sw - noAdjTerminalY -- false - turnSlope -- nothing + define flex-params [hookend] : begin + local-parameter : y + local-parameter : tight + local-parameter : sw -- Stroke + local-parameter : swItalicAdj -- sw + local-parameter : noAdjTerminalY -- false + local-parameter : turnSlope -- nothing return : Interpolator hookEndBlender : object y tight sw swItalicAdj noAdjTerminalY turnSlope glyph-block-export Ungizmo diff --git a/packages/font-glyphs/src/letter/cyrillic/yeri.ptl b/packages/font-glyphs/src/letter/cyrillic/yeri.ptl index 98cc080e5..39049cae2 100644 --- a/packages/font-glyphs/src/letter/cyrillic/yeri.ptl +++ b/packages/font-glyphs/src/letter/cyrillic/yeri.ptl @@ -13,127 +13,162 @@ glyph-block Letter-Cyrillic-Yeri : begin define DefaultBarPos 0.55 - glyph-block-export CyrlYeriUprightShape - define [CyrlYeriUprightShape] : with-params [top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos] [yStart top]] : glyph-proc - local bowl : top * pBar + HalfStroke - local turnRadius : BowlXDepth bowl 0 left right stroke - local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) - local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) - local fine : stroke * CThinB + define Yeri : namespace + define flex-params [CornerCommon] : glyph-proc + local-parameter : top + local-parameter : left -- SB + local-parameter : right -- RightSB + local-parameter : stroke -- Stroke + local-parameter : jut -- Jut + local-parameter : pBar -- DefaultBarPos + local-parameter : yStart -- top - local yTurnBottomL : YSmoothMidL bowl 0 ada adb - local yTurnBottomR : YSmoothMidR bowl 0 ada adb + local bowl : top * pBar + HalfStroke + local turnRadius : BowlXDepth bowl 0 left right stroke + local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) + local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) + local fine : stroke * CThinB - include : union - dispiro - widths.lhs stroke - flat (left + Stroke * 0.2) 0 [heading Rightward] - curl ([Math.max (left + stroke * TanSlope) (right - turnRadius)] + CorrectionOMidX * stroke) 0 - archv 8 - g4 (right - OX) yTurnBottomR - arcvh 8 - flat ([Math.max (left + stroke * TanSlope) (right - turnRadius)] - CorrectionOMidX * stroke) bowl + local yTurnBottomL : YSmoothMidL bowl 0 ada adb + local yTurnBottomR : YSmoothMidR bowl 0 ada adb + + include : union + dispiro + widths.lhs stroke + flat (left + Stroke * 0.2) 0 [heading Rightward] + curl ([Math.max (left + stroke * TanSlope) (right - turnRadius)] + CorrectionOMidX * stroke) 0 + archv 8 + g4 (right - OX) yTurnBottomR + arcvh 8 + flat ([Math.max (left + stroke * TanSlope) (right - turnRadius)] - CorrectionOMidX * stroke) bowl + curl (left + Stroke * 0.2) bowl [heading Leftward] + VBar.l left 0 yStart stroke + + export : define flex-params [UprightShape] : glyph-proc + local-parameter : top + local-parameter : left -- SB + local-parameter : right -- RightSB + local-parameter : stroke -- Stroke + local-parameter : jut -- Jut + local-parameter : pBar -- DefaultBarPos + local-parameter : yStart -- top + + include : CornerCommon.apply null $-flex-arguments + if SLAB : begin + include : tagged 'serifYeriLB' : HSerif.lb left 0 (jut - [HSwToV : 0.5 * stroke]) stroke + include : tagged 'serifYeriLT' : HSerif.mt (left + [HSwToV : 0.5 * stroke]) top jut stroke + + export : define flex-params [ItalicShape] : glyph-proc + local-parameter : top + local-parameter : left -- SB + local-parameter : right -- RightSB + local-parameter : stroke -- Stroke + local-parameter : jut -- Jut + local-parameter : pBar -- DefaultBarPos + local-parameter : yStart -- top + + include : CornerCommon.apply null $-flex-arguments + if SLAB : begin + include : tagged 'serifYeriLT' : HSerif.lt left top (jut - [HSwToV : 0.5 * stroke]) stroke + + export : define flex-params [AutoItalicShape] : begin + if para.isItalic + : then : ItalicShape.apply null $-flex-arguments + : else : UprightShape.apply null $-flex-arguments + + export : define flex-params [RoundShape top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos] [yStart top]] : glyph-proc + local bowl : top * pBar + HalfStroke + local turnRadius : BowlXDepth bowl 0 left right stroke + local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) + local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) + local fine : stroke * CThinB + + local yTurnBottomL : YSmoothMidL bowl 0 ada adb + local yTurnBottomR : YSmoothMidR bowl 0 ada adb + + include : dispiro + flat left [Math.max yStart (yTurnBottomL + 0.1)] [widths.lhs.heading stroke Downward] + curl left yTurnBottomL + arcvh + g4 ([mix left right 0.5] + CorrectionOMidX * stroke) O + archv + g4 (right - OX) yTurnBottomR + arcvh + flat ([mix left right 0.5] - CorrectionOMidX * stroke) bowl curl (left + Stroke * 0.2) bowl [heading Leftward] - VBar.l left 0 yStart stroke - if SLAB : begin - include : tagged 'serifYeriLB' : HSerif.lb left 0 (jut - [HSwToV : 0.5 * stroke]) stroke - include : tagged 'serifYeriLT' : HSerif.mt (left + [HSwToV : 0.5 * stroke]) top jut stroke + if SLAB : begin + include : tagged 'serifYeriLT' : HSerif.lt left top (jut - [HSwToV : 0.5 * stroke]) stroke - glyph-block-export CyrlYeriRoundShape - define [CyrlYeriRoundShape] : with-params [top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos] [yStart top]] : glyph-proc - local bowl : top * pBar + HalfStroke - local turnRadius : BowlXDepth bowl 0 left right stroke - local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) - local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) - local fine : stroke * CThinB + export : define flex-params [CursiveShape top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos] [yStart top]] : glyph-proc + local bowl : top * pBar + HalfStroke + local turnRadius : BowlXDepth bowl 0 left right stroke + local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) + local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) + local fine : stroke * CThinB - local yTurnBottomL : YSmoothMidL bowl 0 ada adb - local yTurnBottomR : YSmoothMidR bowl 0 ada adb + local yTurnBottomL : YSmoothMidL bowl 0 ada adb + local yTurnBottomR : YSmoothMidR bowl 0 ada adb - include : dispiro - flat left [Math.max yStart (yTurnBottomL + 0.1)] [widths.lhs.heading stroke Downward] - curl left yTurnBottomL - arcvh - g4 ([mix left right 0.5] + CorrectionOMidX * stroke) O - archv - g4 (right - OX) yTurnBottomR - arcvh - flat ([mix left right 0.5] - CorrectionOMidX * stroke) bowl - curl (left + Stroke * 0.2) bowl [heading Leftward] + include : dispiro + flat left [Math.max yStart (yTurnBottomL + 0.1)] [widths.lhs.heading stroke Downward] + curl left yTurnBottomL + arcvh + g4 ([mix left right 0.5] + CorrectionOMidX * stroke) O + archv + g4 (right - OX) yTurnBottomR + arcvh + ShoulderMidKnotLhsRev [mix left right 0.5] bowl fine stroke (-1) (-1) + archv + g4.down.end (left + (stroke - fine) * HVContrast) yTurnBottomL [widths.lhs.heading fine Downward] - if SLAB : begin - include : tagged 'serifYeriLT' : HSerif.lt left top (jut - [HSwToV : 0.5 * stroke]) stroke + if SLAB : begin + include : tagged 'serifYeriLT' : HSerif.lt left top (jut - [HSwToV : 0.5 * stroke]) stroke - glyph-block-export CyrlYeriCursiveShape - define [CyrlYeriCursiveShape] : with-params [top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos] [yStart top]] : glyph-proc - local bowl : top * pBar + HalfStroke - local turnRadius : BowlXDepth bowl 0 left right stroke - local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) - local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) - local fine : stroke * CThinB + define RevYeri : namespace + export : define flex-params [Shape top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos]] : glyph-proc + local bowl : top * pBar + HalfStroke + local turnRadius : bowl * 0.45 + local turnbottom : mix 0 bowl (ArchDepthB / (ArchDepthA + ArchDepthB)) + local trShrink [Math.pow ((right - left) / (RightSB - SB)) 0.5] + include : dispiro + widths.rhs stroke + flat (right - Stroke * 0.2) 0 [heading Leftward] + curl (left + turnRadius * trShrink + CorrectionOMidX * stroke) 0 + archv + g4 (left + O) turnbottom + arcvh + flat (left + turnRadius * trShrink - CorrectionOMidX * stroke) bowl + curl (right - Stroke * 0.2) bowl [heading Rightward] + include : VBar.r right 0 top stroke + if SLAB : begin + include : tagged 'serifYeriRB' + HSerif.rb right 0 (jut - [HSwToV : 0.5 * stroke]) stroke + include : tagged 'serifYeriRT' + HSerif.mt (right - [HSwToV : 0.5 * stroke]) top jut stroke - local yTurnBottomL : YSmoothMidL bowl 0 ada adb - local yTurnBottomR : YSmoothMidR bowl 0 ada adb + export : define flex-params [RoundShape top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos] [yStart top]] : glyph-proc + local bowl : top * pBar + HalfStroke + local turnRadius : BowlXDepth bowl 0 left right stroke + local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) + local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) + local fine : stroke * CThinB - include : dispiro - flat left [Math.max yStart (yTurnBottomL + 0.1)] [widths.lhs.heading stroke Downward] - curl left yTurnBottomL - arcvh - g4 ([mix left right 0.5] + CorrectionOMidX * stroke) O - archv - g4 (right - OX) yTurnBottomR - arcvh - ShoulderMidKnotLhsRev [mix left right 0.5] bowl fine stroke (-1) (-1) - archv - g4.down.end (left + (stroke - fine) * HVContrast) yTurnBottomL [widths.lhs.heading fine Downward] + local yTurnBottomL : YSmoothMidL bowl 0 ada adb + local yTurnBottomR : YSmoothMidR bowl 0 ada adb - if SLAB : begin - include : tagged 'serifYeriLT' : HSerif.lt left top (jut - [HSwToV : 0.5 * stroke]) stroke + include : dispiro + flat right [Math.max yStart (yTurnBottomR + 0.1)] [widths.rhs.heading stroke Downward] + curl right yTurnBottomR + arcvh + g4 ([mix left right 0.5] + CorrectionOMidX * stroke) O + archv + g4 (left + OX) yTurnBottomL + arcvh + flat ([mix left right 0.5] - CorrectionOMidX * stroke) bowl + curl (right - Stroke * 0.2) bowl [heading Rightward] - define [RevCyrYeriShape] : with-params [top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos]] : glyph-proc - local bowl : top * pBar + HalfStroke - local turnRadius : bowl * 0.45 - local turnbottom : mix 0 bowl (ArchDepthB / (ArchDepthA + ArchDepthB)) - local trShrink [Math.pow ((right - left) / (RightSB - SB)) 0.5] - include : dispiro - widths.rhs stroke - flat (right - Stroke * 0.2) 0 [heading Leftward] - curl (left + turnRadius * trShrink + CorrectionOMidX * stroke) 0 - archv - g4 (left + O) turnbottom - arcvh - flat (left + turnRadius * trShrink - CorrectionOMidX * stroke) bowl - curl (right - Stroke * 0.2) bowl [heading Rightward] - include : VBar.r right 0 top stroke - if SLAB : begin - include : tagged 'serifYeriRB' - HSerif.rb right 0 (jut - [HSwToV : 0.5 * stroke]) stroke - include : tagged 'serifYeriRT' - HSerif.mt (right - [HSwToV : 0.5 * stroke]) top jut stroke - - define [RevCyrYeriRoundShape] : with-params [top [left SB] [right RightSB] [stroke Stroke] [jut Jut] [pBar DefaultBarPos] [yStart top]] : glyph-proc - local bowl : top * pBar + HalfStroke - local turnRadius : BowlXDepth bowl 0 left right stroke - local ada : ArchDepthAOf ArchDepth (right - left + SB * 2) - local adb : ArchDepthBOf ArchDepth (right - left + SB * 2) - local fine : stroke * CThinB - - local yTurnBottomL : YSmoothMidL bowl 0 ada adb - local yTurnBottomR : YSmoothMidR bowl 0 ada adb - - include : dispiro - flat right [Math.max yStart (yTurnBottomR + 0.1)] [widths.rhs.heading stroke Downward] - curl right yTurnBottomR - arcvh - g4 ([mix left right 0.5] + CorrectionOMidX * stroke) O - archv - g4 (left + OX) yTurnBottomL - arcvh - flat ([mix left right 0.5] - CorrectionOMidX * stroke) bowl - curl (right - Stroke * 0.2) bowl [heading Rightward] - - define [CyrBackYerShape] : with-params [Yeri top left right [stroke Stroke] [jut Jut] [pBar DefaultBarPos]] : glyph-proc + define flex-params [CyrBackYerShape Yeri top left right [stroke Stroke] [jut Jut] [pBar DefaultBarPos]] : glyph-proc local xLeftBarLeftEdge : Math.max (right - (RightSB - SB)) : if SLAB [mix left right 0.35] - [HSwToV : 0.50 * stroke] [mix left right 0.20] - [HSwToV : 0.25 * stroke] @@ -151,7 +186,7 @@ glyph-block Letter-Cyrillic-Yeri : begin include : VSerif.dl xTopBarLeftEnd top VJut Math.min (VJutStroke * stroke / Stroke) (0.625 * (xLeftBarLeftEdge - xTopBarLeftEnd)) - define [CyrNeutralYerShape] : with-params [Yeri top left right [stroke Stroke] [jut Jut]] : glyph-proc + define flex-params [CyrNeutralYerShape Yeri top left right [stroke Stroke] [jut Jut]] : glyph-proc local xLeftBarLeftEdge : Math.max (right - (RightSB - SB)) : if SLAB [mix left right 0.35] - [HSwToV : 0.50 * stroke] [mix left right 0.20] - [HSwToV : 0.25 * stroke] @@ -190,13 +225,15 @@ glyph-block Letter-Cyrillic-Yeri : begin RightwardTailedBar df.rightSB 0 top sw VBar.r df.rightSB 0 top sw + local useFullSerifs : Yeri === Yeri.UprightShape || Yeri === Yeri.AutoItalicShape && !para.isItalic + if SLAB : begin - include : tagged 'serifRT' : if (Yeri !== CyrlYeriUprightShape) - then : glyph-proc - else : HSerif.mt (df.rightSB - [HSwToV : 0.5 * sw]) top jut sw - if (!fTail) : include : tagged 'serifRB' : if (Yeri !== CyrlYeriUprightShape) - then : HSerif.rb df.rightSB 0 (jut - [HSwToV : 0.5 * sw]) sw - else : HSerif.mb (df.rightSB - [HSwToV : 0.5 * sw]) 0 jut sw + include : tagged 'serifRT' : if useFullSerifs + then : HSerif.mt (df.rightSB - [HSwToV : 0.5 * sw]) top jut sw + else : glyph-proc + if (!fTail) : include : tagged 'serifRB' : if useFullSerifs + then : HSerif.mb (df.rightSB - [HSwToV : 0.5 * sw]) 0 jut sw + else : HSerif.rb df.rightSB 0 (jut - [HSwToV : 0.5 * sw]) sw define [ZhuangToneSixShape Yeri top] : glyph-proc local xLeft : [mix SB RightSB 0.20] - [HSwToV : 0.125 * Stroke] @@ -208,17 +245,17 @@ glyph-block Letter-Cyrillic-Yeri : begin glyph-block-export YeriConfig define YeriConfig : object - corner { CyrlYeriUprightShape } - round { CyrlYeriRoundShape } - cursive { CyrlYeriCursiveShape } + corner { Yeri.UprightShape Yeri.AutoItalicShape } + round { Yeri.RoundShape Yeri.RoundShape } + cursive { Yeri.CursiveShape Yeri.CursiveShape } define YeryConfig : object - corner { CyrlYeriUprightShape false } - round { CyrlYeriRoundShape false } - cursive { CyrlYeriCursiveShape false } - cornerTailed { CyrlYeriUprightShape true } - roundTailed { CyrlYeriRoundShape true } - cursiveTailed { CyrlYeriCursiveShape true } + corner { Yeri.UprightShape Yeri.AutoItalicShape false } + round { Yeri.RoundShape Yeri.RoundShape false } + cursive { Yeri.CursiveShape Yeri.CursiveShape false } + cornerTailed { Yeri.UprightShape Yeri.AutoItalicShape true } + roundTailed { Yeri.RoundShape Yeri.RoundShape true } + cursiveTailed { Yeri.CursiveShape Yeri.CursiveShape true } define [YeriOverlayBar df top] : begin local stroke : AdviceStroke2 2 3 top @@ -227,69 +264,69 @@ glyph-block Letter-Cyrillic-Yeri : begin bot -- top * DefaultBarPos + stroke / 2 top -- top - [if SLAB Stroke 0] - foreach { suffix { Yeri } } [Object.entries YeriConfig] : do + foreach { suffix { Uc Lc } } [Object.entries YeriConfig] : do create-glyph "cyrl/Yeri.\(suffix)" : glyph-proc local df : include : DivFrame 1 include : df.markSet.capital - include : Yeri (left -- df.leftSB) (right -- df.rightSB) CAP + include : Uc (left -- df.leftSB) (right -- df.rightSB) CAP create-glyph "cyrl/yeri.\(suffix)" : glyph-proc local df : include : DivFrame 1 include : df.markSet.e - include : Yeri (left -- df.leftSB) (right -- df.rightSB) XH + include : Lc (left -- df.leftSB) (right -- df.rightSB) XH create-glyph "cyrl/YeriBar.\(suffix)" : glyph-proc local df : include : DivFrame 1 include : df.markSet.capital - include : Yeri (left -- df.leftSB) (right -- df.rightSB) CAP + include : Uc (left -- df.leftSB) (right -- df.rightSB) CAP include : YeriOverlayBar df CAP create-glyph "cyrl/yeriBar.\(suffix)" : glyph-proc local df : include : DivFrame 1 include : df.markSet.e - include : Yeri (left -- df.leftSB) (right -- df.rightSB) XH + include : Lc (left -- df.leftSB) (right -- df.rightSB) XH include : YeriOverlayBar df XH create-glyph "cyrl/Yer.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 0.5] include : df.markSet.capital - include : CyrBackYerShape Yeri CAP (left -- df.leftSB) (right -- df.rightSB) + include : CyrBackYerShape Uc CAP (left -- df.leftSB) (right -- df.rightSB) create-glyph "cyrl/yer.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 0.5] include : df.markSet.e - include : CyrBackYerShape Yeri XH (left -- df.leftSB) (right -- df.rightSB) + include : CyrBackYerShape Lc XH (left -- df.leftSB) (right -- df.rightSB) create-glyph "cyrl/yerTall.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 0.5] include : df.markSet.b - include : CyrBackYerShape Yeri Ascender (left -- df.leftSB) (right -- df.rightSB) (pBar -- DefaultBarPos * XH / Ascender) + include : CyrBackYerShape Lc Ascender (left -- df.leftSB) (right -- df.rightSB) (pBar -- DefaultBarPos * XH / Ascender) create-glyph "cyrl/YerNeutral.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 0.5] include : df.markSet.capital - include : CyrNeutralYerShape Yeri CAP (left -- df.leftSB) (right -- df.rightSB) + include : CyrNeutralYerShape Uc CAP (left -- df.leftSB) (right -- df.rightSB) create-glyph "cyrl/yerNeutral.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 0.5] include : df.markSet.e - include : CyrNeutralYerShape Yeri XH (left -- df.leftSB) (right -- df.rightSB) + include : CyrNeutralYerShape Lc XH (left -- df.leftSB) (right -- df.rightSB) create-glyph "ZhuangToneSix.\(suffix)" : glyph-proc include : MarkSet.capital - include : ZhuangToneSixShape Yeri CAP + include : ZhuangToneSixShape Uc CAP create-glyph "zhuangToneSix.\(suffix)" : glyph-proc include : MarkSet.e - include : ZhuangToneSixShape Yeri XH + include : ZhuangToneSixShape Lc XH - foreach { suffix { Yeri fTail } } [Object.entries YeryConfig] : do + foreach { suffix { Uc Lc fTail } } [Object.entries YeryConfig] : do create-glyph "cyrl/Yery.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 1.5] 3 include : df.markSet.capital - include : CyrYeryShape Yeri df CAP false fTail + include : CyrYeryShape Uc df CAP false fTail create-glyph "cyrl/yery.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 1.5] 3 include : df.markSet.e - include : CyrYeryShape Yeri df XH false fTail + include : CyrYeryShape Lc df XH false fTail create-glyph "cyrl/YeryBack.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 1.5] 3 include : df.markSet.capital - include : CyrYeryShape Yeri df CAP true fTail + include : CyrYeryShape Uc df CAP true fTail create-glyph "cyrl/yeryBack.\(suffix)" : glyph-proc local df : include : DivFrame [mix 1 para.diversityM 1.5] 3 include : df.markSet.e - include : CyrYeryShape Yeri df XH true fTail + include : CyrYeryShape Lc df XH true fTail select-variant 'cyrl/Yer' 0x42A select-variant 'cyrl/yer' 0x44A @@ -313,7 +350,7 @@ glyph-block Letter-Cyrillic-Yeri : begin create-glyph 'cyrl/Be' 0x411 : glyph-proc include : MarkSet.capital - include : CyrlYeriUprightShape CAP + include : Yeri.UprightShape CAP include : HBar.m SB [mix SB RightSB 0.9] (CAP - HalfStroke) if SLAB : begin include : VSerif.dr [mix SB RightSB 0.9] CAP VJut @@ -322,21 +359,21 @@ glyph-block Letter-Cyrillic-Yeri : begin create-glyph 'latn/De' 0x18B : glyph-proc include : MarkSet.capital - include : RevCyrYeriShape CAP + include : RevYeri.Shape CAP include : HBar.t [mix RightSB SB 0.9] (RightSB + O) CAP if SLAB : begin include : VSerif.dl [mix RightSB SB 0.9] CAP VJut create-glyph 'cyrl/DeKomi' 0x500 : glyph-proc include : MarkSet.capital - include : RevCyrYeriShape CAP + include : RevYeri.Shape CAP create-glyph 'cyrl/DjeKomi' 0x502 : glyph-proc local df : include : DivFrame para.diversityM 3 include : df.markSet.capital local xm : df.middle + [HSwToV : 0.5 * df.mvs] - include : RevCyrYeriRoundShape CAP df.leftSB xm df.mvs + include : RevYeri.RoundShape CAP df.leftSB xm df.mvs include : UpwardHookShape left -- df.middle - [HSwToV : 0.5 * df.mvs] right -- df.rightSB diff --git a/packages/font-glyphs/src/letter/shared.ptl b/packages/font-glyphs/src/letter/shared.ptl index ae89fb89a..876e66313 100644 --- a/packages/font-glyphs/src/letter/shared.ptl +++ b/packages/font-glyphs/src/letter/shared.ptl @@ -763,17 +763,16 @@ glyph-block Letter-Shared-Shapes : begin return : new CSerifFrame this.top this.bot l1 r1 this.swRef this.swSerif this.div (r - l + 1) glyph-block-export SerifFrame - define [SerifFrame] : begin - postulate - top - bot - left - right - swRef -- Stroke - swSerif -- swRef - div -- 1 - hSplit -- 2 - fForceSymmetric -- false + define flex-params [SerifFrame] : begin + local-parameter : top + local-parameter : bot + local-parameter : left + local-parameter : right + local-parameter : swRef -- Stroke + local-parameter : swSerif -- swRef + local-parameter : div -- 1 + local-parameter : hSplit -- 2 + local-parameter : fForceSymmetric -- false return : new CSerifFrame top bot left right swRef swSerif div hSplit fForceSymmetric define SerifFrame.fromDf : function [] : with-params [df top bot [swSerif df.mvs]] : begin diff --git a/packages/font-glyphs/src/meta/macros.ptl b/packages/font-glyphs/src/meta/macros.ptl index 6900c9838..c1aa87606 100644 --- a/packages/font-glyphs/src/meta/macros.ptl +++ b/packages/font-glyphs/src/meta/macros.ptl @@ -20,16 +20,15 @@ define-macro Just : begin return m -define-macro postulate : syntax-rules - `[postulate @::$pairs] : begin - local ta : env.newt +define-macro $$InitFlexParameters$$ : syntax-rules + `[$$InitFlexParameters$$ @::$pairs] : begin local tb : env.newt local t : env.newt local ps `[begin - [local @ta : {}.slice.call arguments 0] + [local $-flex-arguments : {}.slice.call arguments 0] [local @tb {}] - [for [local @t 0] (@t < @ta.length) [inc @t] : if [not : @ta.(@t) <@ $NamedParameterPair$] : @tb.push @ta.(@t)] + [for [local @t 0] (@t < $-flex-arguments.length) [inc @t] : if [not : $-flex-arguments.(@t) <@ $NamedParameterPair$] : @tb.push $-flex-arguments.(@t)] ] local declarations `[begin] @@ -40,8 +39,6 @@ define-macro postulate : syntax-rules local j 0 foreach $pf [items-of $pairs] : begin local name - local pf : formOf $pf - match [formOf $pf] pf [atom pf] : begin declarations.push `[local @pf] @@ -59,25 +56,54 @@ define-macro postulate : syntax-rules declarations.push `[local @decl] indexAssigns.push `[set @decl : fallback @decl (@tb).(@{".quote" j}) @dflt] set name decl - {".operatorPiece" decl '--' dflt} : begin - declarations.push `[local @decl] - indexAssigns.push `[set @decl : fallback @decl (@tb).(@{".quote" j}) @dflt] - set name decl - true : throw : new Error "Invalid postulation syntax" + {".operatorPiece" :: items} : match [opSegToRegular items [scopeOf $pf]] + `(@decl -- @dflt) : begin + declarations.push `[local @decl] + indexAssigns.push `[set @decl : fallback @decl (@tb).(@{".quote" j}) @dflt] + set name decl + ____ : throw : new Error "Invalid postulation syntax" + ____ : throw : new Error "Invalid postulation syntax" namedAssigns.push `[if (@t && @t <@ $NamedParameterPair$ && @t.left == @{".quote" name}) [set @name @t.right]] inc j ps.push declarations - ps.push `[foreach [@t : items-of @ta] @namedAssigns] + ps.push `[foreach [@t : items-of $-flex-arguments] @namedAssigns] ps.push indexAssigns ps.push tearDowns return : dirty ps +# TODO: replace this with the new [with-params] define-macro with-params : syntax-rules - `[with-params @_pairs @body] : dirty `[begin [postulate @::[formOf _pairs]] @[formOf body]] + `[with-params @_pairs @body] : dirty `[begin + [$$InitFlexParameters$$ @::[formOf _pairs]] + @[formOf body] + ] + +define-macro flex-params : syntax-rules + `[flex-params @_lam] : begin + local lam : formOf _lam + local lamArgs lam.1 + local {lamBodyLeader :: lamBodyStatements} lam.2 + + local finalStatements {} + + foreach stmt [items-of lamBodyStatements] : begin + if ([Array.isArray stmt] && stmt.0 == 'local-parameter') + : then : begin + lamArgs.push stmt.1 + : else : begin + finalStatements.push stmt + + return : dirty {'.lambda' + {} + `[begin + [$$InitFlexParameters$$ @::lamArgs] + @{lamBodyLeader :: finalStatements} + ] + } ### Necessary macros # A glyph construction is a function which "modifies" a glyph. diff --git a/verdafile.mjs b/verdafile.mjs index 2625d1b78..b767c0f68 100644 --- a/verdafile.mjs +++ b/verdafile.mjs @@ -1171,7 +1171,7 @@ const CompiledJs = file.make( p => p, async (target, out) => { const ptl = replaceExt(".ptl", out.full); - if (/\/glyphs\//.test(out.full)) await target.need(MARCOS); + await target.need(MARCOS); await target.need(sfu(ptl)); echo.action(echo.hl.command("Compile Script"), ptl); await silently.run(PATEL_C, "--strict", "--esm", ptl, "-o", out.full);