From 8f2f859a6ffae03c660fb14fe9cc10fd011edadf Mon Sep 17 00:00:00 2001 From: John McWilliams Date: Sat, 22 Mar 2025 07:22:10 -0400 Subject: [PATCH] Optimize overshoot of Half H. --- changes/33.2.0.md | 6 +++ .../font-glyphs/src/letter/latin/upper-h.ptl | 44 +++++++++---------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/changes/33.2.0.md b/changes/33.2.0.md index fadac53dc..ed4bebbc8 100644 --- a/changes/33.2.0.md +++ b/changes/33.2.0.md @@ -1,7 +1,13 @@ * Add `flat-top` variants for `curly`, `straight-vertical-sides`, and `rounded-vertical-sides` forms of `W` and `w` (#2146). * Add `almost-flat-top` variants for `curly` forms of `W` and `w`. * Refine shape of the following characters: + - GREEK CAPITAL LETTER HETA (`U+0370`). + - GREEK SMALL LETTER HETA (`U+0371`). - ARMENIAN SMALL LIGATURE ECH YIWN (`U+0587`). + - LATIN CAPITAL LETTER HALF H (`U+2C75`). + - LATIN SMALL LETTER HALF H (`U+2C76`). - LATIN CAPITAL LETTER AU (`U+A736`). + - LATIN CAPITAL LETTER REVERSED HALF H (`U+A7F5`). + - LATIN SMALL LETTER REVERSED HALF H (`U+A7F6`). - LATIN SMALL LIGATURE FFI (`U+FB03`). * Fix variant application of `cv38` on `U+1DF0F`. diff --git a/packages/font-glyphs/src/letter/latin/upper-h.ptl b/packages/font-glyphs/src/letter/latin/upper-h.ptl index 5c4e15306..bee4f80f3 100644 --- a/packages/font-glyphs/src/letter/latin/upper-h.ptl +++ b/packages/font-glyphs/src/letter/latin/upper-h.ptl @@ -38,7 +38,7 @@ glyph-block Letter-Latin-Upper-H : begin [Just SLAB-ALL-BGR] : composite-proc sf.lt.outer sf.rt.inner sf.lb.full sf.rb.full [Just SLAB-TAILED-CYRILLIC-BGR] : composite-proc sf.lt.outer sf.rt.inner sf.lb.full - define [LeftHalfSerifs slabType t b l r sw] : begin + define [LeftHalfHSerifs slabType t b l r sw] : begin local sf : SerifFrame t b l r (swRef -- [fallback sw Stroke]) return : match slabType [Just SLAB-NONE] : glyph-proc @@ -49,7 +49,7 @@ glyph-block Letter-Latin-Upper-H : begin [Just SLAB-ALL-BGR] : composite-proc sf.lt.outer sf.lb.fullSide [Just SLAB-TAILED-CYRILLIC-BGR] : composite-proc sf.lt.outer sf.lb.fullSide - define [RightHalfSerifs slabType t b l r sw] : begin + define [RightHalfHSerifs slabType t b l r sw] : begin local sf : SerifFrame t b l r (swRef -- [fallback sw Stroke]) return : match slabType [Just SLAB-NONE] : glyph-proc @@ -60,7 +60,7 @@ glyph-block Letter-Latin-Upper-H : begin [Just SLAB-ALL-BGR] : composite-proc sf.rt.inner sf.rb.fullSide [Just SLAB-TAILED-CYRILLIC-BGR] : begin sf.rt.inner - define [TurnedSerifs slabType t b l r sw] : begin + define [TurnedHSerifs slabType t b l r sw] : begin local sf : SerifFrame t b l r (swRef -- [fallback sw Stroke]) return : match slabType [Just SLAB-NONE] : glyph-proc @@ -89,14 +89,14 @@ glyph-block Letter-Latin-Upper-H : begin include : LeaningAnchor.Above.VBar.l l include : LeaningAnchor.Below.VBar.l l include : tagged 'strokeL' : VBar.l l 0 top sw - include : HBar.m (l - O) (r + O) (top * HBarPos) sw + include : HBar.m (l - O) r (top * HBarPos) sw define [RightHalfHShape l r top _sw] : glyph-proc local sw : fallback _sw Stroke include : LeaningAnchor.Above.VBar.r r include : LeaningAnchor.Below.VBar.r r include : tagged 'strokeR' : VBar.r r 0 top sw - include : HBar.m (l - O) (r + O) (top * HBarPos) sw + include : HBar.m l (r + O) (top * HBarPos) sw define [TailedHShape l r top _sw] : glyph-proc local sw : fallback _sw Stroke @@ -159,21 +159,19 @@ glyph-block Letter-Latin-Upper-H : begin topRightSerifed true foreach { suffix { Body TurnedBody LeftHalfBody RightHalfBody slabType } } [Object.entries HConfig] : do - define fSlab : slabType !== SLAB-NONE - create-glyph "H.\(suffix)" : glyph-proc include : MarkSet.capital - include : Body SB RightSB CAP + include : Body SB RightSB CAP include : HSerifs slabType CAP 0 SB RightSB create-glyph "grek/Eta.\(suffix)" : glyph-proc include [refer-glyph "H.\(suffix)"] AS_BASE ALSO_METRICS - include : SetGrekUpperTonos [if fSlab (-SideJut) 0] + include : SetGrekUpperTonos [if (slabType === SLAB-NONE) 0 (-SideJut)] create-glyph "HTurned.\(suffix)" : glyph-proc include : MarkSet.capital - include : TurnedBody SB RightSB CAP - include : TurnedSerifs slabType CAP 0 SB RightSB + include : TurnedBody SB RightSB CAP + include : TurnedHSerifs slabType CAP 0 SB RightSB create-glyph "smcpH.\(suffix)" : glyph-proc include : MarkSet.e @@ -183,42 +181,42 @@ glyph-block Letter-Latin-Upper-H : begin create-glyph "leftHalfH.\(suffix)" : glyph-proc include : MarkSet.capital local xMockLeft : SB * 1.5 - local xMockRight : RightSB - [xMidBarShrink fSlab] - local shift : Math.abs : Middle - [mix (xMockLeft - [if fSlab SideJut 0]) xMockRight 0.5] + local xMockRight : RightSB - [xMidBarShrink (slabType === SLAB-ALL)] + local shift : Math.abs : Middle - [mix (xMockLeft - [if (slabType === SLAB-NONE) 0 SideJut]) xMockRight 0.5] local xLeft : xMockLeft + shift local xRight : xMockRight + shift include : LeftHalfBody xLeft xRight CAP - include : LeftHalfSerifs slabType CAP 0 xLeft xRight + include : LeftHalfHSerifs slabType CAP 0 xLeft xRight create-glyph "rightHalfH.\(suffix)" : glyph-proc include : MarkSet.capital - local xMockLeft : SB + [xMidBarShrink fSlab] + local xMockLeft : SB + [xMidBarShrink (slabType === SLAB-ALL)] local xMockRight : Width - SB * 1.5 - local shift : Math.abs : Middle - [mix xMockLeft (xMockRight + [if fSlab SideJut 0]) 0.5] + local shift : Math.abs : Middle - [mix xMockLeft (xMockRight + [if (slabType === SLAB-NONE) 0 SideJut]) 0.5] local xLeft : xMockLeft - shift local xRight : xMockRight - shift include : RightHalfBody xLeft xRight CAP - include : RightHalfSerifs slabType CAP 0 xLeft xRight + include : RightHalfHSerifs slabType CAP 0 xLeft xRight create-glyph "leftHalfSmcpH.\(suffix)" : glyph-proc include : MarkSet.e local xMockLeft : SB * 1.5 - local xMockRight : RightSB - [xMidBarShrink fSlab] - local shift : Math.abs : Middle - [mix (xMockLeft - [if fSlab SideJut 0]) xMockRight 0.5] + local xMockRight : RightSB - [xMidBarShrink (slabType === SLAB-ALL)] + local shift : Math.abs : Middle - [mix (xMockLeft - [if (slabType === SLAB-NONE) 0 SideJut]) xMockRight 0.5] local xLeft : xMockLeft + shift local xRight : xMockRight + shift include : LeftHalfBody xLeft xRight XH - include : LeftHalfSerifs slabType XH 0 xLeft xRight + include : LeftHalfHSerifs slabType XH 0 xLeft xRight create-glyph "rightHalfSmcpH.\(suffix)" : glyph-proc include : MarkSet.e - local xMockLeft : SB + [xMidBarShrink fSlab] + local xMockLeft : SB + [xMidBarShrink (slabType === SLAB-ALL)] local xMockRight : Width - SB * 1.5 - local shift : Math.abs : Middle - [mix xMockLeft (xMockRight + [if fSlab SideJut 0]) 0.5] + local shift : Math.abs : Middle - [mix xMockLeft (xMockRight + [if (slabType === SLAB-NONE) 0 SideJut]) 0.5] local xLeft : xMockLeft - shift local xRight : xMockRight - shift include : RightHalfBody xLeft xRight XH - include : RightHalfSerifs slabType XH 0 xLeft xRight + include : RightHalfHSerifs slabType XH 0 xLeft xRight define enGheDf : DivFrame para.advanceScaleM 3