Skip to content

Commit

Permalink
Make M-width small-capital characters use diversityT. (#2596)
Browse files Browse the repository at this point in the history
* Make M-width small-capital characters narrower.

* Doc.

* Cleanup.
  • Loading branch information
jmcwilliams403 authored Nov 23, 2024
1 parent 3488898 commit 668658f
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 78 deletions.
14 changes: 14 additions & 0 deletions changes/32.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
* Make M-width small-capital characters slightly narrower under Quasi-Proportional. Affected characters:
- LATIN LETTER SMALL CAPITAL OE (`U+0276`).
- GREEK SMALL LETTER SAN (`U+03FB`).
- CYRILLIC SMALL LETTER EM (`U+043C`).
- CYRILLIC SMALL LETTER EM WITH TAIL (`U+04CE`).
- LATIN LETTER SMALL CAPITAL AE (`U+1D01`).
- LATIN LETTER SMALL CAPITAL M (`U+1D0D`).
- LATIN LETTER SMALL CAPITAL W (`U+1D21`).
- GREEK LETTER SMALL CAPITAL PSI (`U+1D2A`).
- CYRILLIC SMALL LETTER SOFT EM (`U+A667`).
- LATIN LETTER SMALL CAPITAL TURNED M (`U+A7FA`).
- MODIFIER LETTER SMALL CAPITAL AA (`U+10780`).
- MODIFIER LETTER SMALL CAPITAL OE (`U+107A3`).
- MODIFIER LETTER CYRILLIC SMALL EM (`U+1E03B`).
23 changes: 13 additions & 10 deletions packages/font-glyphs/src/letter/cyrillic/sha.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ glyph-block Letter-Cyrillic-Sha : begin
glyph-block-import Letter-Shared-Shapes : RightwardTailedBar CyrDescender SerifFrame

glyph-block-export CyrShaShape
define [CyrShaShape] : with-params [df top bot [fine Stroke] [doSerif false] [fInv false]] : glyph-proc
define [CyrShaShape] : with-params [df top bot [fine Stroke] [doSerif false] [fInv false] [fCompact false]] : glyph-proc
local cofine : fine * df.mvs / Stroke
include : union
[if fInv HBar.t HBar.b] df.leftSB df.rightSB [if fInv top bot] fine
VBar.l df.leftSB bot top cofine
VBar.l df.leftSB bot top cofine
VBar.r df.rightSB bot top cofine
VBar.m df.middle bot top cofine
VBar.m df.middle bot top cofine

if doSerif : begin
local sf : SerifFrame.fromDf df top bot (swSerif -- cofine)

if fInv : then : begin
include : composite-proc sf.lt.outer sf.rt.outer
if sf.enoughSpaceForFullSerifs
include : composite-proc sf.lb.full sf.mb.full sf.rb.full
include : composite-proc sf.lb.outer sf.rb.outer
include : if (sf.enoughSpaceForFullSerifs && !fCompact)
composite-proc sf.lb.full sf.mb.full sf.rb.full
composite-proc sf.lb.outer sf.rb.outer
: else : begin
include : composite-proc sf.lb.outer sf.rb.outer
if sf.enoughSpaceForFullSerifs
include : composite-proc sf.lt.full sf.mt.full sf.rt.full
include : composite-proc sf.lt.outer sf.rt.outer
include : if (sf.enoughSpaceForFullSerifs && !fCompact)
composite-proc sf.lt.full sf.mt.full sf.rt.full
composite-proc sf.lt.outer sf.rt.outer

create-glyph 'cyrl/Sha' 0x428 : glyph-proc
local df : include : DivFrame para.diversityM 3
Expand All @@ -49,7 +49,10 @@ glyph-block Letter-Cyrillic-Sha : begin
include : df.markSet.e
include : CyrShaShape df XH 0 (doSerif -- SLAB) (fInv -- true)

alias 'smcpMTurned' 0xA7FA 'cyrl/sha.upright'
create-glyph 'smcpMTurned' 0xA7FA : glyph-proc
local df : include : DivFrame para.diversityT 3
include : df.markSet.e
include : CyrShaShape df XH 0 (doSerif -- SLAB) (fCompact -- true)

define [CyrShchaShape] : with-params [df top bot [fine Stroke] [doSerif false]] : glyph-proc
local cofine : fine * df.mvs / Stroke
Expand Down
2 changes: 1 addition & 1 deletion packages/font-glyphs/src/letter/greek/psi.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ glyph-block Letter-Greek-Psi : begin
alias 'cyrl/Psi' 0x470 'grek/Psi'

create-glyph 'smcpPsi' 0x1D2A : glyph-proc
local df : include : DivFrame para.diversityM 3
local df : include : DivFrame para.diversityT 3
include : df.markSet.e
include : PsiBaseShape df 0 (XH * 0.3) XH XH SLAB false SLAB SLAB

Expand Down
8 changes: 4 additions & 4 deletions packages/font-glyphs/src/letter/latin-ext/lower-ae-oe.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ glyph-block Letter-Latin-Lower-AE-OE : begin
glyph-block-import Mark-Adjustment : LeaningAnchor
glyph-block-import Letter-Shared : CreateTurnedLetter
glyph-block-import Letter-Shared-Shapes : OBarLeft
glyph-block-import Letter-Latin-Lower-M : MEnoughSpaceForFullSerifs dfM
glyph-block-import Letter-Latin-Lower-M : MEnoughSpaceForFullSerifs

glyph-block-export SubDfAndShift
define [SubDfAndShift pShift df _o] : begin
Expand Down Expand Up @@ -80,8 +80,8 @@ glyph-block Letter-Latin-Lower-AE-OE : begin
local { subDf shift } : SubDfAndShift pShift df OX
return : with-transform [ApparentTranslate shift 0]
OShape top 0 subDf.leftSB subDf.rightSB df.mvs
subDf.archDepthA ad
subDf.archDepthB ad
subDf.archDepthA ad df.mvs
subDf.archDepthB ad df.mvs

create-glyph 'oe/o' : glyph-proc
local df : include : DivFrame para.diversityM 3
Expand Down Expand Up @@ -406,7 +406,7 @@ glyph-block Letter-Latin-Lower-AE-OE : begin
select-variant "ae/e" (follow -- 'e')
select-variant "aeInvE/right" (follow -- 'e')
select-variant "ue/u"
select-variant "au/u" (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'au/u/full' 'au/u/reduced'])
select-variant "au/u" (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'au/u/full' 'au/u/reduced'])
select-variant "oeOpenO/left" (follow -- 'c')
select-variant "cyrl/ae/a" (shapeFrom -- 'ae/a')
select-variant "cyrl/yae/left"
Expand Down
24 changes: 12 additions & 12 deletions packages/font-glyphs/src/letter/latin-ext/upper-aa-ao.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ glyph-block Letter-Latin-Upper-AA-AO : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Letter-Latin-Lower-AE-OE : SubDfAndShift
glyph-block-import Letter-Latin-Lower-M : MEnoughSpaceForFullSerifs dfM
glyph-block-import Letter-Latin-Lower-M : MEnoughSpaceForFullSerifs

