Skip to content

Commit

Permalink
Add earless variants for r (#669).
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Aug 20, 2020
1 parent a6fb018 commit 138e29d
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 24 deletions.
2 changes: 1 addition & 1 deletion changes/3.4.4.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* Add toothless variant for `a` (#669).
* Add earless variants for `n` (#669).
* Add earless variants for `n`, `r` (#669).
95 changes: 72 additions & 23 deletions font-src/glyphs/letter/latin.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -2837,18 +2837,20 @@ glyph-block Letter-Latin-Upper-R : begin
glyph-block Letter-Latin-Lower-R : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Letter-Shared-Shapes : DToothlessRise DMBlend

local dfR : DivFrame para.diversityF
local rStraight 0
local rSerifed 1
local rNarrow 2
local rEarless 3

define [RDim mode] : begin
local rBalanceMultiplier : match mode [0 1] [1 (4 / 3)] [2 (1 / 2)]
local rHookMultiplier : match mode [0 1] [1 (2 / 3)] [2 1]
local rHookSwMultiplier : match mode [0 0] [1 (1 / 4)] [2 0]
local rSerifLeftExtender : match mode [0 0] [1 (1 / 3)] [2 0]
local hookSuperness : match mode [0 2.35] [1 2.75] [2 2.35]
local rBalanceMultiplier : match mode [0 1] [1 (4 / 3)] [2 (1 / 2)] [3 1]
local rHookMultiplier : match mode [0 1] [1 (2 / 3)] [2 1] [3 1]
local rHookSwMultiplier : match mode [0 0] [1 (1 / 4)] [2 0] [3 0]
local rSerifLeftExtender : match mode [0 0] [1 (1 / 3)] [2 0] [3 0]
local hookSuperness : match mode [0 2.35] [1 2.75] [2 2.35] [3 2.35]

local rbar : SB + RBalance * rBalanceMultiplier + Stroke * HVContrast
local rSerifX : rbar - HalfStroke * HVContrast
Expand All @@ -2865,10 +2867,12 @@ glyph-block Letter-Latin-Lower-R : begin
0 : mix (rbar - fine) rHookX (0.54 + 2 * TanSlope * Stroke / Width)
1 : mix (rbar - fine) rHookX (0.59 + 2 * TanSlope * Stroke / Width)
2 : mix rHookX dfR.width (3 / 8)
3 : mix (rbar - Stroke * HVContrast) rHookX 0.5
local mixpin : match mode
0 : 0.65 + 4 * TanSlope * Stroke / Width
1 : 0.65 + 0.25 * Stroke / Width + 4 * TanSlope * Stroke / Width
2 : 0.65 + 4 * TanSlope * Stroke / Width
3 : 0.65 + 4 * TanSlope * Stroke / Width
local rmiddlein : [mix rbar (rHookX - Stroke * HVContrast * 1.05) mixpin] - CorrectionOMidS
local skew : Math.max 0 : (rmiddle - rmiddlein) / Stroke
local rHookY : RHook * rHookMultiplier + Stroke * rHookSwMultiplier
Expand All @@ -2889,7 +2893,7 @@ glyph-block Letter-Latin-Lower-R : begin
if doTopSerif : include : rTopSerif XH

define [NarrowLowerRshape df md doTopSerif doBottomSerif] : glyph-proc
define [object rbar fine rmiddle] : RDim rNarrow
define [object rbar fine rmiddle] : RDim md
include : dispiro
widths.lhs
g4.left.mid (rmiddle - CorrectionOMidS * [linreg 72 0.75 108 1 Stroke]) (XH - O)
Expand All @@ -2898,12 +2902,35 @@ glyph-block Letter-Latin-Lower-R : begin
include : VBarRight rbar 0 XH
set-base-anchor 'overlay' (rbar - Stroke * 0.25) (XH * 0.5)

define [EarlessCornerLowerRShape df md doTopSerif doBottomSerif] : glyph-proc
define [object rbar rmiddle rHookX rHookY hookSuperness] : RDim md
include : dispiro
widths.lhs
g4.up.start rHookX (XH - rHookY - Stroke * 0.5) [heading Upward]
arcvh nothing hookSuperness
g4.left.mid (rmiddle - CorrectionOMidS) (XH - O) [heading Leftward]
g4 (rbar - Stroke * HVContrast) (XH - DToothlessRise)
include : VBarRight rbar 0 (XH - DToothlessRise)
set-base-anchor 'overlay' (rbar - Stroke * 0.25) (XH * 0.5)

define [EarlessRoundedLowerRShape df md doTopSerif doBottomSerif] : glyph-proc
define [object rbar rmiddle rHookX rHookY hookSuperness] : RDim md
include : dispiro
widths.lhs
g4 rHookX (XH - rHookY)
hookstart (XH - O)
flat (rbar - Stroke * HVContrast) (XH - SmallSmoothA)
curl (rbar - Stroke * HVContrast) 0 [heading Downward]
set-base-anchor 'overlay' (rbar - Stroke * 0.25) (XH * 0.5)

create-glyph : glyph-proc
set-width dfR.width
include dfR.markSet.e
create-derived "r.straight" : StandardLowerRShape dfR rStraight 0 0
create-derived "r.serifed" : StandardLowerRShape dfR rSerifed 1 1
create-derived "r.top-serifed" : StandardLowerRShape dfR rSerifed 1 0
create-derived "r.straight" : StandardLowerRShape dfR rStraight 0 0
create-derived "r.serifed" : StandardLowerRShape dfR rSerifed 1 1
create-derived "r.top-serifed" : StandardLowerRShape dfR rSerifed 1 0
create-derived "r.earlessCorner" : EarlessCornerLowerRShape dfR rEarless 0 0
create-derived "r.earlessRounded" : EarlessRoundedLowerRShape dfR rEarless 0 0

create-glyph 'r.narrow' : glyph-proc
set-width dfR.width
Expand All @@ -2917,6 +2944,8 @@ glyph-block Letter-Latin-Lower-R : begin
turned 'turnr.straight' nothing 'r.straight' dfR.middle (XH / 2) [marks]
turned 'turnr.serifed' nothing 'r.serifed' dfR.middle (XH / 2) [marks]
turned 'turnr.top-serifed' nothing 'r.top-serifed' dfR.middle (XH / 2) [marks]
turned 'turnr.earlessCorner' nothing 'r.earlessCorner' dfR.middle (XH / 2) [marks]
turned 'turnr.earlessRounded' nothing 'r.earlessRounded' dfR.middle (XH / 2) [marks]
turned 'turnr.narrow' nothing 'r.narrow' dfR.middle (XH / 2) [marks]
select-variant 'turnr' 0x279 (follow -- 'r')

Expand All @@ -2932,13 +2961,17 @@ glyph-block Letter-Latin-Lower-R : begin
set-width dfR.width
include dfR.markSet.p
create-derived 'rlongleg.straight'
SmallRLongLegShape StandardLowerRShape rStraight 0
SmallRLongLegShape StandardLowerRShape rStraight 0
create-derived 'rlongleg.serifed'
SmallRLongLegShape StandardLowerRShape rSerifed 1
SmallRLongLegShape StandardLowerRShape rSerifed 1
create-derived 'rlongleg.top-serifed'
SmallRLongLegShape StandardLowerRShape rSerifed 1
SmallRLongLegShape StandardLowerRShape rSerifed 1
create-derived 'rlongleg.earlessCorner'
SmallRLongLegShape EarlessCornerLowerRShape rEarless 0
create-derived 'rlongleg.earlessRounded'
SmallRLongLegShape EarlessRoundedLowerRShape rEarless 0
create-derived 'rlongleg.narrow'
SmallRLongLegShape NarrowLowerRshape rNarrow 0
SmallRLongLegShape NarrowLowerRshape rNarrow 0

select-variant 'rlongleg' 0x27C (follow -- 'r')

Expand All @@ -2947,6 +2980,8 @@ glyph-block Letter-Latin-Lower-R : begin
turned 'turnrlongleg.straight' nothing 'rlongleg.straight' dfR.middle (XH / 2) [marks]
turned 'turnrlongleg.serifed' nothing 'rlongleg.serifed' dfR.middle (XH / 2) [marks]
turned 'turnrlongleg.top-serifed' nothing 'rlongleg.top-serifed' dfR.middle (XH / 2) [marks]
turned 'turnrlongleg.earlessCorner' nothing 'rlongleg.earlessCorner' dfR.middle (XH / 2) [marks]
turned 'turnrlongleg.earlessRounded' nothing 'rlongleg.earlessRounded' dfR.middle (XH / 2) [marks]
turned 'turnrlongleg.narrow' nothing 'rlongleg.narrow' dfR.middle (XH / 2) [marks]
select-variant 'turnrlongleg' 0x27A (follow -- 'r')

Expand All @@ -2963,16 +2998,26 @@ glyph-block Letter-Latin-Lower-R : begin
create-glyph : glyph-proc
set-width dfR.width
include dfR.markSet.p
create-derived 'rrtail.straight' : SmallRRTailShape StandardLowerRShape rStraight 0
create-derived 'rrtail.serifed' : SmallRRTailShape StandardLowerRShape rSerifed 1
create-derived 'rrtail.top-serifed' : SmallRRTailShape StandardLowerRShape rSerifed 1
create-derived 'rrtail.narrow' : SmallRRTailShape NarrowLowerRshape rNarrow 0
create-derived 'rrtail.straight'
SmallRRTailShape StandardLowerRShape rStraight 0
create-derived 'rrtail.serifed'
SmallRRTailShape StandardLowerRShape rSerifed 1
create-derived 'rrtail.top-serifed'
SmallRRTailShape StandardLowerRShape rSerifed 1
create-derived 'rrtail.earlessCorner'
SmallRRTailShape EarlessCornerLowerRShape rEarless 0
create-derived 'rrtail.earlessRounded'
SmallRRTailShape EarlessRoundedLowerRShape rEarless 0
create-derived 'rrtail.narrow'
SmallRRTailShape NarrowLowerRshape rNarrow 0
select-variant 'rrtail' 0x27D (follow -- 'r')

do
turned 'smallLetterTurnedRWithTail.straight' nothing 'rrtail.straight' dfR.middle (XH / 2)
turned 'smallLetterTurnedRWithTail.serifed' nothing 'rrtail.serifed' dfR.middle (XH / 2)
turned 'smallLetterTurnedRWithTail.top-serifed' nothing 'rrtail.top-serifed' dfR.middle (XH / 2)
turned 'smallLetterTurnedRWithTail.earlessCorner' nothing 'rrtail.earlessCorner' dfR.middle (XH / 2)
turned 'smallLetterTurnedRWithTail.earlessRounded' nothing 'rrtail.earlessRounded' dfR.middle (XH / 2)
turned 'smallLetterTurnedRWithTail.narrow' nothing 'rrtail.narrow' dfR.middle (XH / 2)
select-variant 'smallLetterTurnedRWithTail' 0x2C79 (follow -- 'r')

Expand All @@ -2990,12 +3035,16 @@ glyph-block Letter-Latin-Lower-R : begin
create-glyph : glyph-proc
set-width dfR.width
include dfR.markSet.p
create-derived 'turnrrtail.straight' : TurnRRTailShape StandardLowerRShape rStraight 0
create-derived 'turnrrtail.serifed' : TurnRRTailShape StandardLowerRShape rSerifed 1
create-derived 'turnrrtail.top-serifed' : TurnRRTailShape StandardLowerRShape rSerifed 0
create-derived 'turnrrtail.narrow' : TurnRRTailShape NarrowLowerRshape rNarrow 0

select-variant 'turnrrtail' 0x27B (follow -- 'r')
create-derived 'turnrrtail.straight'
TurnRRTailShape StandardLowerRShape rStraight 0
create-derived 'turnrrtail.serifed'
TurnRRTailShape StandardLowerRShape rSerifed 1
create-derived 'turnrrtail.top-serifed'
TurnRRTailShape StandardLowerRShape rSerifed 0
create-derived 'turnrrtail.narrow'
TurnRRTailShape NarrowLowerRshape rNarrow 0

select-variant 'turnrrtail' 0x27B

create-glyph 'rflap.straight' : glyph-proc
set-width dfR.width
Expand Down
17 changes: 17 additions & 0 deletions params/variants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -600,18 +600,35 @@ tag = "cv85"
sampler = 'r'
description = 'Straight, serif-less `r`'
variant.r = "straight"
variant."turnrrtail" = "straight"

[simple.v-r-serifed]
tag = "cv86"
sampler = 'r'
description = '`r` with serif at both top and bottom'
variant.r = "serifed"
variant."turnrrtail" = "serifed"

[simple.v-r-top-serifed]
tag = "cv87"
sampler = 'r'
description = '`r` with serifs at top-left only'
variant.r = "top-serifed"
variant."turnrrtail" = "top-serifed"

[simple.v-r-earless-corner]
tag = "VXDS"
sampler = 'r'
description = 'Earless (corner top-left), serif-less `r`'
variant.r = "earlessCorner"
variant."turnrrtail" = "straight"

[simple.v-r-earless-rounded]
tag = "VXDT"
sampler = 'r'
description = 'Earless (rounded top-left), serif-less `r`'
variant.r = "earlessRounded"
variant."turnrrtail" = "straight"

[simple.v-t-standard]
tag = 'cv40'
Expand Down

0 comments on commit 138e29d

Please sign in to comment.