From d1adbfc7f9df4096d65fff809116d2f8e34532f6 Mon Sep 17 00:00:00 2001 From: be5invis Date: Mon, 25 Jan 2021 22:04:35 -0800 Subject: [PATCH] Add oval slashed / dotted variants for `0` (#834). --- changes/5.0.0-beta.3.md | 3 +- font-src/glyphs/number/0.ptl | 117 +++++++++++++++++++++++++++-------- params/variants.toml | 52 +++++++++++----- 3 files changed, 128 insertions(+), 44 deletions(-) diff --git a/changes/5.0.0-beta.3.md b/changes/5.0.0-beta.3.md index 69b451052..71f2b76f1 100644 --- a/changes/5.0.0-beta.3.md +++ b/changes/5.0.0-beta.3.md @@ -1,3 +1,4 @@ * Fix the incorrect order of `capital-s` (`cv17`) and `capital-t` (`cv18`) variants (#831). * Fix Misplaced serif in Slab `cyrl/e` (#832). - * Fix variant selector for `cyrl/shcha` (#833). \ No newline at end of file + * Fix variant selector for `cyrl/shcha` (#833). + * Add oval slashed / dotted variants for `0` (#834). \ No newline at end of file diff --git a/font-src/glyphs/number/0.ptl b/font-src/glyphs/number/0.ptl index 12a7ce29b..e7ec37981 100644 --- a/font-src/glyphs/number/0.ptl +++ b/font-src/glyphs/number/0.ptl @@ -11,21 +11,33 @@ glyph-block Digits-Zero : begin glyph-block-import Common-Derivatives glyph-block-import Digits-Shared : OnumHeight OnumMarks CodeLnum CodeOnum - define [ZeroSlashShape top] : begin - local fine : 0.5 * OverlayStroke - return : intersection - OShapeOutline.NoOvershoot top 0 SB RightSB - dispiro - flat 0 (top * (1 - 0.77)) [widths fine fine] - curl Width (top * 0.77) + define [OvalShapeT sink offsetY offsetX t b l r] : let [m : mix l r 0.5] : sink + widths.rhs + g4 (m - CorrectionOMidS) (t - offsetY) + archv + g4 (r - offsetX) [YSmoothMidR t b SmallSmoothA SmallSmoothB] + arcvh + g4 (m + CorrectionOMidS) (b + offsetY) + archv + g4 (l + offsetX) [YSmoothMidL t b SmallSmoothA SmallSmoothB] + arcvh + close - define [ZeroReverseSlashShape top] : begin - local fine : 0.5 * OverlayStroke - return : intersection - OShapeOutline.NoOvershoot top 0 SB RightSB - dispiro - flat 0 (top * 0.77) [widths fine fine] - curl Width (top * (1 - 0.77)) + define [ZeroSlash top] : dispiro + flat 0 (top * (1 - 0.77)) [widths.center OverlayStroke] + curl Width (top * 0.77) + + define [ZeroReverseSlash top] : dispiro + flat 0 (top * 0.77) [widths.center OverlayStroke] + curl Width (top * (1 - 0.77)) + + define [ZeroSlashShape top] : intersection + OShapeOutline.NoOvershoot top 0 SB RightSB + ZeroSlash top + + define [ZeroReverseSlashShape top] : intersection + OShapeOutline.NoOvershoot top 0 SB RightSB + ZeroReverseSlash top define [ZeroDotShape top] : begin local halfDotWidth : Math.min DotRadius ((RightSB - SB - HVContrast * Stroke * 2) / 4) @@ -51,17 +63,28 @@ glyph-block Digits-Zero : begin SmoothAOf halfDotWidth (halfDotWidth * 2) SmoothBOf halfDotWidth (halfDotWidth * 2) - define [ZeroOvalShape top] : dispiro - widths.rhs - g4 (Middle - CorrectionOMidS) (CAP - O) - archv - g4 (RightSB - OX) [YSmoothMidR CAP 0 SmallSmoothA SmallSmoothB] - arcvh - g4 (Middle + CorrectionOMidS) O - archv - g4 (SB + OX) [YSmoothMidL CAP 0 SmallSmoothA SmallSmoothB] - arcvh - close + define [ZeroOvalShapeT sink offsetX offsetY top] : OvalShapeT sink (OX + offsetX) (O + offsetY) top 0 SB RightSB + + define [ZeroOvalShape top] : ZeroOvalShapeT dispiro 0 0 top + define [ZeroOvalShapeMask top] : ZeroOvalShapeT dispiro 1 1 top + + define [ZeroOvalDotShape top] : begin + local halfDotWidth : Math.min DotRadius ((RightSB - SB - HVContrast * Stroke * 2) / 4) + return : OvalShapeT spiro-outline OX O + top / 2 + DotRadius + top / 2 - DotRadius + Middle - halfDotWidth + Middle + halfDotWidth + + define [ZeroOvalLongDotShape top] : begin + local circleInnerWidth : RightSB - SB - HVContrast * Stroke * 2 + local halfDotWidth : Math.min HalfStroke (circleInnerWidth / 4) + local halfDotHeight : Math.max DotRadius : Math.min ((top - Stroke * 2) / 4) ((top - Stroke * 2 - (circleInnerWidth - halfDotWidth * 2)) / 2) + return : OvalShapeT spiro-outline OX O + top / 2 + halfDotHeight + top / 2 - halfDotHeight + Middle - halfDotWidth + Middle + halfDotWidth create-glyph 'zero.lnum.unslashed' : glyph-proc include : MarkSet.capital @@ -76,21 +99,41 @@ glyph-block Digits-Zero : begin include : refer-glyph "zero.lnum.unslashed" include : ZeroSlashShape CAP - create-glyph 'zero.lnum.reverse-slashed' : glyph-proc + create-glyph 'zero.lnum.slashedOval' : glyph-proc + include : MarkSet.capital + include : refer-glyph "zero.lnum.unslashedOval" + include : intersection [ZeroOvalShapeMask CAP] [ZeroSlash CAP] + + create-glyph 'zero.lnum.reverseSlashed' : glyph-proc include : MarkSet.capital include : refer-glyph "zero.lnum.unslashed" include : ZeroReverseSlashShape CAP + create-glyph 'zero.lnum.reverseSlashedOval' : glyph-proc + include : MarkSet.capital + include : refer-glyph "zero.lnum.unslashedOval" + include : intersection [ZeroOvalShapeMask CAP] [ZeroReverseSlash CAP] + create-glyph 'zero.lnum.dotted' : glyph-proc include : MarkSet.capital include : refer-glyph "zero.lnum.unslashed" include : ZeroDotShape CAP + create-glyph 'zero.lnum.dottedOval' : glyph-proc + include : MarkSet.capital + include : refer-glyph "zero.lnum.unslashedOval" + include : ZeroOvalDotShape CAP + create-glyph 'zero.lnum.longDotted' : glyph-proc include : MarkSet.capital include : refer-glyph "zero.lnum.unslashed" include : ZeroLongDotShape CAP + create-glyph 'zero.lnum.longDottedOval' : glyph-proc + include : MarkSet.capital + include : refer-glyph "zero.lnum.unslashedOval" + include : ZeroOvalLongDotShape CAP + create-glyph 'zero.onum.unslashed' : glyph-proc include : OnumMarks.e include : OShape OnumHeight 0 SB RightSB @@ -104,21 +147,41 @@ glyph-block Digits-Zero : begin include : refer-glyph "zero.onum.unslashed" include : ZeroSlashShape OnumHeight - create-glyph 'zero.onum.reverse-slashed' : glyph-proc + create-glyph 'zero.onum.slashedOval' : glyph-proc + include : OnumMarks.e + include : refer-glyph "zero.onum.unslashedOval" + include : intersection [ZeroOvalShapeMask OnumHeight] [ZeroSlash OnumHeight] + + create-glyph 'zero.onum.reverseSlashed' : glyph-proc include : OnumMarks.e include : refer-glyph "zero.onum.unslashed" include : ZeroReverseSlashShape OnumHeight + create-glyph 'zero.onum.reverseSlashedOval' : glyph-proc + include : OnumMarks.e + include : refer-glyph "zero.onum.unslashedOval" + include : intersection [ZeroOvalShapeMask OnumHeight] [ZeroReverseSlash OnumHeight] + create-glyph 'zero.onum.dotted' : glyph-proc include : OnumMarks.e include : refer-glyph "zero.onum.unslashed" include : ZeroDotShape OnumHeight + create-glyph 'zero.onum.dottedOval' : glyph-proc + include : OnumMarks.e + include : refer-glyph "zero.onum.unslashedOval" + include : ZeroOvalDotShape OnumHeight + create-glyph 'zero.onum.longDotted' : glyph-proc include : OnumMarks.e include : refer-glyph "zero.onum.unslashed" include : ZeroLongDotShape OnumHeight + create-glyph 'zero.onum.longDottedOval' : glyph-proc + include : OnumMarks.e + include : refer-glyph "zero.onum.unslashedOval" + include : ZeroOvalLongDotShape OnumHeight + select-variant 'zero.lnum' [CodeLnum '0'] (follow -- 'zero') select-variant 'zero.onum' [CodeOnum '0'] (follow -- 'zero') diff --git a/params/variants.toml b/params/variants.toml index 058574b30..e4a1639c3 100644 --- a/params/variants.toml +++ b/params/variants.toml @@ -2354,36 +2354,56 @@ selector."cyrl/U" = "cursiveFlatHook" sampler = '0' tag = 'cv53' -[prime.zero.variants.slashed] -rank = 1 -description = 'Slashed Zero `0`' -selector.zero = 'slashed' - -[prime.zero.variants.dotted] -rank = 2 -description = 'Dotted Zero `0`' -selector.zero = 'dotted' - [prime.zero.variants.unslashed] -rank = 3 -description = 'O-like `0`' +rank = 1 +description = 'O-like Zero (`0`)' selector.zero = 'unslashed' +[prime.zero.variants.slashed] +rank = 2 +description = 'Slashed Zero (`0`)' +selector.zero = 'slashed' + [prime.zero.variants.reverse-slashed] +rank = 3 +description = 'Reverse-slashed Zero (`0`)' +selector.zero = 'reverseSlashed' + +[prime.zero.variants.dotted] rank = 4 -description = 'Reverse-slashed `0`' -selector.zero = 'reverse-slashed' +description = 'Dotted Zero (`0`)' +selector.zero = 'dotted' [prime.zero.variants.long-dotted] rank = 5 -description = 'Long-dotted Zero `0` like Hack' +description = 'Long-dotted Zero (`0`) like Hack' selector.zero = 'longDotted' [prime.zero.variants.unslashed-oval] rank = 6 -description = 'O-like `0` but more round' +description = 'O-like Zero (`0`) but more round' selector.zero = 'unslashedOval' +[prime.zero.variants.slashed-oval] +rank = 7 +description = 'Slashed Zero (`0`) but more round' +selector.zero = 'slashedOval' + +[prime.zero.variants.reverse-slashed-oval] +rank = 8 +description = 'Reverse-slashed Zero (`0`) but more round' +selector.zero = 'reverseSlashedOval' + +[prime.zero.variants.dotted-oval] +rank = 9 +description = 'Dotted Zero (`0`)' +selector.zero = 'dottedOval' + +[prime.zero.variants.long-dotted-oval] +rank = 10 +description = 'Long-dotted Zero (`0`) like Hack' +selector.zero = 'longDottedOval' + [prime.one]