do "A glyphs"
glyph-block-import Letter-Latin-Upper-A : AShape AConfig
Expand All @@ -30,46 +30,46 @@ glyph-block Letter-Latin-Upper-AA-AO : begin
define SLAB-RIGHT 4

define ALetters : object
AA { 0xA732 'capital' CAP }
smcpAA { null 'e' XH }
AA { 0xA732 para.diversityM 'capital' CAP }
smcpAA { null para.diversityT 'e' XH }

foreach { prefix { code mk height } } [Object.entries ALetters] : do
foreach { prefix { code div mk height } } [Object.entries ALetters] : do
foreach { suffix { bodyShape slabKind } } [Object.entries AConfig] : do
define skLeft : maskOffBits slabKind SLAB-RIGHT
define skRight : maskOffBits slabKind SLAB-LEFT

create-glyph "\(prefix)/Left.\(suffix)" : glyph-proc
define df : include : DivFrame para.diversityM 3.5
define df : include : DivFrame div 3.5
include : df.markSet.(mk)
set-base-anchor 'cvDecompose' 0 0
include : AHalfShape 0 df height bodyShape skLeft

create-glyph "\(prefix)/LeftMask.\(suffix)" : glyph-proc
define df : include : DivFrame para.diversityM 3.5
define df : include : DivFrame div 3.5
include : df.markSet.(mk)
set-base-anchor 'cvDecompose' 0 0
include : AHalfShapeMask 0 df height bodyShape skLeft

create-glyph "\(prefix)/Right.\(suffix)" : glyph-proc
define df : DivFrame para.diversityM 3.5
define df : DivFrame div 3.5
set-width 0
include : df.markSet.(mk)
set-mark-anchor 'cvDecompose' 0 0 0 0
include : AHalfShape 1 df height bodyShape skRight

