Adjust balancing of r with corner hooks (#2394) (#2398)

This commit is contained in:
Belleve 2024-06-28 00:59:47 -10:00 committed by GitHub
parent 6268b4556e
commit e38fff51a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 29 deletions

View file

@ -4,3 +4,4 @@
* Optimize glyph shape for `U+01A6`.
* Make Aile and Etoile use {`six`|`nine`}.`closed-contour` by default.
* Make `ss20` use `seven`.`curly-serifless` by default.
* Adjust balancing of r with corner hooks (#2394).

View file

@ -15,6 +15,8 @@ glyph-block Letter-Latin-Lower-R : begin
local dfN : DivFrame 1
local dfR : DivFrame para.diversityF
# Modes
local rStraight 0
local rSerifed 1
local rNarrow 2
@ -28,17 +30,15 @@ glyph-block Letter-Latin-Lower-R : begin
local stroke : fallback _stroke Stroke
local strokeA : mix strokeBar stroke 0.5
local { rBalanceMultiplier rHookMultiplier rHookSwMultiplier rSerifLeftExtender hookSuperness } : match mode
[Just rStraight] { 1 1 0 0 2.35 }
[Just rSerifed] { (4 / 3) (2 / 3) (1 / 4) (1 / 3) 2.35 }
[Just rNarrow] { (2 * (df.div - 0.5)) 1 0 0 2.35 }
[Just rNarrowSerifed] { (5 / 8 * df.div) (3 / 4) 0 (1 / 2 * [Math.max 0 : mix 1 df.div 4]) 2.35 }
[Just rCornerHooked] { (2 * (df.div - 0.5)) 1 0 0 2.35 }
[Just rCornerHookedSerifed] { (4 / 3) (2 / 3) (1 / 4) (1 / 3) 2.35 }
[Just rEarless] { 1 1 0 0 2.35 }
[Just rStraight] { 1 1 0 0 2.35 }
[Just rSerifed] { (4 / 3) (2 / 3) (1 / 4) (1 / 3) 2.35 }
[Just rNarrow] { (2 * (df.div - 0.5)) 1 0 0 2.35 }
[Just rNarrowSerifed] { (2 * (df.div - 0.5)) 1 0 0 2.35 }
[Just rCornerHooked] { (5 / 8) 1 0 0 2.35 }
[Just rCornerHookedSerifed] { (4 / 3) (2 / 3) (1 / 4) (1 / 3) 2.35 }
[Just rEarless] { 1 1 0 0 2.35 }
export : local xBar : match mode
[Just rNarrowSerifed] : df.middle + [HSwToV : 0.5 * strokeBar] - RBalance * rBalanceMultiplier
__ : df.leftSB + RBalance * rBalanceMultiplier + [HSwToV strokeBar]
export : local xBar : df.leftSB + RBalance * rBalanceMultiplier + [HSwToV strokeBar]
local rSerifX : xBar - [HSwToV : 0.5 * strokeBar]
local rSerifLeftJut : SideJut + RBalance * (0.3 + rSerifLeftExtender)
local rSerifRightJut : rSerifLeftJut * 1.20
@ -55,13 +55,11 @@ glyph-block Letter-Latin-Lower-R : begin
export : local fine ShoulderFine
export : local rHookX : df.rightSB + RBalance2 * rBalanceMultiplier - (OX - O)
export : local xArchMiddle : match mode
[Just rStraight] : mix (xBar - fine) rHookX (0.54 + 2 * TanSlope * strokeBar / Width)
[Just rSerifed] : mix (xBar - fine) rHookX (0.59 + 2 * TanSlope * strokeBar / Width)
[Just rNarrow] : mix df.width rHookX : Math.max 1.01 (5 / 4 * [mix 1 dfR.div 2])
[Just rNarrowSerifed] : Math.min ([mix df.width rHookX df.div] - TINY) : xBar + RHook * 1.25 * df.div
[Just rCornerHooked] : rHookX - [HSwToV : 0.5 * strokeBar]
[Just rCornerHookedSerifed] : rHookX - [HSwToV : 0.5 * strokeBar]
[Just rEarless] : mix (xBar - [HSwToV strokeBar]) rHookX 0.5
[Just rStraight] : mix (xBar - fine) rHookX (0.54 + 2 * TanSlope * strokeBar / Width)
[Just rSerifed] : mix (xBar - fine) rHookX (0.59 + 2 * TanSlope * strokeBar / Width)
([Just rNarrow] || [Just rNarrowSerifed]) : mix df.width rHookX : Math.max 1.01 (5 / 4 * [mix 1 dfR.div 2])
([Just rCornerHooked] || [Just rCornerHookedSerifed]) : rHookX - [HSwToV : 0.5 * strokeBar]
[Just rEarless] : mix (xBar - [HSwToV strokeBar]) rHookX 0.5
local mixpin : match mode
([Just rSerifed] || [Just rCornerHooked] || [Just rCornerHookedSerifed]) : begin
0.65 + 0.25 * strokeA / Width + 4 * TanSlope * strokeA / Width
@ -175,14 +173,14 @@ glyph-block Letter-Latin-Lower-R : begin
define SmallRConfig : SuffixCfg.weave
# Body
object
'' { StandardShape dfN rStraight }
earlessCorner { EarlessCornerShape dfN rEarless }
earlessRounded { EarlessRoundedShape dfN rEarless }
hookless { CompactShape dfN rNarrow }
cornerHooked { CornerHookShape dfN rCornerHooked }
compact { CompactShape dfR rNarrow }
hooklessFlap { FlapHooklessShape dfN rNarrow }
compactFlap { FlapHooklessShape dfR rNarrow }
'' { StandardShape dfN rStraight rSerifed }
earlessCorner { EarlessCornerShape dfN rEarless rEarless }
earlessRounded { EarlessRoundedShape dfN rEarless rEarless }
hookless { CompactShape dfN rNarrow rNarrowSerifed }
cornerHooked { CornerHookShape dfN rCornerHooked rCornerHookedSerifed }
compact { CompactShape dfR rNarrow rNarrowSerifed }
hooklessFlap { FlapHooklessShape dfN rNarrow rNarrowSerifed }
compactFlap { FlapHooklessShape dfR rNarrow rNarrowSerifed }
# Serifs
object
@ -191,7 +189,8 @@ glyph-block Letter-Latin-Lower-R : begin
baseSerifed { 0 1 }
serifed { 1 1 }
foreach { suffix { {F df mode} {doTS doBS} } } [pairs-of SmallRConfig] : do
foreach { suffix { {F df modeSans modeSerifed} {doTS doBS} } } [pairs-of SmallRConfig] : do
local mode : if (doTS || doBS) modeSerifed modeSans
create-glyph "r.\(suffix)" : glyph-proc
set-width df.width
include : df.markSet.e

View file

@ -25,8 +25,9 @@ define [buildGSUB para glyphStore markGlyphs] : begin
# NWID / WWID
if para.enableNwidWwid : begin
buildGrFeature gsub glyphStore Gr.Nwid [if para.isQuasiProportional Gr.IsCompositeOrLigature null]
buildGrFeature gsub glyphStore Gr.Wwid [if para.isQuasiProportional Gr.IsCompositeOrLigature null]
local grIgnore : if para.isQuasiProportional Gr.IsCompositeOrLigature null
buildGrFeature gsub glyphStore Gr.Nwid grIgnore
buildGrFeature gsub glyphStore Gr.Wwid grIgnore
# lnum / onum
buildGrFeature gsub glyphStore Gr.Lnum
@ -74,7 +75,7 @@ define [buildGSUB para glyphStore markGlyphs] : begin
# TXTR, "texture" feature
if (para.buildTextureFeature && !para.isQuasiProportional) : begin
buildGsubTexture gsub glyphStore markGlyphs cvs
buildGsubTexture gsub glyphStore markGlyphs cvs
gsub.finalize
return gsub