168 lines
6.1 KiB
Text
168 lines
6.1 KiB
Text
$$include '../../../meta/macros.ptl'
|
|
|
|
import [mix linreg clamp fallback] from"../../../support/utils.mjs"
|
|
import [Dotless CvDecompose MathSansSerif] from"../../../support/gr.mjs"
|
|
|
|
glyph-module
|
|
|
|
glyph-block Letter-Latin-Lower-H : begin
|
|
glyph-block-import CommonShapes
|
|
glyph-block-import Common-Derivatives
|
|
glyph-block-import Letter-Shared-Shapes : RightwardTailedBar nShoulder nShoulderMask
|
|
glyph-block-import Letter-Shared-Shapes : CyrDescender HooktopLeftBar VerticalHook PalatalHook
|
|
|
|
define [SmallHSerifs tailed hookTop] : glyph-proc : if SLAB : begin
|
|
if [not hookTop] : include : tagged 'serifLT' : HSerif.lt SB Ascender SideJut
|
|
if [not tailed]
|
|
if (para.isItalic)
|
|
: then : include : tagged 'serifRB' : HSerif.rb RightSB 0 SideJut
|
|
: else : include : tagged 'serifRB' : HSerif.mb (RightSB - HalfStroke * HVContrast) 0 Jut
|
|
if (!para.isItalic) : begin
|
|
include : tagged 'serifLB' : HSerif.mb (SB + HalfStroke * HVContrast) 0 Jut
|
|
|
|
define [SmallHMotionSerifs tailed hookTop] : glyph-proc
|
|
if [not hookTop] : include : tagged 'serifLT' : HSerif.lt SB Ascender SideJut
|
|
if [not tailed] : include : tagged 'serifRB' : HSerif.rb RightSB 0 SideJut
|
|
|
|
define [SmallHTopLeftSerifs tailed hookTop] : glyph-proc
|
|
if [not hookTop] : include : tagged 'serifLT' : HSerif.lt SB Ascender SideJut
|
|
|
|
define [HBar.mOverlay fHasTopSerif] : glyph-proc
|
|
local barSpaceTop : Ascender - [if fHasTopSerif Stroke 0]
|
|
local s : Math.min OverlayStroke (0.625 * (barSpaceTop - XH))
|
|
local xOverlayStart : mix SB 0 0.7
|
|
local xOverlayEnd : mix SB RightSB 0.5
|
|
local yOverlay : [mix XH barSpaceTop 0.45] - s / 2
|
|
include : dispiro
|
|
widths.lhs s
|
|
corner xOverlayStart yOverlay
|
|
corner (SB + HalfStroke * HVContrast) yOverlay
|
|
include : dispiro
|
|
widths.lhs OverlayStroke
|
|
corner (SB + HalfStroke * HVContrast) yOverlay
|
|
corner xOverlayEnd yOverlay
|
|
|
|
define HConfig : object
|
|
straight { 0 SLAB SmallHSerifs }
|
|
tailed { 1 SLAB SmallHSerifs }
|
|
straightMotionSerifed { 0 true SmallHMotionSerifs }
|
|
tailedMotionSerifed { 1 true SmallHMotionSerifs }
|
|
straightTopLeftSerifed { 0 true SmallHTopLeftSerifs }
|
|
|
|
foreach { suffix { fTailed fHasTopSerif Serifs } } [Object.entries HConfig] : do
|
|
create-glyph "h.\(suffix)" : glyph-proc
|
|
include : MarkSet.b
|
|
include : VBar.l SB 0 Ascender
|
|
include : nShoulder
|
|
left -- (SB + Stroke * HVContrast)
|
|
right -- RightSB
|
|
bottom -- [if fTailed (XH - SmallArchDepthB + O) 0]
|
|
if fTailed : include : RightwardTailedBar RightSB 0 (XH - SmallArchDepthB)
|
|
include : Serifs fTailed false
|
|
|
|
create-glyph "hBar.\(suffix)" : glyph-proc
|
|
include [refer-glyph "h.\(suffix)"] AS_BASE ALSO_METRICS
|
|
include : HBar.mOverlay fHasTopSerif
|
|
|
|
create-glyph "hHookTop.\(suffix)" : glyph-proc
|
|
include : MarkSet.b
|
|
include : HooktopLeftBar.inner
|
|
include : nShoulder
|
|
left -- (SB + Stroke * HVContrast)
|
|
right -- RightSB
|
|
bottom -- [if fTailed (XH - SmallArchDepthB + O) 0]
|
|
if fTailed : include : RightwardTailedBar RightSB 0 (XH - SmallArchDepthB)
|
|
include : Serifs fTailed true
|
|
|
|
create-glyph "hHookTopLTail.\(suffix)" : glyph-proc
|
|
include : MarkSet.b
|
|
include : refer-glyph "hHookTop.\(suffix)"
|
|
eject-contour 'serifRB'
|
|
include : VerticalHook.r RightSB 0 (-HookX) Hook
|
|
|
|
create-glyph "heng.\(suffix)" : glyph-proc
|
|
include : MarkSet.b
|
|
include : refer-glyph "h.\(suffix)"
|
|
eject-contour 'serifRB'
|
|
include : VerticalHook.r RightSB 0 (-HookX) Hook
|
|
|
|
create-glyph "hengBar.\(suffix)" : glyph-proc
|
|
include [refer-glyph "heng.\(suffix)"] AS_BASE ALSO_METRICS
|
|
include : HBar.mOverlay fHasTopSerif
|
|
|
|
|
|
select-variant 'h' 'h'
|
|
link-reduced-variant 'h/descBase' 'h'
|
|
link-reduced-variant 'h/sansSerif' 'h' MathSansSerif
|
|
turned 'turnh' 0x265 'h' Middle (XH / 2) [MarkSet.p]
|
|
select-variant 'hBar' 0x127 (follow -- 'h')
|
|
|
|
|
|
select-variant 'cyrl/shha' 0x4BB (shapeFrom -- 'h')
|
|
derive-composites 'cyrl/shhaDescender' 0x527 'cyrl/shha' [CyrDescender.rSideJut RightSB 0]
|
|
|
|
select-variant 'hHookTop' 0x266
|
|
select-variant 'hHookTopLTail' 0x267
|
|
select-variant 'heng' 0xA727
|
|
select-variant 'cyrl/dje' 0x452 (follow -- 'heng') (shapeFrom -- 'hengBar')
|
|
|
|
derive-composites 'hPalatalHook' 0xA795 'h/descBase' [PalatalHook.rSideJut RightSB 0]
|
|
derive-composites 'hDescender' 0x2C68 'h/descBase' [CyrDescender.rSideJut RightSB 0]
|
|
|
|
create-glyph 'hookturnh' 0x2AE : glyph-proc
|
|
include : nShoulder
|
|
left -- (SB + Stroke * HVContrast)
|
|
right -- RightSB
|
|
bottom -- (Hook + HalfStroke)
|
|
include : VBar.l SB 0 Ascender
|
|
include : VerticalHook.r RightSB (Hook + HalfStroke) HookX Hook
|
|
include : FlipAround Middle (XH / 2)
|
|
include : MarkSet.p
|
|
if SLAB : begin
|
|
include : HSerif.lt (RightSB - Stroke * HVContrast) XH SideJut
|
|
include : HSerif.mb (RightSB - HalfStroke * HVContrast) Descender Jut
|
|
|
|
create-glyph 'hookturnhrtail' 0x2AF : glyph-proc
|
|
include : nShoulder
|
|
left -- (SB + Stroke * HVContrast)
|
|
right -- RightSB
|
|
bottom -- (Hook + HalfStroke)
|
|
include : VBar.l SB 0 XH
|
|
include : VerticalHook.r RightSB (Hook + HalfStroke) HookX Hook
|
|
include : FlipAround Middle (XH / 2)
|
|
include : VerticalHook.r RightSB 0 HookX Hook
|
|
include : MarkSet.p
|
|
if SLAB : begin
|
|
include : HSerif.lt (RightSB - Stroke * HVContrast) XH SideJut
|
|
|
|
derive-glyphs 'hCedilla' 0x1E29 'h' : lambda [src gr] : glyph-proc
|
|
include [refer-glyph 'cedillaBelow']
|
|
include : ApparentTranslate (Width + SB - Middle + HalfStroke * HVContrast) 0
|
|
include [refer-glyph src]
|
|
include : MarkSet.if
|
|
|
|
alias 'cyrl/tshe' 0x45B 'hBar'
|
|
|
|
glyph-block-import Letter-Blackboard : BBS BBD BBBarLeft
|
|
create-glyph 'mathbb/h' 0x1D559 : glyph-proc
|
|
local df : DivFrame 1 2
|
|
local bbs BBS
|
|
local bbd BBD
|
|
set-width df.width
|
|
include : df.markSet.e
|
|
include : BBBarLeft df.leftSB 0 Ascender
|
|
include : union
|
|
HBar.b (df.rightSB - bbd) df.rightSB 0 bbs
|
|
nShoulder
|
|
stroke -- bbs
|
|
left -- (df.leftSB + bbd + bbs * HVContrast)
|
|
right -- df.rightSB
|
|
fine -- ShoulderFine
|
|
intersection
|
|
VBar.r (df.rightSB - bbd) 0 XH bbs
|
|
nShoulderMask
|
|
stroke -- bbs
|
|
left -- (df.leftSB + bbd + bbs * HVContrast + 1)
|
|
right -- (df.rightSB - 1)
|
|
top -- (XH - 1)
|
|
fine -- ShoulderFine
|