create-glyph "\(prefix)/RightMask.\(suffix)" : glyph-proc
define df : DivFrame para.diversityM 3.5
define df : DivFrame div 3.5
set-width 0
include : df.markSet.(mk)
set-mark-anchor 'cvDecompose' 0 0 0 0
include : AHalfShapeMask 1 df height bodyShape skRight

create-glyph "\(prefix)/AU/Left.\(suffix)" : glyph-proc
define df : include : DivFrame para.diversityM 3.5
define df : include : DivFrame div 3.5
local { subDf shift } : SubDfAndShift 1 df
include : AShape.LetterBottomRightRemoved subDf bodyShape slabKind CAP df.mvs
create-glyph "\(prefix)/AU/LeftMask.\(suffix)" : glyph-proc
define df : include : DivFrame para.diversityM 3.5
define df : include : DivFrame div 3.5
local { subDf shift } : SubDfAndShift 1 df
include : union
MaskAbove : [AShape.BarPos bodyShape slabKind CAP] - df.mvs
Expand All @@ -84,7 +84,7 @@ glyph-block Letter-Latin-Upper-AA-AO : begin
derive-multi-part-glyphs prefix code
list "\(prefix)/Left" "\(prefix)/LeftMask" "\(prefix)/Right" "\(prefix)/RightMask"
function [srcs gr] : glyph-proc
define df : DivFrame para.diversityM 3.5
define df : DivFrame div 3.5
define topSerifGap : Math.max (0.1 * (df.rightSB - df.leftSB)) [AdviceStroke 6]
define { left leftMask right rightMask } srcs

Expand Down Expand Up @@ -116,7 +116,7 @@ glyph-block Letter-Latin-Upper-AA-AO : begin
include : with-transform [ApparentTranslate shift 0]
union [Base subDf CAP df.mvs] [Slabs subDf CAP]

select-variant "AU/Right" (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'AU/U/full' 'AU/U/reduced'])
select-variant "AU/Right" (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'AU/U/full' 'AU/U/reduced'])

do "AU"
select-variant 'AA/AU/Left' (follow -- 'A')
Expand Down
31 changes: 10 additions & 21 deletions packages/font-glyphs/src/letter/latin-ext/upper-ae-oe.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ glyph-block Letter-Latin-Upper-AE-OE : begin
set-base-anchor 'cvDecompose' 0 0
include : AEAHalf df bodyShape CAP slabKind
create-glyph "smcpAE/AHalf.\(suffix)" : glyph-proc
define df : include : DivFrame para.diversityM 3
define df : include : DivFrame para.diversityT 3
include : df.markSet.e
set-base-anchor 'cvDecompose' 0 0
include : AEAHalf df bodyShape XH slabKind
Expand All @@ -189,7 +189,7 @@ glyph-block Letter-Latin-Upper-AE-OE : begin
set-mark-anchor 'cvDecompose' 0 0
include : AEEHalf df CAP slabKind
create-glyph "smcpAE/EHalf.\(suffix)" : glyph-proc
define df : DivFrame para.diversityM 3
define df : DivFrame para.diversityT 3
set-width 0
set-mark-anchor 'cvDecompose' 0 0
include : AEEHalf df XH slabKind
Expand Down Expand Up @@ -219,24 +219,13 @@ glyph-block Letter-Latin-Upper-AE-OE : begin
local { jutTop jutBot jutMid } : EFVJutLength top eBarPos sw

# O half
if (top > ada + adb) : then : begin
include : dispiro
widths.lhs sw 0
straight.left.start eleft top [heading Leftward]
archv
flat df.leftSB (top - ada)
curl df.leftSB (0 + adb)
arcvh
straight.right.end eleft 0 [heading Rightward]
: else : begin
local yMidLeft : top * (adb / (ada + adb))
include : dispiro
widths.lhs sw 0
straight.left.start eleft top [heading Leftward]
archv
g4 df.leftSB yMidLeft
arcvh
straight.right.end eleft 0 [heading Rightward]
include : dispiro
widths.lhs sw 0
straight.left.start eleft top [heading Leftward]
archv
flatside.ld df.leftSB 0 top ada adb
arcvh
straight.right.end eleft 0 [heading Rightward]

# E half
include : VBar.l eleft 0 top sw
Expand All @@ -259,7 +248,7 @@ glyph-block Letter-Latin-Upper-AE-OE : begin
include : df.markSet.capital
include : OEShape CAP df slabKind
create-glyph "smcpOE.\(suffix)" : glyph-proc
define df : include : DivFrame para.diversityM 3
define df : include : DivFrame para.diversityT 3
include : df.markSet.e
include : OEShape XH df slabKind

