From 06dc4cfcfb59a28f94e0b65a2b6ae9a65e2f7e0e Mon Sep 17 00:00:00 2001 From: Logo <21302803+Logo121@users.noreply.github.com> Date: Mon, 22 May 2023 03:32:31 +0800 Subject: [PATCH] (Draft) Testing a few backlogged Zero variants (+ a few others) (#1734) * zeros test * minor logic fix * Refinements and "completing" the set * forgot to remove the PUA aliases --- changes/23.0.0.md | 1 + font-src/glyphs/number/0.ptl | 139 +++++++++++--- font-src/glyphs/symbol/pictograph/i-ching.ptl | 4 +- params/variants.toml | 174 ++++++++++++++++-- 4 files changed, 275 insertions(+), 43 deletions(-) diff --git a/changes/23.0.0.md b/changes/23.0.0.md index 225891db5..aa552e848 100644 --- a/changes/23.0.0.md +++ b/changes/23.0.0.md @@ -1,4 +1,5 @@ * \[**BREAKING**\] Add serifed and diagonal-tailed variants for Long S. As a result, current variants are reordered (#1728, #1729). +* \[**BREAKING**\] Add taller slash, broken slash and broken zero variants for Zero. As a result, current variants are reordered (#1307, #1509, #1678). * Add Characters: - CYRILLIC SMALL LETTER NARROW O (`U+1C82`) (#1517). - CYRILLIC SMALL LETTER UNBLENDED UK (`U+1C88`) (#1517). diff --git a/font-src/glyphs/number/0.ptl b/font-src/glyphs/number/0.ptl index 4cad7e174..4cda30c89 100644 --- a/font-src/glyphs/number/0.ptl +++ b/font-src/glyphs/number/0.ptl @@ -10,6 +10,11 @@ glyph-block Digits-Zero : begin glyph-block-import Common-Derivatives glyph-block-import Digits-Shared : OnumHeight OnumMarks CodeLnum CodeOnum + define CircleInnerWidth : RightSB - SB - HVContrast * Stroke * 2 + define SplitSlashGap : Stroke * HVContrast + [clamp (CircleInnerWidth / 5) (CircleInnerWidth / 3) ([AdviceStroke 5] * HVContrast)] + define CutoutVerticalStrokeWidth : Math.max (0.2 * CircleInnerWidth) : Math.min (0.4 * CircleInnerWidth) [AdviceStroke 3] + define [CutoutStrokeWidth top] : Math.max (0.1 * top) : Math.min (0.125 * top) (0.5 * CircleInnerWidth) [AdviceStroke 3] + define [OvalShapeT sink t b l r pHAdj] : let [m : mix l r 0.5] : sink widths.rhs g4 (m - [fallback pHAdj 1] * CorrectionOMidS) (t - O) @@ -31,16 +36,76 @@ glyph-block Digits-Zero : begin define [ZeroOvalMask top] : ZeroOvalShapeT spiro-outline 1 1 top - define [ZeroSlash top] : dispiro - flat 0 (top * (1 - 0.77)) [widths.center OverlayStroke] - curl Width (top * 0.77) + define [InsetShape zero overlay fnMask height] : glyph-proc + include zero + if fnMask + include : intersection overlay + WithTransform [ApparentTranslate (-SplitSlashGap) 0] [fnMask height] + WithTransform [ApparentTranslate SplitSlashGap 0] [fnMask height] + include overlay - define [ZeroReverseSlash top] : dispiro - flat 0 (top * 0.77) [widths.center OverlayStroke] + define [Cutout zero overlay fnMask height] : glyph-proc + if overlay + include : difference zero overlay + include zero + + + define [ZeroSlash top] : dispiro + flat 0 (top * (1 - 0.77)) [widths.center OverlayStroke] + curl Width (top * 0.77) + define [ZeroRevSlash top] : dispiro + flat 0 (top * 0.77) [widths.center OverlayStroke] curl Width (top * (1 - 0.77)) - define CircleInnerWidth : RightSB - SB - HVContrast * Stroke * 2 - define SplitSlashGap : Stroke * HVContrast + [clamp (CircleInnerWidth / 5) (CircleInnerWidth / 3) ([AdviceStroke 5] * HVContrast)] + define [ZeroTallSlash top] : dispiro + flat 0 0 [widths.center OverlayStroke] + curl Width top + define [ZeroTallRevSlash top] : dispiro + flat 0 top [widths.center OverlayStroke] + curl Width 0 + + define [CutoutSlash top] : dispiro + flat 0 (top * (1 - 0.77)) [widths.center [CutoutStrokeWidth top]] + curl Width (top * 0.77) + define [CutoutRevSlash top] : dispiro + flat 0 (top * 0.77) [widths.center [CutoutStrokeWidth top]] + curl Width (top * (1 - 0.77)) + + define [CutoutTallSlash top] : dispiro + flat 0 0 [widths.center [CutoutStrokeWidth top]] + curl Width top + define [CutoutTallRevSlash top] : dispiro + flat 0 top [widths.center [CutoutStrokeWidth top]] + curl Width 0 + + define [CutoutVerticalBar top] : VBar.m Middle (0 + O) (top - O) CutoutVerticalStrokeWidth + + define [TopRightCutoutSlash top] : intersection + MaskRight Middle + dispiro + flat 0 (top - Width * 0.875) [widths.center [CutoutStrokeWidth top]] + curl (Width * 0.875) top + + define [BrokenTallSlash top] : difference + dispiro + flat (SB + OX + 0.5 * OverlayStroke) [mix top 0 1.05] [widths.center OverlayStroke] + curl (RightSB - OX - 0.5 * OverlayStroke) [mix 0 top 1.05] + intersection + MaskAbove (top * 0.425) + MaskBelow (top * (1 - 0.425)) + define [BrokenTallRevSlash top] : difference + dispiro + flat (SB + OX + 0.5 * OverlayStroke) [mix 0 top 1.05] [widths.center OverlayStroke] + curl (RightSB - OX - 0.5 * OverlayStroke) [mix top 0 1.05] + intersection + MaskAbove (top * 0.425) + MaskBelow (top * (1 - 0.425)) + + define [BrokenVerticalBar top] : difference + VBar.m Middle (0 + O) (top - O) [Math.min (CircleInnerWidth * 0.5) OverlayStroke] + intersection + MaskAbove (top * 0.375) + MaskBelow (top * (1 - 0.375)) define [ZeroDotShape top] : begin local halfDotWidth : Math.min DotRadius (CircleInnerWidth / 4) @@ -85,35 +150,49 @@ glyph-block Digits-Zero : begin begin 0 define ZeroConfig : object - 'unslashed' { ZeroOutlineShape ZeroOutlineMask null 0 } - 'slashed' { ZeroOutlineShape ZeroOutlineMask ZeroSlash 0 } - 'reverseSlashed' { ZeroOutlineShape ZeroOutlineMask ZeroReverseSlash 0 } - 'slashedSplit' { ZeroOutlineShape ZeroOutlineMask ZeroSlash SplitSlashGap } - 'reverseSlashedSplit' { ZeroOutlineShape ZeroOutlineMask ZeroReverseSlash SplitSlashGap } - 'dotted' { ZeroOutlineShape ZeroOutlineMask ZeroDotShape 0 } - 'longDotted' { ZeroOutlineShape ZeroOutlineMask ZeroLongDotShape 0 } - 'unslashedOval' { ZeroOvalShape ZeroOvalMask null 0 } - 'slashedOval' { ZeroOvalShape ZeroOvalMask ZeroSlash 0 } - 'reverseSlashedOval' { ZeroOvalShape ZeroOvalMask ZeroReverseSlash 0 } - 'slashedSplitOval' { ZeroOvalShape ZeroOvalMask ZeroSlash SplitSlashGap } - 'reverseSlashedSplitOval' { ZeroOvalShape ZeroOvalMask ZeroReverseSlash SplitSlashGap } - 'dottedOval' { ZeroOvalShape ZeroOvalMask ZeroOvalDotShape 0 } - 'longDottedOval' { ZeroOvalShape ZeroOvalMask ZeroOvalLongDotShape 0 } + 'unslashed' { null null } + 'slashed' { ZeroSlash null } + 'reverseSlashed' { ZeroRevSlash null } + 'tallSlashed' { ZeroTallSlash null } + 'tallReverseSlashed' { ZeroTallRevSlash null } + 'dotted' { ZeroDotShape null } + 'longDotted' { ZeroLongDotShape null } + 'slashedSplit' { ZeroSlash InsetShape } + 'reverseSlashedSplit' { ZeroRevSlash InsetShape } + 'brokenSlash' { BrokenTallSlash null } + 'brokenReverseSlash' { BrokenTallRevSlash null } + 'brokenVerticalBar' { BrokenVerticalBar null } + 'slashedCutout' { CutoutSlash Cutout } + 'reverseSlashedCutout' { CutoutRevSlash Cutout } + 'tallSlashedCutout' { CutoutTallSlash Cutout } + 'tallReverseSlashedCutout' { CutoutTallRevSlash Cutout } + 'verticalBarCutout' { CutoutVerticalBar Cutout } + 'topRightCutout' { TopRightCutoutSlash Cutout } + + define Shapes : object + '' { ZeroOutlineShape ZeroOutlineMask } + 'Oval' { ZeroOvalShape ZeroOvalMask } define Infixes : object 'lnum' { CAP [function [] : MarkSet.capital] } 'onum' { OnumHeight [function [] : OnumMarks.e] } - foreach { suffix { Outline Mask Overlay gap } } [Object.entries ZeroConfig] : begin + foreach { shapeSuffix { Outline Mask } } [Object.entries Shapes] : begin foreach { infix { height Marks } } [Object.entries Infixes] : begin - create-glyph "zero.\(infix).\(suffix)" : glyph-proc - include : Marks - include : Outline height - if Overlay : if Mask - then : include : intersection [Overlay height] - WithTransform [ApparentTranslate (-gap) 0] [Mask height] - WithTransform [ApparentTranslate gap 0] [Mask height] - else : include : Overlay height + local zeroShape : Outline height + foreach { suffix { Overlay Postproc } } [Object.entries ZeroConfig] : begin + create-glyph "zero.\(infix).\(suffix)\(shapeSuffix)" : glyph-proc + include : Marks + + local overlayShape : if Overlay [Overlay height] null + if Postproc + : then : begin + include : Postproc zeroShape overlayShape Mask height + : else : begin + include zeroShape + if Overlay : if Mask + include : intersection overlayShape : Mask height + include overlayShape select-variant 'zero.lnum' [CodeLnum '0'] (follow -- 'zero') select-variant 'zero.onum' [CodeOnum '0'] (follow -- 'zero') diff --git a/font-src/glyphs/symbol/pictograph/i-ching.ptl b/font-src/glyphs/symbol/pictograph/i-ching.ptl index 684f27413..4e74770e6 100644 --- a/font-src/glyphs/symbol/pictograph/i-ching.ptl +++ b/font-src/glyphs/symbol/pictograph/i-ching.ptl @@ -56,11 +56,11 @@ glyph-block Symbol-Pictograph-I-Ching : begin define [stringPatterns su pats] : foreach [offset: range 0 pats.length] : begin local pat pats.(offset) - create-glyph ('iChing/Pattern/txj/' + pat) (su + offset) : stringPattern pat + create-glyph ('iChing/Pattern/txj/' + pat) (su + offset) : stringPattern pat define [ternaryPatterns n su] : foreach [offset: range 0 [Math.pow 3 n]] : begin local pat : [offset.toString 3].padStart n '0' - create-glyph ('iChing/Pattern/txj/' + pat) (su + offset) : stringPattern pat + create-glyph ('iChing/Pattern/txj/' + pat) (su + offset) : stringPattern pat patterns 1 0x268A patterns 2 0x268C diff --git a/params/variants.toml b/params/variants.toml index b19b3ff17..fe2747439 100644 --- a/params/variants.toml +++ b/params/variants.toml @@ -6110,84 +6110,236 @@ selector.zero = "reverseSlashed" selector."zero/forceSlashed" = "slashed" selector."zero/forceUnslashed" = "unslashed" -[prime.zero.variants.dotted] +[prime.zero.variants.tall-slashed] rank = 4 +description = "Slashed Zero (`0`) with a taller slash" +selector.zero = "tallSlashed" +selector."zero/forceSlashed" = "tallSlashed" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.tall-reverse-slashed] +rank = 5 +description = "Reverse-slashed Zero (`0`) with a taller slash" +selector.zero = "tallReverseSlashed" +selector."zero/forceSlashed" = "tallSlashed" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.dotted] +rank = 6 description = "Dotted Zero (`0`)" selector.zero = "dotted" selector."zero/forceSlashed" = "slashed" selector."zero/forceUnslashed" = "unslashed" [prime.zero.variants.long-dotted] -rank = 5 +rank = 7 description = "Long-dotted Zero (`0`) like Hack" selector.zero = "longDotted" selector."zero/forceSlashed" = "slashed" selector."zero/forceUnslashed" = "unslashed" [prime.zero.variants.slashed-split] -rank = 6 +rank = 8 description = "Slashed Zero (`0`) with slash separated from the outline" selector.zero = "slashedSplit" selector."zero/forceSlashed" = "slashedSplit" selector."zero/forceUnslashed" = "unslashed" [prime.zero.variants.reverse-slashed-split] -rank = 7 +rank = 9 description = "Reverse-slashed Zero (`0`) with slash separated from the outline" selector.zero = "reverseSlashedSplit" selector."zero/forceSlashed" = "slashedSplit" selector."zero/forceUnslashed" = "unslashed" +[prime.zero.variants.broken-slash] +rank = 10 +description = "Slashed Zero (`0`) with slash broken in the middle like Fixedsys" +selector.zero = "brokenSlash" +selector."zero/forceSlashed" = "brokenSlash" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.broken-reverse-slash] +rank = 11 +description = "Reverse-slashed Zero (`0`) with slash broken in the middle" +selector.zero = "brokenReverseSlash" +selector."zero/forceSlashed" = "brokenSlash" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.broken-vertical-bar] +rank = 12 +description = "Zero (`0`) with vertical bar broken in the middle" +selector.zero = "brokenVerticalBar" +selector."zero/forceSlashed" = "brokenSlash" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.slashed-cutout] +rank = 13 +description = "O-like Zero (`0`) with a slash cutout" +selector.zero = "slashedCutout" +selector."zero/forceSlashed" = "slashed" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.reverse-slashed-cutout] +rank = 14 +description = "O-like Zero (`0`) with a reverse-slash cutout" +selector.zero = "reverseSlashedCutout" +selector."zero/forceSlashed" = "slashed" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.tall-slashed-cutout] +rank = 15 +description = "O-like Zero (`0`) with a taller slash cutout" +selector.zero = "tallSlashedCutout" +selector."zero/forceSlashed" = "tallSlashed" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.tall-reverse-slashed-cutout] +rank = 16 +description = "O-like Zero (`0`) with a taller reverse-slash cutout" +selector.zero = "tallReverseSlashedCutout" +selector."zero/forceSlashed" = "tallSlashed" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.vertical-bar-cutout] +rank = 17 +description = "O-like Zero (`0`) with a vertical bar cutout" +selector.zero = "verticalBarCutout" +selector."zero/forceSlashed" = "slashed" +selector."zero/forceUnslashed" = "unslashed" + +[prime.zero.variants.top-right-cutout] +rank = 18 +description = "O-like Zero (`0`) with the top-right bit cutout" +selector.zero = "topRightCutout" +selector."zero/forceSlashed" = "slashed" +selector."zero/forceUnslashed" = "unslashed" + [prime.zero.variants.unslashed-oval] -rank = 8 +rank = 19 description = "O-like Zero (`0`) but more round" selector.zero = "unslashedOval" selector."zero/forceSlashed" = "slashedOval" selector."zero/forceUnslashed" = "unslashedOval" [prime.zero.variants.slashed-oval] -rank = 9 +rank = 20 description = "Slashed Zero (`0`) but more round" selector.zero = "slashedOval" selector."zero/forceSlashed" = "slashedOval" selector."zero/forceUnslashed" = "unslashedOval" [prime.zero.variants.reverse-slashed-oval] -rank = 10 +rank = 21 description = "Reverse-slashed Zero (`0`) but more round" selector.zero = "reverseSlashedOval" selector."zero/forceSlashed" = "slashedOval" selector."zero/forceUnslashed" = "unslashedOval" +[prime.zero.variants.tall-slashed-oval] +rank = 22 +description = "Slashed Zero (`0`) with a taller slash and more round" +selector.zero = "tallSlashedOval" +selector."zero/forceSlashed" = "tallSlashedOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.tall-reverse-slashed-oval] +rank = 23 +description = "Reverse-slashed Zero (`0`) with a taller slash and more round" +selector.zero = "tallReverseSlashedOval" +selector."zero/forceSlashed" = "tallSlashedOval" +selector."zero/forceUnslashed" = "unslashedOval" + [prime.zero.variants.dotted-oval] -rank = 11 +rank = 24 description = "Dotted Zero (`0`) but more round" selector.zero = "dottedOval" selector."zero/forceSlashed" = "slashedOval" selector."zero/forceUnslashed" = "unslashedOval" [prime.zero.variants.long-dotted-oval] -rank = 12 +rank = 25 description = "Long-dotted Zero (`0`) like Hack but more round" selector.zero = "longDottedOval" selector."zero/forceSlashed" = "slashedOval" selector."zero/forceUnslashed" = "unslashedOval" [prime.zero.variants.slashed-split-oval] -rank = 13 +rank = 26 description = "Slashed Zero (`0`) with slash separated from the outline and more round" selector.zero = "slashedSplitOval" selector."zero/forceSlashed" = "slashedSplitOval" selector."zero/forceUnslashed" = "unslashedOval" [prime.zero.variants.reverse-slashed-split-oval] -rank = 14 +rank = 27 description = "Reverse-slashed Zero (`0`) with slash separated from the outline and more round" selector.zero = "reverseSlashedSplitOval" selector."zero/forceSlashed" = "slashedSplitOval" selector."zero/forceUnslashed" = "unslashedOval" +[prime.zero.variants.broken-slash-oval] +rank = 28 +description = "Slashed Zero (`0`) with slash broken in the middle like Fixedsys and more round" +selector.zero = "brokenSlashOval" +selector."zero/forceSlashed" = "brokenSlashOval" +selector."zero/forceUnslashed" = "unslashedOval" +[prime.zero.variants.broken-reverse-slash-oval] +rank = 29 +description = "Reverse-slashed Zero (`0`) with slash broken in the middle and more round" +selector.zero = "brokenReverseSlashOval" +selector."zero/forceSlashed" = "brokenSlashOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.broken-vertical-bar-oval] +rank = 30 +description = "Zero (`0`) with vertical bar broken in the middle and more round" +selector.zero = "brokenVerticalBarOval" +selector."zero/forceSlashed" = "brokenSlashOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.slashed-cutout-oval] +rank = 31 +description = "O-like Zero (`0`) with a slash cutout and more round" +selector.zero = "slashedCutoutOval" +selector."zero/forceSlashed" = "slashedOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.reverse-slashed-cutout-oval] +rank = 32 +description = "O-like Zero (`0`) with a reverse-slash cutout and more round" +selector.zero = "reverseSlashedCutoutOval" +selector."zero/forceSlashed" = "slashedOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.tall-slashed-cutout-oval] +rank = 33 +description = "O-like Zero (`0`) with a taller slash cutout and more round" +selector.zero = "tallSlashedCutoutOval" +selector."zero/forceSlashed" = "tallSlashedOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.tall-reverse-slashed-cutout-oval] +rank = 34 +description = "O-like Zero (`0`) with a taller reverse-slash cutout and more round" +selector.zero = "tallReverseSlashedCutoutOval" +selector."zero/forceSlashed" = "tallSlashedOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.vertical-bar-cutout-oval] +rank = 35 +description = "O-like Zero (`0`) with a vertical bar cutout and more round" +selector.zero = "verticalBarCutoutOval" +selector."zero/forceSlashed" = "slashedOval" +selector."zero/forceUnslashed" = "unslashedOval" + +[prime.zero.variants.top-right-cutout-oval] +rank = 36 +description = "O-like Zero (`0`) with the top-right bit cutout and more round" +selector.zero = "topRightCutoutOval" +selector."zero/forceSlashed" = "slashedOval" +selector."zero/forceUnslashed" = "unslashedOval" [prime.one] sampler = "1"