292 lines
13 KiB
Text
292 lines
13 KiB
Text
$$include '../../meta/macros.ptl'
|
|
|
|
import [mix linreg fallback SuffixCfg] from "@iosevka/util"
|
|
import [MathSansSerif] from "@iosevka/glyph/relation"
|
|
|
|
glyph-module
|
|
|
|
glyph-block Letter-Latin-Lower-A : begin
|
|
glyph-block-import CommonShapes
|
|
glyph-block-import Common-Derivatives
|
|
glyph-block-import Mark-Shared-Metrics : markHalfStroke
|
|
glyph-block-import Letter-Shared : CreateAccentedComposition CreateOgonekComposition
|
|
glyph-block-import Letter-Shared : CreateTurnedLetter
|
|
glyph-block-import Letter-Shared-Shapes : SerifFrame OBarLeft OBarRight ArcStartSerif
|
|
glyph-block-import Letter-Shared-Shapes : RightwardTailedBar InvRightwardTailedBar
|
|
glyph-block-import Letter-Shared-Shapes : DToothlessRise DMBlend RetroflexHook InwardSlabArcStart
|
|
|
|
glyph-block-export DoubleStorey DoubleStoreyConfig
|
|
define DoubleStorey : namespace
|
|
define [ADoubleStoreyStroke df] : AdviceStroke2 2 3 XH df.div
|
|
define [ADoubleStoreySmoothA df] : begin
|
|
local sw : ADoubleStoreyStroke df
|
|
return : df.archDepthA (ArchDepth * [StrokeWidthBlend 0.9 0.81 sw]) sw
|
|
define [ADoubleStoreySmoothB df] : begin
|
|
local sw : ADoubleStoreyStroke df
|
|
return : df.archDepthB (ArchDepth * [StrokeWidthBlend 0.9 0.81 sw]) sw
|
|
|
|
define [ADoubleStoreyHookAndBarT sink df hookStyle y0 stroke] : begin
|
|
local isMask : sink == spiro-outline
|
|
return : sink
|
|
widths.rhs stroke
|
|
match hookStyle
|
|
1 : list
|
|
g4 df.leftSB (XH - AHook)
|
|
hookstart XH (sw -- stroke)
|
|
2 : InwardSlabArcStart.LtrRhs df.leftSB XH stroke
|
|
flat df.rightSB (XH - [ADoubleStoreySmoothB df])
|
|
[if isMask corner curl] df.rightSB y0 [heading Downward]
|
|
if [not isMask] {} {[corner df.leftSB y0]}
|
|
|
|
export : define [HookAndBar df hookStyle y0 _stroke] : glyph-proc
|
|
if ((hookStyle != 1) && (hookStyle != 2)) : throw : new Error "Invalid hookStyle"
|
|
local sw : fallback _stroke [ADoubleStoreyStroke df]
|
|
include : ADoubleStoreyHookAndBarT dispiro df hookStyle y0 sw
|
|
if (hookStyle == 2) : include : ArcStartSerif.L df.leftSB (XH - DToothlessRise) sw AHook
|
|
|
|
export : define [HookAndBarMask df hookStyle y0 _stroke] : begin
|
|
local sw : fallback _stroke [ADoubleStoreyStroke df]
|
|
return : ADoubleStoreyHookAndBarT spiro-outline df hookStyle y0 sw
|
|
|
|
define [ADoubleStoreyArcT df sink kind rise stroke] : glyph-proc
|
|
local isMask : sink == spiro-outline
|
|
local bartop : XH * OverlayPos * 1.02 + stroke * 0.425
|
|
local bowlArcY1 : YSmoothMidL 0 bartop SmallArchDepthA SmallArchDepthB
|
|
local bowlArcY2 : YSmoothMidR 0 bartop SmallArchDepthA SmallArchDepthB
|
|
local leftSlopeS : 0.1 * (df.width / HalfUPM)
|
|
local leftSlope : leftSlopeS - TanSlope
|
|
local barSmooth : mix df.leftSB df.rightSB 0.55
|
|
include : sink
|
|
widths.lhs stroke
|
|
[if isMask corner flat] (df.rightSB + O) bartop [heading Leftward]
|
|
curl barSmooth bartop
|
|
archv
|
|
g4 (df.leftSB + OX) (bowlArcY1 - [HSwToV Stroke] * leftSlope) [heading {.x HVContrast .y leftSlope}]
|
|
match kind
|
|
0 : list
|
|
arch.lhs 0 (sw -- stroke) (swAfter -- ShoulderFine)
|
|
straight.up.end (df.rightSB - [HSwToV stroke] + [HSwToV ShoulderFine]) (SmallArchDepthB * 0.9) [widths.lhs ShoulderFine]
|
|
if [not isMask] {} {[ corner (df.rightSB - [HSwToV stroke] + [HSwToV ShoulderFine]) bartop ]}
|
|
1 : list
|
|
arch.lhs 0 (sw -- stroke) (blendPost -- {})
|
|
g4 df.rightSB rise
|
|
2 : list
|
|
arch.lhs 0 (sw -- stroke)
|
|
flat df.rightSB bowlArcY2
|
|
curl df.rightSB ([Math.max bowlArcY2 rise] + stroke * TanSlope + 1) [heading Upward]
|
|
|
|
export : define [Arc df kind rise _sw] : ADoubleStoreyArcT df dispiro kind rise
|
|
fallback _sw [ADoubleStoreyStroke df]
|
|
export : define [ArcMask df kind rise _sw] : ADoubleStoreyArcT df spiro-outline kind rise
|
|
fallback _sw [ADoubleStoreyStroke df]
|
|
|
|
export : define [Serifless df hookStyle sw] : union
|
|
HookAndBar df hookStyle 0 sw
|
|
Arc df 0 nothing nothing sw
|
|
export : define [Serifed df hookStyle sw] : union
|
|
Serifless df hookStyle sw
|
|
begin [SerifFrame.fromDf df XH 0].rb.outer
|
|
export : define [Tailed df hookStyle sw] : union
|
|
HookAndBar df hookStyle (XH - [ADoubleStoreySmoothB df] + O) sw
|
|
Arc df 0 nothing nothing sw
|
|
RightwardTailedBar df.rightSB 0 (XH - [ADoubleStoreySmoothB df]) (sw -- [fallback sw : ADoubleStoreyStroke df])
|
|
export : define [ToothlessCorner df hookStyle sw] : union
|
|
HookAndBar df hookStyle DToothlessRise sw
|
|
Arc df 1 DToothlessRise sw
|
|
export : define [ToothlessRounded df hookStyle sw] : union
|
|
HookAndBar df hookStyle [ADoubleStoreySmoothA df] sw
|
|
Arc df 2 [ADoubleStoreySmoothA df] sw
|
|
|
|
export : define [GetMask shapeFn df sw] : match shapeFn
|
|
[Just ToothlessCorner] : ArcMask df 1 DToothlessRise sw
|
|
[Just ToothlessRounded] : ArcMask df 2 [ADoubleStoreySmoothA df] sw
|
|
__ : ArcMask df 0 nothing nothing sw
|
|
|
|
define DoubleStoreyConfig : object
|
|
doubleStoreySerifless { DoubleStorey.Serifless (RightSB ) 1 }
|
|
doubleStoreySerifed { DoubleStorey.Serifed (RightSB + SideJut) 1 }
|
|
doubleStoreyTailed { DoubleStorey.Tailed (RightSB + SideJut) 1 }
|
|
doubleStoreyToothlessCorner { DoubleStorey.ToothlessCorner nothing 1 }
|
|
doubleStoreyToothlessRounded { DoubleStorey.ToothlessRounded nothing 1 }
|
|
doubleStoreyHookInwardSerifedSerifless { DoubleStorey.Serifless (RightSB ) 2 }
|
|
doubleStoreyHookInwardSerifedSerifed { DoubleStorey.Serifed (RightSB + SideJut) 2 }
|
|
doubleStoreyHookInwardSerifedTailed { DoubleStorey.Tailed (RightSB + SideJut) 2 }
|
|
doubleStoreyHookInwardSerifedToothlessCorner { DoubleStorey.ToothlessCorner nothing 2 }
|
|
doubleStoreyHookInwardSerifedToothlessRounded { DoubleStorey.ToothlessRounded nothing 2 }
|
|
|
|
foreach { suffix { body xTrailing hookStyle } } [Object.entries DoubleStoreyConfig] : do
|
|
create-glyph "a.\(suffix)" : glyph-proc
|
|
local df : include : DivFrame 1
|
|
include : df.markSet.e
|
|
if xTrailing : set-base-anchor 'trailing' xTrailing 0
|
|
include : body df hookStyle
|
|
|
|
glyph-block-import Letter-Blackboard : BBS BBD
|
|
create-glyph 'mathbb/a' 0x1D552 : glyph-proc
|
|
local df : include : DivFrame 1
|
|
include : df.markSet.e
|
|
|
|
include : DoubleStorey.HookAndBar df 1 0 BBS
|
|
include : intersection
|
|
DoubleStorey.HookAndBarMask df 1 0
|
|
VBar.r (RightSB - BBD) 0 XH BBS
|
|
include : difference
|
|
union
|
|
DoubleStorey.Arc df 0 0 BBS
|
|
intersection
|
|
DoubleStorey.ArcMask df 0 0 BBS
|
|
VBar.l (SB + OX + BBD) 0 XH BBS
|
|
Rect XH 0 (RightSB - BBD) Width
|
|
include : HBar.b (RightSB - BBD) RightSB 0 BBS
|
|
|
|
glyph-block-export SingleStorey SingleStoreyConfig
|
|
define SingleStorey : namespace
|
|
export : define [FullBarBody df height bar mask _sw] : glyph-proc
|
|
local sw : fallback _sw df.mvs
|
|
include : OBarRight.shape
|
|
top -- height
|
|
left -- df.leftSB
|
|
right -- df.rightSB
|
|
sw -- sw
|
|
fine -- sw * (ShoulderFine / Stroke)
|
|
ada -- [df.archDepthA SmallArchDepth sw]
|
|
adb -- [df.archDepthB SmallArchDepth sw]
|
|
include : bar df height mask sw
|
|
export : define [EarlessCornerBody df height bar mask _sw] : glyph-proc
|
|
local sw : fallback _sw df.mvs
|
|
include : OBarLeft.toothless
|
|
top -- height
|
|
left -- df.leftSB
|
|
right -- df.rightSB
|
|
sw -- sw
|
|
fine -- sw * (ShoulderFine / Stroke)
|
|
ada -- [df.archDepthA SmallArchDepth sw]
|
|
adb -- [df.archDepthB SmallArchDepth sw]
|
|
rise -- DToothlessRise
|
|
mBlend -- DMBlend
|
|
include : FlipAround df.middle (height / 2)
|
|
include : bar df (height - DToothlessRise) mask sw
|
|
export : define [EarlessRoundedBody df height bar mask _sw] : glyph-proc
|
|
local sw : fallback _sw df.mvs
|
|
local ada : df.archDepthA SmallArchDepth sw
|
|
local adb : df.archDepthB SmallArchDepth sw
|
|
include : OBarLeft.rounded
|
|
top -- height
|
|
left -- df.leftSB
|
|
right -- df.rightSB
|
|
sw -- sw
|
|
fine -- sw * (ShoulderFine / Stroke)
|
|
ada -- ada
|
|
adb -- adb
|
|
yTerminal -- (height - ada)
|
|
include : FlipAround df.middle (height / 2)
|
|
include : bar df (height - adb) mask sw
|
|
|
|
export : define [SeriflessBar df height mask sw] : glyph-proc
|
|
set-base-anchor 'trailing' df.rightSB 0
|
|
include : difference
|
|
VBar.r df.rightSB 0 height sw
|
|
mask df height sw
|
|
export : define [SerifedBar df height mask sw] : glyph-proc
|
|
include : SeriflessBar df height mask sw
|
|
include [SerifFrame.fromDf df height 0 (swSerif -- sw)].rb.outer
|
|
export : define [TopSerifedBar df height mask sw] : glyph-proc
|
|
include : SeriflessBar df height mask sw
|
|
include [SerifFrame.fromDf df height 0 (swSerif -- sw)].rt.outer
|
|
export : define [DoubleSerifedBar df height mask sw] : glyph-proc
|
|
include : SerifedBar df height mask sw
|
|
include [SerifFrame.fromDf df height 0 (swSerif -- sw)].rt.outer
|
|
export : define [TailedBar df height mask sw] : glyph-proc
|
|
set-base-anchor 'trailing' (df.rightSB + SideJut) 0
|
|
include : difference
|
|
RightwardTailedBar df.rightSB 0 height sw
|
|
mask df height sw
|
|
export : define [TailedSerifedBar df height mask sw] : glyph-proc
|
|
include : TailedBar df height mask sw
|
|
include [SerifFrame.fromDf df height 0 (swSerif -- sw)].rt.outer
|
|
|
|
set SeriflessBar.inv SeriflessBar
|
|
set SerifedBar.inv TopSerifedBar
|
|
set TopSerifedBar.inv SerifedBar
|
|
set DoubleSerifedBar.inv DoubleSerifedBar
|
|
set TailedBar.inv : function [df height mask sw] : glyph-proc
|
|
set-base-anchor 'trailing' (df.rightSB + SideJut) 0
|
|
include : difference
|
|
InvRightwardTailedBar df.rightSB 0 height sw
|
|
mask df height sw
|
|
set TailedSerifedBar.inv : function [df height mask sw] : glyph-proc
|
|
set-base-anchor 'trailing' (df.rightSB + SideJut) 0
|
|
include : difference
|
|
InvRightwardTailedBar df.rightSB 0 height sw
|
|
mask df height sw
|
|
include [SerifFrame.fromDf df height 0 (swSerif -- sw)].rb.outer
|
|
|
|
|
|
export : define [ScriptCut df y sw] : spiro-outline
|
|
corner df.rightSB y
|
|
corner (df.rightSB - [HSwToV sw]) y
|
|
corner (df.rightSB - [HSwToV sw]) (y - sw / 2)
|
|
export : define [InvScriptCut df y sw] : spiro-outline
|
|
corner df.rightSB 0
|
|
corner (df.rightSB - [HSwToV sw]) 0
|
|
corner (df.rightSB - [HSwToV sw]) (0 + sw / 2)
|
|
|
|
define SingleStoreyConfig : object
|
|
singleStoreySerifless { SingleStorey.FullBarBody SingleStorey.SeriflessBar }
|
|
singleStoreyEarlessCornerSerifless { SingleStorey.EarlessCornerBody SingleStorey.SeriflessBar }
|
|
singleStoreyEarlessRoundedSerifless { SingleStorey.EarlessRoundedBody SingleStorey.SeriflessBar }
|
|
|
|
singleStoreyTopSerifed { SingleStorey.FullBarBody SingleStorey.TopSerifedBar }
|
|
|
|
singleStoreySerifed { SingleStorey.FullBarBody SingleStorey.SerifedBar }
|
|
singleStoreyEarlessCornerSerifed { SingleStorey.EarlessCornerBody SingleStorey.SerifedBar }
|
|
singleStoreyEarlessRoundedSerifed { SingleStorey.EarlessRoundedBody SingleStorey.SerifedBar }
|
|
|
|
singleStoreyDoubleSerifed { SingleStorey.FullBarBody SingleStorey.DoubleSerifedBar }
|
|
|
|
singleStoreyTailed { SingleStorey.FullBarBody SingleStorey.TailedBar }
|
|
singleStoreyEarlessCornerTailed { SingleStorey.EarlessCornerBody SingleStorey.TailedBar }
|
|
singleStoreyEarlessRoundedTailed { SingleStorey.EarlessRoundedBody SingleStorey.TailedBar }
|
|
|
|
singleStoreyTailedSerifed { SingleStorey.FullBarBody SingleStorey.TailedSerifedBar }
|
|
|
|
foreach { suffix { body bar } } [Object.entries SingleStoreyConfig] : do
|
|
create-glyph "a.\(suffix)" : glyph-proc
|
|
include : MarkSet.e
|
|
include : body [DivFrame 1] XH bar no-shape
|
|
create-glyph "largescripta.\(suffix)" : glyph-proc
|
|
include : MarkSet.capital
|
|
include : body [DivFrame 1] CAP bar SingleStorey.ScriptCut
|
|
create-glyph "scripta.\(suffix)" : glyph-proc
|
|
include : MarkSet.e
|
|
include : body [DivFrame 1] XH bar SingleStorey.ScriptCut
|
|
create-glyph "invscripta.\(suffix)" : glyph-proc
|
|
include : MarkSet.e
|
|
include : body [DivFrame 1] XH bar.inv SingleStorey.InvScriptCut
|
|
|
|
select-variant 'a' 'a'
|
|
link-reduced-variant 'a/sansSerif' 'a' MathSansSerif
|
|
link-reduced-variant 'a/rtailBase' 'a'
|
|
link-reduced-variant 'a/turnABase' 'a'
|
|
select-variant 'cyrl/a' 0x430 (shapeFrom -- 'a')
|
|
|
|
CreateTurnedLetter 'turna' 0x250 'a/turnABase' HalfAdvance (XH / 2)
|
|
|
|
derive-composites 'aRetroflexHook' 0x1D8F 'a/rtailBase'
|
|
RetroflexHook.rSideJut RightSB 0 (yOverflow -- Stroke)
|
|
|
|
select-variant 'scripta' 0x0251
|
|
select-variant 'largescripta' 0x2C6D (follow -- 'scripta')
|
|
select-variant 'invscripta' 0xAB64 (follow -- 'scripta')
|
|
derive-composites 'alphaRetroflexHook' 0x1D90 'scripta.singleStoreySerifless'
|
|
RetroflexHook.rSideJut RightSB 0 (yOverflow -- Stroke)
|
|
|
|
CreateTurnedLetter 'turnscripta' 0x252 'scripta' HalfAdvance (XH / 2)
|
|
CreateTurnedLetter 'turnlargescripta' 0x2C70 'largescripta' HalfAdvance (CAP / 2)
|
|
|
|
CreateAccentedComposition 'aDieresis' 0xE4 'a' 'dieresisAbove'
|
|
CreateAccentedComposition 'aSbRsbUnderlineBelow' null 'a' 'sbRsbUnderlineBelow'
|
|
CreateAccentedComposition 'aRightHalfRingTR' 0x1E9A 'a' 'rightHalfCircleTR'
|
|
|
|
# Ognoek shapes
|
|
CreateOgonekComposition 'aOgonek' 0x105 'a'
|