Expand Down
13 changes: 6 additions & 7 deletions packages/font-glyphs/src/letter/latin/lower-m.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ glyph-block Letter-Latin-Lower-M : begin
local sf : SerifFrame.fromDf df top rbot
return sf.rb.outer

glyph-block-export dfM
define [dfM] : DivFrame para.diversityM 3

glyph-block-export MEnoughSpaceForFullSerifs
Expand Down Expand Up @@ -420,22 +419,22 @@ glyph-block Letter-Latin-Lower-M : begin
eject-contour 'serifLT'
include : CyrDescender.rSideJut df.rightSB 0 (refSw -- df.mvs)

select-variant 'turnm' 0x26F (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'turnm/full' 'turnm/reduced'])
select-variant 'turnm' 0x26F (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'turnm/full' 'turnm/reduced'])
select-variant 'turnm/reduced' (shapeFrom -- 'turnm')

select-variant 'capitalTurnm' 0x19C (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'turnm/full' 'turnm/reduced'])
select-variant 'capitalTurnm' 0x19C (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'turnm/full' 'turnm/reduced'])

select-variant 'turnmLeg' 0x270 (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'turnmLeg/full' 'turnmLeg/reduced'])
select-variant 'turnmLeg' 0x270 (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'turnmLeg/full' 'turnmLeg/reduced'])
select-variant 'turnmLeg/reduced' (shapeFrom -- 'turnmLeg')

select-variant 'turnmSideways' 0x1D1F (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'turnm/full' 'turnm/reduced'])
select-variant 'turnmSideways' 0x1D1F (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'turnm/full' 'turnm/reduced'])

select-variant 'cyrl/sha.italic' (shapeFrom -- 'turnm') (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'cyrl/sha.italic/full' 'cyrl/sha.italic/reduced'])
select-variant 'cyrl/sha.italic' (shapeFrom -- 'turnm') (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'cyrl/sha.italic/full' 'cyrl/sha.italic/reduced'])
alias 'cyrl/sha.BGR' null 'cyrl/sha.italic'
select-variant 'cyrl/sha/reduced.italic' (shapeFrom -- 'turnm') (follow -- 'cyrl/sha.italic/reduced')
alias 'cyrl/sha/reduced.BGR' null 'cyrl/sha/reduced.italic'

select-variant 'cyrl/shcha.italic' (follow -- [conditional-follow [MEnoughSpaceForFullSerifs : dfM] 'cyrl/shcha.italic/full' 'cyrl/shcha.italic/reduced'])
select-variant 'cyrl/shcha.italic' (follow -- [conditional-follow [MEnoughSpaceForFullSerifs] 'cyrl/shcha.italic/full' 'cyrl/shcha.italic/reduced'])
alias 'cyrl/shcha.BGR' null 'cyrl/shcha.italic'
select-variant 'cyrl/shcha/reduced.italic' (shapeFrom -- 'cyrl/shcha.italic') (follow -- 'cyrl/shcha.italic/reduced')
alias 'cyrl/shcha/reduced.BGR' null 'cyrl/shcha/reduced.italic'
Expand Down
36 changes: 19 additions & 17 deletions packages/font-glyphs/src/letter/latin/upper-d.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ glyph-block Letter-Latin-Upper-D : begin
glyph-block-import Common-Derivatives
glyph-block-import Letter-Shared-Shapes : LetterBarOverlay LeftHook

define [DArcShapeT sink df top right offset sw fRound] : glyph-proc
define [DArcShapeT sink df top right offset sw fRound ySmooth] : glyph-proc
local mockWidth : right + (df.width - df.rightSB)
local maxXSmoothWidth : mockWidth - df.leftSB * 2 - [HSwToV sw]
local dsmooth : clamp (sw * 1.5) (top * 0.499) ((top / CAP) * ArchDepth * 1.1)
local dsmooth : fallback ySmooth : clamp (sw * 1.5) (top / 2 - TINY) ((top / CAP) * ArchDepth * 1.1)
local bsmooth : clamp (sw * 1.5) maxXSmoothWidth ((mockWidth / Width) * ArchDepth * 1.1)
local barchDepthRd : clamp (sw * 1.5) maxXSmoothWidth ((mockWidth / Width) * ArchDepth * 1.25)

Expand All @@ -34,14 +34,14 @@ glyph-block Letter-Latin-Upper-D : begin
[if offset corner flat] (df.leftSB - O) (top - offset) [heading Rightward]
curl [arch.adjust-x.top (right - bsmooth)] (top - offset)
archv
flatside.rd (right - OX - offset) 0 top ada adb
flatside.rd (right - offset) 0 top ada adb
arcvh
flat [arch.adjust-x.bot (right - bsmooth)] offset
[if offset corner curl] (df.leftSB - O) offset [heading Leftward]

define [DShape df top right fRound slabTop slabBot] : glyph-proc
define [DShape df top right fRound ySmooth slabTop slabBot] : glyph-proc
include : VBar.l df.leftSB 0 top df.mvs
include : DArcShapeT dispiro df top right 0 df.mvs fRound
include : DArcShapeT dispiro df top right 0 df.mvs fRound ySmooth
if slabTop : include : tagged 'serifLT' : HSerif.lt df.leftSB top SideJut
if slabBot : include : tagged 'serifLB' : HSerif.lb df.leftSB 0 SideJut

Expand All @@ -58,33 +58,35 @@ glyph-block Letter-Latin-Upper-D : begin
local fMotion : fSlabTop && !fSlabBot

create-glyph "D.\(suffix)" : glyph-proc
include : MarkSet.capital
include : DShape [DivFrame 1] CAP RightSB fRound fSlabTop fSlabBot
local df : include : DivFrame 1
include : df.markSet.capital
include : DShape df CAP df.rightSB fRound nothing fSlabTop fSlabBot

if (!fMotion) : create-glyph "Dhookleft.\(suffix)" : glyph-proc
include [refer-glyph "D.\(suffix)"] AS_BASE ALSO_METRICS
eject-contour 'serifLT'
include : LeftHook SB CAP

create-glyph "smcpD.\(suffix)" : glyph-proc
include : MarkSet.e
include : DShape [DivFrame 1] XH RightSB fRound fSlabTop fSlabBot
local df : include : DivFrame 1
include : df.markSet.e
include : DShape df XH df.rightSB fRound ArchDepth fSlabTop fSlabBot

create-glyph "romanFiveThousand.\(suffix)" : glyph-proc
local df : DivFrame 1 3
include : MarkSet.capital
include : DShape df CAP df.rightSB fRound fSlabTop fSlabBot
local df : include : DivFrame 1 3
include : df.markSet.capital
include : DShape df CAP df.rightSB fRound nothing fSlabTop fSlabBot
include : with-transform [ApparentTranslate 0 (CAP * 0.2)]
DShape df (CAP * 0.6) (df.middle + [HSwToV : 0.5 * df.mvs]) fRound

create-glyph "romanFiftyThousand.\(suffix)" : glyph-proc
local df : DivFrame 1 4
local df : include : DivFrame 1 4
include : df.markSet.capital
local innerDist : df.rightSB - df.leftSB - [HSwToV : 4 * df.mvs]
local arcX1 : df.leftSB + innerDist * (1 / 3) + [HSwToV : 2 * df.mvs]
local arcX2 : df.leftSB + innerDist * (2 / 3) + [HSwToV : 3 * df.mvs]
local heightGap : df.mvs + (CAP - df.mvs * 6) / 6
include : MarkSet.capital
include : DShape df CAP df.rightSB fRound fSlabTop fSlabBot
include : DShape df CAP df.rightSB fRound nothing fSlabTop fSlabBot
include : with-transform [ApparentTranslate 0 heightGap]
DShape df (CAP - 2 * heightGap) arcX2 fRound
include : with-transform [ApparentTranslate 0 (2 * heightGap)]
Expand All @@ -103,7 +105,7 @@ glyph-block Letter-Latin-Upper-D : begin
select-variant 'Dhookleft' 0x18A

derive-composites 'Dbar' 0xA7C7 'D'
HBar.m (SB - OX) (RightSB + OX) (CAP * 0.5) OverlayStroke
HBar.m (SB - OX) (RightSB + OX) (CAP / 2) OverlayStroke

select-variant 'smcpD' 0x1D05 (follow -- 'D')
derive-glyphs 'smcpEth' 0x1D06 'smcpD' : lambda [src gr] : glyph-proc
Expand All @@ -113,7 +115,7 @@ glyph-block Letter-Latin-Upper-D : begin

glyph-block-import Letter-Blackboard : BBS BBD
create-glyph 'mathbb/D' 0x1D53B : glyph-proc
define df : DivFrame 1
define df : include : DivFrame 1
include : df.markSet.capital
include : VBar.l df.leftSB 0 CAP BBS
include : DArcShapeT dispiro df CAP df.rightSB 0 BBS false
Expand Down
Loading

0 comments on commit 668658f

Please sign in to comment.