###########################################################################################
# UNIFIED LETTERFORMS : LATIN ORIGINALS
###########################################################################################

$$include '../meta/macros.ptl'

import '../support/transform' as : Transform && [object [transformPoint tp] [untransform utp] inverse]
import [mix linreg clamp fallback] from '../support/utils'
import [designParameters] from '../meta/aesthetics'

export : define [apply] : begin
	glyph-module-entry commonShapes overmarks

	### I
	sketch # I.straight
		include markset.capital
		include : VBar MIDDLE 0 CAP
		set currentGlyph.cmpPriority (-2)
		save 'I.straight'

	define [ISerifShape top] : glyph-construction
		include : VBar MIDDLE 0 top
		include : CenterBottomSerif MIDDLE 0 (LONGJUT * 0.8)
		include : CenterTopSerif MIDDLE top (LONGJUT * 0.8)

	sketch # I.serifed
		include markset.capital
		include : ISerifShape CAP

		save 'I.serifed'

	select-variant 'I' 'I' 'serifed'
	alias 'Iota' 0x399 'I'
	alias 'cyrUkrainianI' 0x406 'I'
	alias 'Palochka' 0x4C0 'I'

	sketch # smcpI
		include markset.e
		include : ISerifShape XH
		save 'smcpI' 0x26A

	### dotless i, i and iota
	# iota
	define [IotaShape top] : glyph-construction
		local middle MIDDLE
		set-anchor 'above' BASE middle top
		include : tagged 'serifLT' : LeftwardTopSerif middle top LONGJUT
		include : dispiro
			widths.center
			flat middle top [heading DOWNWARD]
			curl middle HOOK
			arcvh
			flat (middle + HOOK - HALFSTROKE) HALFSTROKE
			curl (middle + LONGJUT * 1.05) HALFSTROKE [heading RIGHTWARD]

	sketch # iota
		include markset.e
		include : IotaShape XH
		save 'iota' 0x3B9
		save 'latiniota' 0x269

	sketch # latinIota
		include markset.capital
		include : IotaShape CAP
		save 'latinIota' 0x196

	sketch # dotlessi.straight
		include markset.e
		include : VBar (MIDDLE) 0 XH
		set currentGlyph.cmpPriority (-2)
		save 'dotlessi.straight'

	sketch # dotlessi.hooky
		include markset.e
		include : VBar (MIDDLE + IBALANCE2) 0 XH
		include : LeftwardTopSerif (MIDDLE + IBALANCE2) XH LONGJUT
		save 'dotlessi.hooky'

	sketch # dotlessi.zshaped
		include markset.e
		include : VBar (MIDDLE) 0 XH
		include : LeftwardTopSerif (MIDDLE) XH LONGJUT
		include : RightwardBottomSerif MIDDLE 0 LONGJUT
		save 'dotlessi.zshaped'

	sketch # dotlessi.serifed
		include markset.e
		local balance IBALANCE
		include : VBar (MIDDLE + balance) 0 XH
		include : LeftwardTopSerif (MIDDLE + balance) XH (LONGJUT - balance)
		include : RightwardBottomSerif MIDDLE 0 LONGJUT
		include : LeftwardBottomSerif MIDDLE 0 LONGJUT
		save 'dotlessi.serifed'

	sketch # dotlessi.italic
		if para.isItalic
		: then : begin
			local left : [mix SB RIGHTSB [linreg 18 0.42 126 0.46 STROKE]] - HALFSTROKE * HVCONTRAST
			local right : mix SB RIGHTSB 1.1
			local middle : mix left right 0.55
			include : dispiro
				widths.lhs
				flat left XH [heading DOWNWARD]
				curl left (SMALLSMOOTHB * 0.8)
				hookend O
				g4   right (HOOK * [linreg 18 0.85 126 1 STROKE])
			include : dispiro
				flat (left - LONGJUT + HALFSTROKE * HVCONTRAST) XH [widths 0 STROKE]
				curl left XH
			include markset.e
			set-anchor 'above' BASE (left + HALFSTROKE * HVCONTRAST + [linreg 18 0.25 126 0 STROKE] * TANSLANT * WIDTH) XH
			set-anchor 'below' BASE middle 0
		: else : begin
			include markset.e
			include : IotaShape XH
		save 'dotlessi.italic'

	select-variant 'dotlessi' 0x131 [if para.isItalic 'italic' 'serifed'] {
		.'cv03' 'dotlessi.serifed'
		.'cv04' 'dotlessi.italic'
		.'cv05' 'dotlessi.hooky'
		.'cv06' 'dotlessi.zshaped'
	}

	sketch # iogonek.dotless
		include glyphs.dotlessi AS_BASE
		include glyphs.ogonekBelow
		save 'iogonek.dotless'


	composite 'i' glyphs.dotlessi glyphs.dotAbove [into-unicode 'i']
	if (glyphs.i && glyphs.dotlessi) : begin
		composite 'i.cv03' glyphs.(glyphs.dotlessi.featureSelector.cv03) glyphs.dotAbove
		composite 'i.cv04' glyphs.(glyphs.dotlessi.featureSelector.cv04) glyphs.dotAbove
		composite 'i.cv05' glyphs.(glyphs.dotlessi.featureSelector.cv05) glyphs.dotAbove
		composite 'i.cv06' glyphs.(glyphs.dotlessi.featureSelector.cv06) glyphs.dotAbove
		set glyphs.i.featureSelector {
			.cv03 'i.cv03'
			.cv04 'i.cv04'
			.cv05 'i.cv05'
			.cv06 'i.cv06'
		}
	alias 'cyrUkrainiani' 0x456 'i'
	turned nothing 0x1D09 'i' MIDDLE (XH / 2) markset.p
	* IotaShape

	### J
	sketch # J.straight
		set-width WIDTH
		include markset.capital
		set-anchor 'above' BASE (RIGHTSB - STROKE * HVCONTRAST * 0.75 - JBALANCE2) CAP
		set-anchor 'overlay' BASE (RIGHTSB - STROKE * HVCONTRAST * 0.75 - JBALANCE2) (CAP * OVERLAYPOS)

		local slope (STROKE * 0.00092)
		local expand 0.35
		local coexpand ((1 - expand) / 2)

		local hookx (0.75 * SB)

		include : dispiro
			widths.rhs
			flat (RIGHTSB - JBALANCE2) CAP [heading DOWNWARD]
			curl (RIGHTSB - JBALANCE2) SMOOTH
			hookend O
			g4 hookx HOOK

		save 'J.straight'

	sketch # J.shorthook
		set-width WIDTH
		include markset.capital

		local slope (STROKE * 0.00092)
		local expand 0.35
		local coexpand ((1 - expand) / 2)
		local smooth : HOOK + 0.75 * STROKE

		local hookx (0.5 * SB)

		include : dispiro
			widths.rhs
			flat (RIGHTSB - JBALANCE2) CAP [heading DOWNWARD]
			curl (RIGHTSB - JBALANCE2) smooth
			straight.left.end [mix SB RIGHTSB 0.3] O [heading LEFTWARD]

		save 'J.shorthook'

	sketch # J.serifed
		set-width WIDTH
		include glyphs.'J.straight' AS_BASE
		include : LeftwardTopSerif (RIGHTSB - HALFSTROKE * HVCONTRAST - JBALANCE2) CAP LONGJUT

		save 'J.serifed'

	select-variant 'J' 'J' 'serifed'
	alias 'cyrJe' 0x408 'J'
	alias 'grkJ' 0x37F 'J'

	### dotless j and j
	sketch # dotlessj.straight
		include markset.p
		local center : MIDDLE + JBALANCE + HALFSTROKE * HVCONTRAST
		set-anchor 'above' BASE (center - HVCONTRAST * HALFSTROKE) XH
		set-anchor 'overlay' BASE (center - HVCONTRAST * HALFSTROKE) (XH / 2)
		local hookx  : center - (WIDTH * 0.5) - STROKE * HVCONTRAST + OXHOOK
		local turn : [mix center hookx 0.5] + CORRECTION_OMIDS
		include : dispiro
			widths.rhs
			flat center XH [heading DOWNWARD]
			curl center (DESCENDER + SMOOTHA)
			hookend (DESCENDER + O)
			g4 hookx (DESCENDER + JHOOK)

		save 'dotlessj.straight'

	sketch # dotlessj.serifed
		include markset.p
		include glyphs.'dotlessj.straight' AS_BASE
		include : LeftwardTopSerif (MIDDLE + JBALANCE) XH LONGJUT

		set-anchor 'above' BASE (MIDDLE + JBALANCE - STROKE * 0.166 * HVCONTRAST) XH
		set-anchor 'overlay' BASE (MIDDLE + JBALANCE - STROKE * 0.166 * HVCONTRAST) (XH / 2)
		save 'dotlessj.serifed'

	select-variant 'dotlessj' 0x237 'serifed'

	sketch # j
		set-width WIDTH

		include glyphs.dotlessj AS_BASE
		include glyphs.dotAbove
		save 'j' 'j'
		save 'grkj' 0x3F3
		save 'cyrje' 0x458

	sketch # jcurlytail
		include markset.p
		set-anchor 'above' BASE (MIDDLE + JBALANCE) XH
		local fine : adviceBlackness 3.5
		local rinner : LONGJUT / 2 - fine / 2
		local m1 : MIDDLE - HALFSTROKE * HVCONTRAST + JBALANCE
		local x2 : mix RIGHTSB m1 0.25
		local y2 : DESCENDER + O
		include : LeftwardTopSerif (MIDDLE + JBALANCE) XH LONGJUT
		include : dispiro
			widths.lhs
			flat m1 XH [heading DOWNWARD]
			curl m1 (DESCENDER + fine + rinner * 2)
			CurlyTail fine rinner m1 DESCENDER (m1 - LONGJUT) x2 y2
		include glyphs.dotAbove
		save 'jcurlytail' 0x29D


	### L
	define [LShape top] : glyph-construction
		include : VBarLeft (SB * 1.5) 0 top
		include : HBarBottom (SB * 1.5 - O) (RIGHTSB - OX) 0
		if SLAB : begin
			include : LeftwardBottomSerif (SB * 1.5) 0 SIDEJUT
			include : CenterTopSerif (SB * 1.5 + HVCONTRAST * HALFSTROKE) top JUT
			include : UpwardRightSerif (RIGHTSB - OX) 0 VJUT

	sketch # L
		set-width WIDTH
		include markset.capital
		include : LShape CAP

		save 'L' 'L'
	turned 'turnL' 0xA780 'L' MIDDLE (CAP / 2)

	sketch # Lcaron
		include glyphs.commaAbove
		apply-transform : Translate (WIDTH + (RIGHTSB - SB) * 0.375) 0
		include glyphs.L AS_BASE

		save 'Lcaron' 0x13D

	sketch # Lslash
		include glyphs.L AS_BASE
		local fine : 0.5 * OVERLAYSTROKE
		local middle : mix STROKE CAP 0.5
		include : dispiro
			flat [mix 0 SB 0.5] (middle - LONGJUT * 0.4) [widths fine fine]
			curl (1.6 * LONGJUT + [mix 0 SB 0.5]) (middle + LONGJUT * 0.4)

		save 'Lslash' 0x141

	sketch # Ldot
		include glyphs.L AS_BASE
		include : Ring ([mix STROKE CAP 0.5] + DOTRADIUS) ([mix STROKE CAP 0.5] - DOTRADIUS) ([mix SB RIGHTSB 0.65] - DOTRADIUS) ([mix SB RIGHTSB 0.65] + DOTRADIUS)

		save 'Ldot' 0x13F

	sketch # Lbar
		include glyphs.L AS_BASE
		include : HOverlayBar (SB * 0.3) [mix (SB + STROKE) (RIGHTSB - STROKE) 0.55] (CAP * OVERLAYPOS)

		save 'Lbar' 0x23D

	sketch # smcpL
		include markset.e
		include : LShape XH
		save 'smcpL' 0x29F

	### l
	create-glyph 'l.straight'  : glyph-construction
		include markset.b
		set currentGlyph.cmpPriority (-2)
		include : VBar MIDDLE 0 CAP

	sketch # l.hooky
		include markset.b
		local middle : MIDDLE + LBALANCE2
		set-anchor 'above' BASE middle CAP
		set-anchor 'below' BASE middle 0
		set-anchor 'overlay' BASE middle (CAP * OVERLAYPOS)
		include : VBar (MIDDLE + LBALANCE2) 0 (CAP - STROKE)
		include : LeftwardTopSerif (MIDDLE + LBALANCE2) CAP LONGJUT
		
		save 'l.hooky'

	sketch # l.zshaped
		include markset.b
		include : VBar MIDDLE 0 (CAP - STROKE)
		include : tagged 'serifLT' : LeftwardTopSerif MIDDLE CAP LONGJUT
		include : tagged 'serifRB' : RightwardBottomSerif MIDDLE 0 LONGJUT

		save 'l.zshaped'

	sketch # l.serifed
		include markset.b
		include : VBar (MIDDLE + LBALANCE) 0 CAP
		include : LeftwardTopSerif (MIDDLE + LBALANCE) CAP (LONGJUT - LBALANCE)
		include : CenterBottomSerif MIDDLE 0 LONGJUT
		set-anchor 'overlay' BASE (MIDDLE + LBALANCE / 2) (CAP * OVERLAYPOS)

		save 'l.serifed'

	sketch # l.italic
		include markset.b
		if para.isItalic
		: then : begin
			local left : mix SB RIGHTSB 0.3
			local right : mix SB RIGHTSB 1.1
			local middle : mix left right 0.54
			include : dispiro
				widths.lhs
				flat left CAP [heading DOWNWARD]
				curl left (SMALLSMOOTHB * 0.85)
				hookend O
				g4   right HOOK
			include : tagged 'serifLT': dispiro
				flat SB CAP [widths 0 STROKE]
				curl left CAP
			set-anchor 'above' BASE (left + HALFSTROKE) CAP
			set-anchor 'below' BASE middle 0
			set-anchor 'overlay' BASE (left + HALFSTROKE) (CAP * OVERLAYPOS)
		: else : include : IotaShape CAP
		save 'l.italic'
	
	sketch # l.tailed
		include markset.b
		local middle : MIDDLE - LBALANCE2
		local top CAP
		local x0 : (HOOK - HALFSTROKE + 1) * 0.9 + LBALANCE2
		local x1 : [Math.max (HOOK - HALFSTROKE + 1) LONGJUT] + LBALANCE2
		include : dispiro
			widths.center
			flat (middle) top [heading DOWNWARD]
			curl (middle) HOOK
			arcvh
			g4.right.mid (middle + x0) (HALFSTROKE + O) [heading RIGHTWARD]
			g4 (middle + x1) (HALFSTROKE - O) [heading RIGHTWARD]
		set-anchor 'above' BASE middle CAP
		set-anchor 'below' BASE middle 0
		set-anchor 'overlay' BASE middle (CAP * OVERLAYPOS)
		save 'l.tailed'

	sketch # l.hookybottom
		include markset.b
		local middle : MIDDLE - LBALANCE2
		set-anchor 'above' BASE middle CAP
		set-anchor 'below' BASE middle 0
		set-anchor 'overlay' BASE middle (CAP * OVERLAYPOS)
		include : VBar middle 0 CAP
		include : RightwardBottomSerif middle 0 LONGJUT
		save 'l.hookybottom'


	select-variant 'l' 'l' [if para.isItalic 'italic' 'serifed'] {
		.'cv07' 'l.serifed'
		.'cv08' 'l.italic'
		.'cv09' 'l.hooky'
		.'cv10' 'l.zshaped'
		.'cv27' 'l.tailed'
		.'cv28' 'l.hookybottom'
	}
	alias 'palochka' 0x4CF 'l'
	turned 'turnl' 0xA781 'l' MIDDLE (XH / 2) markset.p

	sketch # ldot
		include glyphs.l AS_BASE
		apply-transform : Translate (-DOTRADIUS / 2) 0
		include : Ring ([mix STROKE CAP 0.5] + DOTRADIUS) ([mix STROKE CAP 0.5] - DOTRADIUS) ([mix SB RIGHTSB 1] - DOTSIZE) [mix SB RIGHTSB 1]

		save 'ldot' 0x140

	sketch # lrtail
		include glyphs.rtailBR
		apply-transform : Translate (MIDDLE + LBALANCE2 + HALFSTROKE * HVCONTRAST) 0
		include glyphs.'l.hooky'
		include markset.if

		save 'lrtail' 0x26D

	sketch # lcurlytail
		include markset.b
		local fine : adviceBlackness 3.5
		local rinner : LONGJUT / 2 - fine / 2
		local m1 : MIDDLE + HALFSTROKE * HVCONTRAST
		local x2 : mix SB m1 0.25
		local y2 : - fine
		include : LeftwardTopSerif MIDDLE CAP LONGJUT
		include : dispiro
			widths.rhs
			flat m1 CAP [heading DOWNWARD]
			curl m1 (fine + rinner * 2)
			CurlyTail fine rinner m1 0 (m1 + LONGJUT) x2 y2

		save 'lcurlytail' 0x234

	sketch # ltildeover
		include glyphs.'l.serifed' AS_BASE
		include : create-glyph : glyph-construction
			include glyphs.tildeAbove
			apply-transform : Upright
			apply-transform : Translate (MIDDLE - markMiddle) (CAP * 0.525 - [mix aboveMarkBot aboveMarkTop 0.5])
			apply-transform : Italify

		save 'ltildeover' 0x26B
	define [Belt] : glyph-construction
		local fine : adviceBlackness 4.5
		local r : XH * 0.05
		include : dispiro
			widths.rhs fine
			flat MIDDLE (CAPMIDDLE + r) [heading LEFTWARD]
			curl (MIDDLE - HALFSTROKE - r * 1.5) (CAPMIDDLE + r)
			archv
			g4.down.mid (MIDDLE - HALFSTROKE - r * 2.5) CAPMIDDLE [heading DOWNWARD]
			arcvh
			flat (MIDDLE - HALFSTROKE - r * 1.5) (CAPMIDDLE - r)
			curl (MIDDLE + HALFSTROKE + r * 1.5 + fine) (CAPMIDDLE - r)

	sketch # lbelt
		include glyphs.'l.serifed' AS_BASE
		include : Belt

		save 'lbelt' 0x26C

	sketch # lbeltrtail
		include glyphs.lrtail AS_BASE
		include : Belt

		save 'lbeltrtail' 0xA78E

	sketch # looprevesh
		include markset.if
		local fine : adviceBlackness 4
		include : dispiro
			widths.center fine
			g4.down.start MIDDLE (CAP - fine * 1.5) [heading DOWNWARD]
			arcvh
			g4 (MIDDLE - fine * 1) (CAP - fine * 2.5) [heading LEFTWARD]
			archv
			g4 (MIDDLE - fine * 2) (CAP - fine * 1.5) [heading UPWARD]
			arcvh
			g4 (MIDDLE - fine * 1) (CAP - fine * 0.5) [heading RIGHTWARD]
			archv
			flat MIDDLE (CAP - fine * 1.5) [widths.heading HALFSTROKE HALFSTROKE DOWNWARD]
			curl MIDDLE 0 [heading DOWNWARD]
			arcvh
			straight.right.end (MIDDLE + HOOKX) (-HOOK)
		save 'looprevesh' 0x1AA

	### V and v
	local cornerdist : HALFSTROKE * HVCONTRAST * [if SLAB 1.2 1]
	local vcurviness : if (SLAB && !para.isItalic) 0.15 0.3
	define [VShape] : params [top [sw STROKE]] : glyph-construction
		include : dispiro
			widths.lhs sw
			flat SB top [heading DOWNWARD]
			curl SB (top * 0.9) [heading DOWNWARD]
			quadcontrols 0 vcurviness 9 unimportant
			g4   (MIDDLE - cornerdist) 0 [widths.lhs (VShape.fine * sw / STROKE)]

		#bottom cap
		start-from (MIDDLE + cornerdist) 0
		line-to (MIDDLE - cornerdist) 0
		line-to MIDDLE (VShape.fine * sw / STROKE)

		include : dispiro
			widths.rhs sw
			flat RIGHTSB top [heading DOWNWARD]
			curl RIGHTSB (top * 0.9) [heading DOWNWARD]
			quadcontrols 0 vcurviness 9 unimportant
			g4   (MIDDLE + cornerdist) 0 [widths.rhs (VShape.fine * sw / STROKE)]
		tag-contour 'strokeUp'
		include : AIVSerifs top
	set VShape.fine : STROKE * [fallback para.vtipfine : if SLAB 0.9 0.8]

	sketch # V
		set-width WIDTH
		include markset.capital
		include : VShape CAP

		save 'V' 'V'

	sketch # v
		include markset.e
		include : VShape XH

		save 'v' 'v'
	define [VHooktopShape top] : glyph-construction
		include : VShape top
		eject-contour 'serifRT'
		eject-contour 'strokeUp'

		include : dispiro
			widths.rhs
			straight.left.start (RIGHTSB + HOOKX / 3) (top - STROKE)
			g4 (RIGHTSB - HOOKX / 3) (top - HALFSTROKE - HOOK)
			quadcontrols 0.4 0.75 64 unimportant
			g4   (MIDDLE + cornerdist) 0 [widths.rhs VShape.fine]

	sketch # vhooktop
		include markset.e
		include : VHooktopShape XH
		save 'vhooktop' 0x2C71
		save 'cyrizhitsa' 0x475

	sketch # cyrIzhitsa
		include markset.capital
		include : VHooktopShape CAP
		save 'cyrIzhitsa' 0x474

	turned 'turnv' 0x28C 'v' MIDDLE (XH / 2)

	sketch # nu
		include markset.e

		local xmid : MIDDLE + HALFSTROKE * 0.75

		include : dispiro
			g4 (SB + 0.4 * STROKE * HVCONTRAST) (XH - O) [widths.rhs]
			bezcontrols 0.33 0.2 1 0.76 6 important
			g4.down.end xmid 0 [heading DOWNWARD]

		include : dispiro
			widths.rhs
			flat RIGHTSB XH [heading DOWNWARD]
			curl RIGHTSB (XH * 0.9) [heading DOWNWARD]
			quadcontrols 0 0.3 6
			g4   xmid 0

		save 'nu' 0x3BD
	* VShape

	### A
	sketch # A
		set-width WIDTH
		include markset.capital
		set-anchor 'trailing' BASE (RIGHTSB - markHalfStroke) 0

		include : VShape CAP
		include : FlipAround MIDDLE (CAP / 2)

		local p : linreg 18 0.075 108 0.075 STROKE
		if (SLAB && !para.isItalic) : set p : p * 1.33
		include : HBarTop [mix SB RIGHTSB p] [mix RIGHTSB SB p] (XH / 2)
		save 'A' 'A'
		save 'Alpha' 0x391
		save 'cyrA' 0x410
	turned nothing 0x2C6F 'A' MIDDLE (CAP / 2)
	### a
	sketch # a.doublestorey
		set-width WIDTH
		include markset.e
		set-anchor 'trailing' BASE (RIGHTSB - markHalfStroke) 0
		local bartop (XH * OVERLAYPOS * 1.02 + HALFSTROKE)
		local lowslope : shoulderMidSlope SHOULDERFINE nothing (-1)
		local lowmiddle : [mix (SB + OX) (RIGHTSB - HALFSTROKE * HVCONTRAST) [linreg 72 0.51 126 0.58 STROKE]] + CORRECTION_OMIDS * 0.5
		local barsmooth : mix SB RIGHTSB 0.55
		include : dispiro
			widths.lhs
			flat RIGHTSB 0 [heading UPWARD]
			curl RIGHTSB (XH - SMOOTHB * [linreg 18 0.9 126 0.81 STROKE])
			hookend XO
			g4 (SB - OXHOOK / 2) (XH - AHOOK)
		include : dispiro
			widths.lhs
			flat (RIGHTSB + O) bartop [heading LEFTWARD]
			curl barsmooth bartop
			archv
			g4   (SB + OX) (bartop * 0.95 * (SMALLSMOOTHB / (SMALLSMOOTHA + SMALLSMOOTHB)))
			arcvh
			g4   (lowmiddle + (-lowslope) * STROKE) O [heading {.y 1 .x lowslope}]
			archv 16
			straight.up.end   (RIGHTSB - STROKE * HVCONTRAST + SHOULDERFINE * HVCONTRAST) (SMALLSMOOTHB * 0.9) [widths.lhs SHOULDERFINE]
		if SLAB : begin
			include : tagged 'serifRB' : RightwardBottomSerif RIGHTSB 0 SIDEJUT

		save 'a.doublestorey'

	sketch # a.singlestorey
		set-width WIDTH
		include markset.e
		set-anchor 'trailing' BASE (RIGHTSB - markHalfStroke) 0
		include : OBarRightShape
		if SLAB
		: then : begin
			include : VBarRight RIGHTSB 0 XH
			include : RightwardBottomSerif RIGHTSB 0 SIDEJUT
			tag-contour 'serifRB'
		: else : begin
			include : dispiro
				widths.rhs
				flat RIGHTSB XH [heading DOWNWARD]
				curl RIGHTSB SMOOTHA [heading DOWNWARD]
				g4 [mix SB RIGHTSB 1.075] 0 [heading DOWNWARD]
			set-anchor 'bottomright' BASE [mix SB RIGHTSB 1.075] 0
		save 'a.singlestorey'

	select-variant 'a' 'a' [if para.isItalic 'singlestorey' 'doublestorey'] {
		.'cv01' 'a.doublestorey'
		.'cv02' 'a.singlestorey'
	}
	alias 'cyra' 0x430 'a'

	sketch # turnlargescripta
		include markset.capital
		include : OBarRightShape CAP
		start-from RIGHTSB 0
		line-to    (RIGHTSB - STROKE * HVCONTRAST) 0
		line-to    (RIGHTSB - STROKE * HVCONTRAST) (CAP - STROKE / 2)
		line-to    RIGHTSB (CAP - O)
		save 'largescripta' 0x2C6D
		include : FlipAround MIDDLE (CAP / 2)
		save 'turnlargescripta' 0x2C70

	sketch # scripta
		include markset.e
		include : OBarRightShape
		start-from RIGHTSB 0
		line-to    (RIGHTSB - STROKE * HVCONTRAST) 0
		line-to    (RIGHTSB - STROKE * HVCONTRAST) (XH - STROKE / 2)
		line-to    RIGHTSB (XH - O)
		if SLAB : begin
			include : RightwardBottomSerif RIGHTSB 0 SIDEJUT
			tag-contour 'serifRB'
		save 'scripta' 0x0251
	turned 'turna' 0x250 'a.doublestorey' MIDDLE (XH / 2)
	turned nothing 0x252 'scripta' MIDDLE (XH / 2)

	sketch # artail
		include glyphs.'a.doublestorey' AS_BASE
		eject-contour 'serifRB'
		include glyphs.rtailBR
		save 'artail' 0x1D8F

	### W and w
	define [WShape top] : glyph-construction
		local wheight (top * 0.6)

		include : dispiro
			widths.lhs
			flat SB top [heading DOWNWARD]
			curl SB (top * 0.75) [heading DOWNWARD]
			quadcontrols 0 0.3 6 unimportant
			g4   (WShape.m1 - WShape.fine / 2 * HVCONTRAST) 0 [widths.lhs (WShape.fine * 0.8)]

		# bottom cap 1
		start-from (WShape.m1 + WShape.fine / 2 * HVCONTRAST) 0
		line-to (WShape.m1 - WShape.fine / 2 * HVCONTRAST) 0
		line-to WShape.m1 WShape.fine

		include : dispiro
			widths.rhs WShape.fine
			flat (MIDDLE + WShape.fine / 2 * HVCONTRAST) wheight [heading DOWNWARD]
			#quadcontrols 0 0.1 6 unimportant
			g4  (WShape.m1 + WShape.fine / 2 * HVCONTRAST) 0 [widths.rhs WShape.fine]
		include : dispiro
			widths.lhs WShape.fine
			flat (MIDDLE - WShape.fine / 2 * HVCONTRAST) wheight [heading DOWNWARD]
			#quadcontrols 0 0.1 6 unimportant
			curl  (WShape.m2 - WShape.fine / 2 * HVCONTRAST) 0 [widths.lhs WShape.fine]

		# bottom cap 2
		start-from (WShape.m2 + WShape.fine / 2 * HVCONTRAST) 0
		line-to (WShape.m2 - WShape.fine / 2 * HVCONTRAST) 0
		line-to WShape.m2 WShape.fine

		include : dispiro
			widths.rhs
			flat RIGHTSB top [heading DOWNWARD]
			curl RIGHTSB (top * 0.75) [heading DOWNWARD]
			quadcontrols 0 0.3 6 unimportant
			g4   (WShape.m2 + WShape.fine / 2 * HVCONTRAST) 0 [widths.rhs (WShape.fine * 0.8)]
		include : AIVSerifs top
	set WShape.fine : adviceBlackness 6
	set WShape.m1 : WIDTH * 0.325
	set WShape.m2 : WIDTH * 0.675

	sketch # W
		set-width WIDTH
		include markset.capital
		include : WShape CAP
		save 'W' 'W'
		save 'cyrWe' 0x51C

	sketch # w
		set-width WIDTH
		include markset.e
		include : WShape XH
		save 'w' 'w'
		save 'cyrwe' 0x51D

	turned nothing 0x28D 'w' MIDDLE (XH / 2)

	define [WHooktopShape top] : glyph-construction
		include : WShape top
		this.contours.pop
		if SLAB : begin
			local s : this.contours.pop
			this.contours.pop
			this.contours.push s

		include : dispiro
			widths.rhs
			straight.down.start RIGHTSB (top - HOOK) [heading DOWNWARD]
			quadcontrols 0 0.3 6 unimportant g2
			g4   (WShape.m2 + WShape.fine / 2 * HVCONTRAST) 0 [widths.rhs (WShape.fine * 0.8)]
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) (top - HOOK) (HOOKX * 0.65) (-HOOK + HALFSTROKE)

	sketch # Whooktop
		include markset.capital

		include : WHooktopShape CAP
		save 'Whooktop' 0x2C72

	sketch # whooktop
		include markset.e

		include : WHooktopShape XH

		save 'whooktop' 0x2C73

	sketch # ww
		include : WShape (CAP / 2)
		apply-transform : Upright
		apply-transform : Translate 0 (CAP / 2)
		apply-transform : Italify
		include : WShape (CAP / 2)
		save 'ww' 0x2AC

	### X and x
	sketch # X
		set-width WIDTH
		include markset.capital

		include : xStrand SB 0 RIGHTSB CAP 0.1 0.4 0.28
		include : xStrand SB CAP RIGHTSB 0 0.1 0.4 0.28
		include : AIHSerifs CAP
		save 'X' 'X'
		save 'Chi' 0x3A7
		save 'cyrHa' 0x425

	sketch # x
		include markset.e
		local TURN (XH * 0.1)

		include : xStrand SB 0 RIGHTSB XH 0.02 0.4 0.14
		include : xStrand SB XH RIGHTSB 0 0.02 0.4 0.14
		include : AIHSerifs XH
		save 'x' 'x'
		save 'cyrha' 0x445

	sketch # chi
		set-width WIDTH
		include markset.p

		include : xStrand SB DESCENDER RIGHTSB XH 0.05 0.4 0.11
		include : xStrand SB XH RIGHTSB DESCENDER 0.05 0.4 0.11
		save 'chi' 0x3C7
		save 'latinchi' 0xAB53

	composite 'cyrHadescender' glyphs.cyrHa [CyrDescender RIGHTSB] [into-unicode 0x4B2]
	composite 'cyrhadescender' glyphs.cyrha [CyrDescender RIGHTSB] [into-unicode 0x4B3]

	### Y
	define [YShape top bot] : glyph-construction
		local cross : mix [fallback bot 0] top 0.4
		include : halfXStrand SB top MIDDLE cross 0.1 0.4 0.28
		include : halfXStrand RIGHTSB top MIDDLE cross 0.1 0.4 0.28
		tag-contour 'strokeRT'
		include : VBar MIDDLE [fallback bot 0] (cross + HALFSTROKE)
		set-anchor 'overlay' BASE MIDDLE cross
		if SLAB : begin
			include : AIVSerifs top
			include : CenterBottomSerif MIDDLE [fallback bot 0] JUT

	sketch # Y
		set-width WIDTH
		include markset.capital
		include : YShape CAP
		save 'Y' 'Y'
		save 'Upsilon' 0x3A5
		save 'cyrUe' 0x4AE

	sketch # Yhooktop
		include glyphs.Y AS_BASE
		eject-contour 'strokeRT'
		eject-contour 'serifRT'
		local cross (CAP * 0.4)
		include : dispiro
			widths.rhs
			straight.left.start (RIGHTSB + HOOKX / 3) (CAP - STROKE)
			g4 (RIGHTSB - HOOKX / 3) (CAP - HOOK)
			quadcontrols 0.55 0.7 32 unimportant
			g4 (MIDDLE + STROKE / 2 * HVCONTRAST) cross
			end [function : set this.loose true]

		save 'Yhooktop' 0x1B3

	sketch # cyrue
		include markset.p
		include : YShape XH DESCENDER

		save 'cyrue' 0x4AF

	sketch # smcpY
		include markset.e
		include : YShape XH
		save 'smcpY' 0x28F

	### y
	local px1 0.84
	local py1 : linreg 18 0.8 126 0.76 STROKE
	local px2 0.95
	local py20 0.88
	local py2 : if SLAB [linreg 18 0.97 126 0.85 STROKE] py20
	local pds 0.05
	local pds2 0.01
	local dpy1 : (1 - [linreg (1 - px2) (1 - py2) px1 py1 1]) / (1 - py1)
	local dpy20 : (1 - [linreg (1 - px1) (1 - py1) px2 py20 1]) / (1 - py20)
	local dpy2 : (1 - [linreg (1 - px1) (1 - py1) px2 py2 1]) / (1 - py2)
	local yrstrokel0 : MIDDLE - WIDTH * 0.1
	local yrstrokel : MIDDLE - WIDTH * [if SLAB 0.15 0.1] + [if SLAB HALFSTROKE 0]
	local yrstroker : RIGHTSB - HALFSTROKE * HVCONTRAST
	local yshrink : linreg 18 1 126 0.85 STROKE
	local slabysize : JUT * [linreg 18 0.85 126 1 STROKE]
	local slabyvx : linreg 18 0.7 126 0.5 STROKE
	define [yBaseKnots top bottom] : begin
		local ds : (top - bottom) * pds
		local ds2 : (top - bottom) * pds2 + [if SLAB (slabysize * slabyvx) 0]
		return : list
			flat [mix yrstrokel yrstroker px1] [mix (bottom + ds2) (top - ds) py1]
			curl [mix yrstrokel yrstroker (1 - px2)] [mix (bottom + ds2) (top - ds) (1 - py2)] [widths.center : STROKE * [if SLAB yshrink 1]]
			if SLAB : then : list
				flat (yrstrokel - slabysize) (bottom + HALFSTROKE) [widths.center]
				curl [Math.min (yrstrokel - slabysize - 0.1) (yrstrokel - HALFSTROKE - JUT)] (bottom + HALFSTROKE)
			: else : list
				quadcontrols 1 (1 - dpy2) 16
				flat yrstrokel (bottom + ds2) [heading DOWNWARD]
				curl yrstrokel bottom [heading DOWNWARD]

	define [SmallYShape top bottom] : glyph-construction
		local ds : (top - bottom) * pds
		local ds2 : (top - bottom) * pds2 + [if SLAB (slabysize * slabyvx) 0]
		include : tagged 'strokeR' : dispiro
			widths.center
			flat yrstroker top [heading DOWNWARD]
			curl yrstroker (top - ds) [heading DOWNWARD]
			quadcontrols 0 dpy1 16
			yBaseKnots top bottom
			end [function : set this.cleanmore true]
		include : dispiro
			widths.center
			flat (WIDTH - yrstroker) top [heading DOWNWARD]
			curl (WIDTH - yrstroker) (top - ds) [heading DOWNWARD]
			quadcontrols 0 dpy1 16
			flat [mix (WIDTH - yrstrokel) (WIDTH - yrstroker) px1] [mix (bottom + ds2) (top - ds) py1]
			curl MIDDLE [mix (bottom + ds2) (top - ds) [linreg (1 - px2) (1 - py2) px1 py1 ((MIDDLE - yrstrokel) / (yrstroker - yrstrokel))]] [widths.center (STROKE * yshrink)]
			end [function : set this.cleanmore true]
		if SLAB : begin
			include : AIVSerifs top

	sketch # y.upright
		include markset.p
		include : SmallYShape XH DESCENDER
		save 'y.upright'


	sketch # y.italic
		if SLAB
		: then
			include markset.p
			include : nShoulder
				left -- (SB + STROKE * HVCONTRAST)
				right -- RIGHTSB
				fine -- SHOULDERFINE
			include : FlipAround MIDDLE (XH / 2)
			include : dispiro
				widths.rhs
				flat RIGHTSB XH [heading DOWNWARD]
				curl RIGHTSB (DESCENDER + SMALLSMOOTHA)
				hookend (DESCENDER + O)
				g4 SB (DESCENDER + SHOOK)
			if SLAB : begin
				include : LeftwardTopSerif SB XH SIDEJUT
		: else
			include glyphs.'y.upright' AS_BASE
		save 'y.italic'

	italic-variant 'y' 'y'
	alias 'cyru' 0x443 'y'

	turned nothing 0x28E 'y.upright' MIDDLE (XH / 2) markset.b

	sketch # yhooktop
		include glyphs.'y.upright' AS_BASE
		eject-contour 'strokeR'
		eject-contour 'serifRT'

		include : tagged 'strokeR' : dispiro
			widths.center
			straight.left.start ([mix yrstrokel yrstroker px1] + HOOKX) (XH - HALFSTROKE)
			yBaseKnots XH DESCENDER
			end [function : set this.cleanmore true]

		save 'yhooktop' 0x1B4

	sketch # cyrU
		include markset.capital
		include : SmallYShape CAP 0

		save 'cyrU' 0x423

	sketch # lambda
		include markset.b
		local top CAP
		local bottom 0
		local ds : (top - bottom) * pds
		local ds2 : (top - bottom) * pds2
		include : tagged 'strokeR' : dispiro
			widths.center
			flat yrstroker bottom [heading UPWARD]
			curl yrstroker (bottom + ds) [heading UPWARD]
			quadcontrols 0 dpy1 16
			flat [mix yrstroker yrstrokel0 (1 - px1)] [mix (top - ds2) (bottom + ds) py1]
			curl [mix yrstroker yrstrokel0 px2] [mix (top - ds2) (bottom + ds) (1 - py20)]
			quadcontrols 1 (1 - dpy20) 16
			flat yrstrokel0 (top - ds2) [heading UPWARD]
			curl yrstrokel0 top [heading UPWARD]
			end [function : set this.cleanmore true]

		include : dispiro
			widths.center
			flat (WIDTH - yrstroker) bottom [heading UPWARD]
			curl (WIDTH - yrstroker) (bottom + ds) [heading UPWARD]
			quadcontrols 0 dpy1 16
			flat [mix (WIDTH - yrstrokel0) (WIDTH - yrstroker) px1] [mix (top - ds2) (bottom + ds) py1]
			curl MIDDLE [mix (top - ds2) (bottom + ds) [linreg (1 - px2) (1 - py20) px1 py1 ((MIDDLE - yrstrokel0) / (yrstroker - yrstrokel0))]]
			end [function : set this.cleanmore true]

		save 'lambda' 0x3BB

	sketch # lambdaslash
		include glyphs.lambda AS_BASE
		include : FlatSlashShape ([tp [Upright] glyphs.l.anchors.above].x) [mix 0 CAP 0.7] (OVERLAYSTROKE / 2)
		save 'lambdaslash' 0x19B

	### K and k
	define [KShape top] : glyph-construction
		local turn (top * 0.99)

		local attach (top * [if SLAB 0.325 0.375])
		local attach2 [if SLAB [mix SB RIGHTSB 0.48] MIDDLE]

		local fine : adviceBlackness 3.5
		include : dispiro
			g4.down.start (RIGHTSB) top [widths.heading 0 (STROKE * [if SLAB 1.15 1.05] * (WIDTH * 2 / UPM)) DOWNWARD]
			bezcontrols 0 [if SLAB 0.1 0.2] 0.5 [if SLAB 0.55 0.65] 8
			g4 (SB + STROKE) attach [widths 0 fine]
		include : dispiro
			widths.center
			g4.up.start (RIGHTSB - O - HALFSTROKE * HVCONTRAST) 0 [heading UPWARD]
			quadcontrols 0 [if SLAB 0.125 0.25] 8
			g4 attach2 (top * 0.61) [widths.center fine]
		if SLAB : begin
			include : RightwardTopSerif (RIGHTSB - (STROKE * [if SLAB 1.15 1.05] * (WIDTH * 2 / UPM) / 2 - HALFSTROKE) * HVCONTRAST * [if para.isItalic 1 0] - HALFSTROKE * 0.5 * HVCONTRAST) top (SIDEJUT + HALFSTROKE * 0.5 * HVCONTRAST)
			include : RightwardBottomSerif (RIGHTSB - O * [if para.isItalic 1 0]) 0 SIDEJUT

	sketch # K
		set-width WIDTH
		include markset.capital
		include : VBarLeft SB 0 CAP
		include : KShape CAP
		if SLAB : begin
			include : CenterTopSerif (SB + HALFSTROKE * HVCONTRAST) CAP JUT
			include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
		save 'K' 'K'
		save 'Kappa' 0x39A
		save 'cyrKa' 0x41A

	composite glyphs.cyrKa [CyrDescender (RIGHTSB - O)] [into-unicode 0x49A]

	sketch # k
		set-width WIDTH
		include markset.b
		include : VBarLeft SB 0 CAP
		include : KShape XH
		if SLAB : begin
			include : LeftwardTopSerif SB CAP SIDEJUT
			if (!para.isItalic) : begin
				include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
				tag-contour 'serifLB'

		save 'k' 'k'

	sketch # kappa
		set-width WIDTH
		include markset.e
		include : VBarLeft SB 0 XH
		include : KShape XH
		if SLAB : begin
			include : LeftwardTopSerif SB XH SIDEJUT

		save 'kappa' 0x3BA

	sketch # cyrka
		set-width WIDTH
		include markset.e
		include : VBarLeft SB 0 XH
		include : KShape XH
		if SLAB : begin
			include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
			include : CenterTopSerif (SB + HALFSTROKE * HVCONTRAST) XH JUT
		save 'cyrka' 0x43A
		save 'latinkappa' 0x138
	composite glyphs.cyrka [CyrDescender (RIGHTSB - O)] [into-unicode 0x49B]


	sketch # Khooktop
		include markset.capital
		include : KShape CAP
		include : VBarLeft SB 0 (CAP - HOOK - HALFSTROKE)
		include : VerticalHook (SB + HALFSTROKE * HVCONTRAST) (CAP - HOOK - HALFSTROKE) HOOKX (-HOOK)

		save 'Khooktop' 0x198

	sketch # khooktop
		include markset.b
		include : KShape XH
		include : VBarLeft SB 0 (CAP - HOOK - HALFSTROKE)
		include : VerticalHook (SB + HALFSTROKE * HVCONTRAST) (CAP - HOOK - HALFSTROKE) HOOKX (-HOOK)

		save 'khooktop' 0x199
	turned nothing 0xA7B0 'K' MIDDLE (CAP / 2)
	turned nothing 0x29E 'k' MIDDLE (XH / 2) markset.p


	### B
	define [BShape top] : glyph-construction
		local bowl : top * 0.52 + HALFSTROKE
		local barleft SB
		local curvleft : RIGHTSB - SB * 0.5 - (top - (bowl - STROKE)) * 0.45
		local curvleftTop : Math.min curvleft (RIGHTSB - SB * 0.5 - OX - STROKE * 1.375)
		local fine : STROKE * CTHIN

		include : dispiro
			widths.rhs
			flat (barleft - O) top [heading RIGHTWARD]
			curl (curvleftTop - CORRECTION_OMIDS) top
			archv
			g4 (RIGHTSB - SB * 0.5 - OX) [mix top (bowl - STROKE) (SMOOTHB / (SMOOTHA + SMOOTHB))]
			arcvh
			flat (curvleftTop + CORRECTION_OMIDS) (bowl - fine) [widths.rhs fine]
			curl (barleft - O) (bowl - fine) [heading LEFTWARD]
		include : dispiro
			widths.rhs fine
			flat (barleft - O) (bowl - STROKE + fine) [heading RIGHTWARD]
			curl (curvleft - CORRECTION_OMIDS) (bowl - STROKE + fine)
			archv
			g4 (RIGHTSB - OX) [mix bowl 0 (SMOOTHB / (SMOOTHA + SMOOTHB))] [widths.rhs STROKE]
			arcvh
			flat (curvleft + CORRECTION_OMIDS) 0
			curl (barleft - O) 0 [heading LEFTWARD]
		include : VBarLeft barleft 0 top
		if SLAB : begin
			include : LeftwardTopSerif barleft top SIDEJUT
			tag-contour 'serifLT'
			include : LeftwardBottomSerif barleft 0 SIDEJUT
			tag-contour 'serifLB'

	sketch # B
		set-width WIDTH
		include markset.capital
		include : BShape CAP
		save 'B' 'B'
		save 'Beta' 0x392
		save 'cyrVe' 0x412

	sketch # Bhookleft
		include glyphs.B AS_BASE
		eject-contour "serifLT"
		include : LeftHook SB CAP

		save 'Bhookleft' 0x181

	define [ItalicCyrveShape top] : glyph-construction
		local mid : mix RIGHTSB SB 0.65
		local midy : top * BARPOS
		local smb : top - [mix (midy + HALFSTROKE) (top - O - STROKE) (SMOOTHA / (SMOOTHA + SMOOTHB))] + TANSLANT * HVCONTRAST * STROKE
		local sma : [mix (STROKE + O) (midy - HALFSTROKE) (SMOOTHA / (SMOOTHA + SMOOTHB))] - TANSLANT * HVCONTRAST * STROKE
		include : dispiro
			widths.lhs
			flat mid (midy - HALFSTROKE) [heading RIGHTWARD]
			curl MIDDLE (midy - HALFSTROKE)
			archv
			g4   (RIGHTSB + O) (top - smb)
			arcvh
			g4   (MIDDLE - CORRECTION_OMIDS) (top - O)
			archv
			flat.ai (SB + O) (top - SMALLSMOOTHA)
			curl.ai (SB + O) SMALLSMOOTHB
			arcvh
			g4   (MIDDLE + CORRECTION_OMIDS) O
			archv
			g4   (RIGHTSB - O) (sma)
			arcvh
			flat MIDDLE (midy + HALFSTROKE)
			curl mid (midy + HALFSTROKE) [heading LEFTWARD]
	sketch # cyrve.italic
		include markset.e
		include : ItalicCyrveShape XH
		save 'cyrve.italic'
		save 'closeturnepsilon' 0x25E
	sketch # cyrve.BGR
		include markset.e
		include : ItalicCyrveShape CAP
		save 'cyrve.BGR'
	sketch # cyrve.upright
		include markset.e
		include : BShape XH
		save 'cyrve.upright'
		save 'smcpB' 0x299
	italic-variant 'cyrve' 0x432

	sketch # Bbar

		include glyphs.B AS_BASE
		include : HOverlayBar [mix SB 0 0.7] [mix SB RIGHTSB 0.5] [mix 0 CAP 0.3] [Math.min ((CAP - STROKE * 3) / 4) OVERLAYSTROKE]
		save 'Bbar' 0x243

	sketch # beta
		include markset.if
		local ymiddle : [mix 0 CAP 0.55] - HALFSTROKE
		local fine : STROKE * CTHIN
		include : dispiro
			widths.rhs
			flat SB DESCENDER [heading UPWARD]
			curl SB (CAP - SMALLSMOOTHA)
			arcvh
			g4   ([mix SB (RIGHTSB - OX + O * 3) 0.5] - CORRECTION_OMIDS) CAPO
			archv
			g4   (RIGHTSB - OX + O * 3) [mix CAP ymiddle 0.5]
			arcvh
			flat [mix SB (RIGHTSB - OX + O * 3) 0.5] (ymiddle + STROKE - fine) [widths.rhs fine]
			curl [mix SB RIGHTSB 0.3] (ymiddle + STROKE - fine)
		include : dispiro
			widths.rhs fine
			flat   ([mix SB RIGHTSB 0.3] - (2 * fine - STROKE) * TANSLANT) (ymiddle + fine)
			curl   (RIGHTSB - ymiddle / 2 - HALFSTROKE) (ymiddle + fine)
			archv
			g4   (RIGHTSB - OX) [mix 0 (ymiddle + STROKE) 0.5] [widths.rhs]
			arcvh
			flat (RIGHTSB - ymiddle / 2 - HALFSTROKE) 0
			curl (SB + HALFSTROKE) 0 [heading LEFTWARD]
		save 'beta' 0x3B2

	### b
	sketch # b
		set-width WIDTH
		include markset.b

		include : OBarLeftShape
		include : VBarLeft SB 0 CAP
		if SLAB : begin
			include : LeftwardTopSerif SB CAP SIDEJUT
			tag-contour 'serifLT'
			include : LeftwardBottomSerif SB 0 SIDEJUT
			tag-contour 'serifLB'

		save 'b' 'b'

	sketch # bhooktop
		include markset.b
		include : OBarLeftShape
		include : HooktopLeftBar
		if SLAB : begin
			include : LeftwardBottomSerif SB 0 SIDEJUT
			tag-contour 'serifLB'


		save 'bhooktop' 0x253

	sketch # bbar

		include glyphs.b AS_BASE
		include : HOverlayBar [mix SB 0 0.7] [mix SB RIGHTSB 0.5] [mix XH CAP 0.45]

		save 'bbar' 0x180

	sketch # bdot
		include glyphs.dotAbove
		apply-transform : Translate (WIDTH + HALFSTROKE) 0
		include glyphs.b AS_BASE
		save 'bdot' 0x1E03

	sketch # latinbe
		include glyphs.b AS_BASE
		include : HBarTop (SB - O) [mix SB RIGHTSB 0.9] CAP
		if SLAB : begin
			include : DownwardRightSerif [mix SB RIGHTSB 0.9] CAP VJUT
		save 'latinbe' 0x183

	sketch # zhuangtonesix
		include glyphs.b AS_BASE
		eject-contour 'serifLT'
		local s : Math.max (XH * 0.1) STROKE
		start-from (SB - O) CAP
		line-to    SB CAP
		line-to    (SB - s) (CAP - s)
		line-to    SB (CAP - s * 2)
		line-to    (SB - O) (CAP - s * 2)
		reverse-last
		save 'zhuangtonesix' 0x185
	### D
	sketch # D
		set-width WIDTH
		include markset.capital

		local dsmooth : Math.min (CAP * 0.499) (SMOOTH * 1.35)
		local bsmooth : Math.min ((WIDTH - SB * 2) * 0.75) (SMOOTH * 1.1)

		local barleft SB

		include : VBarLeft barleft 0 CAP

		include : dispiro
			widths.rhs
			flat (barleft - O) CAP [heading RIGHTWARD]
			curl (RIGHTSB - bsmooth) CAP
			archv
			flat (RIGHTSB - OX) (CAP - dsmooth - (SMOOTHB - SMOOTH))
			curl (RIGHTSB - OX) (dsmooth + (SMOOTHA - SMOOTH))
			arcvh
			flat (RIGHTSB - bsmooth) 0
			curl (barleft - O) 0 [heading LEFTWARD]
		if SLAB : begin
			include : LeftwardTopSerif barleft CAP SIDEJUT
			tag-contour 'serifLT'
			include : LeftwardBottomSerif barleft 0 SIDEJUT
			tag-contour 'serifLB'
		save 'D' 'D'

	sketch # arficanD
		include glyphs.D AS_BASE
		include : HOverlayBar (SB * 0.3) [mix (SB + STROKE) (RIGHTSB - STROKE) 0.55] (CAP * OVERLAYPOS)
		save 'Eth' 0xD0
		save 'Dcroat' 0x110
		save 'arficanD' 0x189

	sketch # Dhookleft
		include glyphs.D AS_BASE
		eject-contour "serifLT"
		include : LeftHook SB CAP
		save 'Dhookleft' 0x18A

	### d
	sketch # d
		set-width WIDTH
		include markset.b

		include : OBarRightShape
		include : VBarRight RIGHTSB 0 CAP
		if SLAB : begin
			include : RightwardBottomSerif RIGHTSB 0 SIDEJUT
			tag-contour 'serifRB'
			include : LeftwardTopSerif (RIGHTSB - STROKE * HVCONTRAST) CAP SIDEJUT

		save 'd' 'd'

	sketch # dcroat
		include glyphs.d AS_BASE
		include : HBar [mix (SB + STROKE) (RIGHTSB - STROKE) 0.5] [mix RIGHTSB WIDTH 0.7] [mix XH CAP 0.45] OVERLAYSTROKE

		save 'dcroat' 0x111

	sketch # dcaron
		include glyphs.commaAbove
		apply-transform : Translate (WIDTH + (RIGHTSB - SB) / 2 + markExtend / 2) 0
		local f : Widen {'d'} 0.95 1
		include f.d
		include markset.b

		save 'dcaron' 0x10F

	sketch # dcurlytail
		local fine : adviceBlackness 4
		local rinner : clamp (WIDTH * 0.065) (XH * 0.05) (fine * 0.35)
		local wide STROKE
		local m1 : Math.min RIGHTSB (WIDTH - rinner * 2 - fine - OX)
		local x2 : mix SB m1 0.5
		local y2 : 0 - fine - rinner *  1.25
		include markset.e
		include : OBarRightShape XH m1
		include : dispiro
			widths.rhs
			flat m1 CAP [heading DOWNWARD]
			curl m1 (rinner * 2 + fine)
			CurlyTail fine rinner m1 0 (m1 + rinner * 2 + fine) x2 y2
		if SLAB : begin
			include : LeftwardTopSerif (m1 - STROKE * HVCONTRAST) CAP SIDEJUT

		save 'dcurlytail' 0x221

	sketch # dhooktop
		include markset.b
		include : OBarRightShape
		include : VBarRight RIGHTSB 0 XH
		include : RightwardBottomSerif RIGHTSB 0 SIDEJUT
		tag-contour 'serifRB'
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) XH HOOKX (-HOOK)

		save 'dhooktop' 0x257

	sketch # ddot
		include glyphs.dotAbove
		apply-transform : Translate (WIDTH - HALFSTROKE) 0
		include glyphs.d AS_BASE
		save 'ddot' 0x1E0B

	sketch # latinde
		include glyphs.d AS_BASE
		include : HBarTop [mix RIGHTSB SB 0.9] (RIGHTSB + O) CAP
		if SLAB : begin
			include : DownwardLeftSerif [mix RIGHTSB SB 0.9] CAP VJUT
		save 'latinde' 0x18C

	### P
	define [PShape top _mul bp] : glyph-construction
		local mul : fallback _mul 1.25
		local bowlTop (top * 1)
		local bowlBottom ((top - STROKE) * [fallback bp PBARPOS] - HALFSTROKE)

		local turn : mix bowlTop bowlBottom (SMOOTHB / (SMOOTHA + SMOOTHB))
		local turnRadius : (bowlTop - bowlBottom) * 0.45
		include : dispiro
			widths.rhs
			flat (SB * mul - O) bowlTop [heading RIGHTWARD]
			curl (RIGHTSB - turnRadius - CORRECTION_OMIDS) bowlTop
			archv
			g4 (RIGHTSB - OX) turn
			arcvh
			flat (RIGHTSB - turnRadius + CORRECTION_OMIDS) bowlBottom
			curl (SB * mul - O) bowlBottom [heading LEFTWARD]
		include : VBarLeft (SB * mul) 0 top
		tag-contour 'strokeL'
		if SLAB : begin
			include : LeftwardTopSerif (SB * mul) top SIDEJUT
			tag-contour 'serifLT'
			include : CenterBottomSerif (SB * mul + HALFSTROKE * HVCONTRAST) 0 JUT

	sketch # P
		set-width WIDTH
		include markset.capital
		include : PShape CAP
		save 'P' 'P'
		save 'Rho' 0x3A1
		save 'cyrEr' 0x420

	sketch # Phookleft
		include glyphs.P AS_BASE
		eject-contour "serifLT"
		include : LeftHook (SB * 1.25) CAP

		save 'Phookleft' 0x1A4
	list PShape

	### p
	sketch # p
		set-width WIDTH
		include markset.p

		include : tagged 'bowl' : OBarLeftShape
		include : VBarLeft SB DESCENDER XH
		if SLAB : begin
			include : LeftwardTopSerif SB XH SIDEJUT
			tag-contour 'serifLT'
			include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) DESCENDER JUT
			tag-contour 'serifLB'
		save 'p' 'p'
		save 'cyrer' 0x440

	sketch # phooktop
		include markset.if
		include : OBarLeftShape
		include : HooktopLeftBar nothing DESCENDER
		if SLAB : begin
			include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) DESCENDER JUT
			tag-contour 'serifLB'

		save 'phooktop' 0x1A5
	### rho
	sketch # rho
		include markset.p
		include : OShape XH 0 (SB - OX + O) RIGHTSB
		include : VBar (SB + HALFSTROKE * HVCONTRAST + O) DESCENDER SMALLSMOOTHB
		save 'rho' 0x3C1

	### R and CyrYa
	define [RShape top] : glyph-construction
		local m : if SLAB (0.5 + HALFSTROKE / CAP) PBARPOS
		include : PShape top 1 m
		local right (RIGHTSB - O - [if SLAB (JUT / 8) 0])
		include : dispiro
			widths.center
			g4.up.start (right - HALFSTROKE * HVCONTRAST) 0 [heading UPWARD]
			quadcontrols 0 [if SLAB 0.3 0.4] 8
			g4 MIDDLE ((top - STROKE) * m)
		if SLAB : begin
			include : RightwardBottomSerif (RIGHTSB - JUT / 8) 0 (SIDEJUT + JUT / 8)

	sketch # R
		set-width WIDTH
		include markset.capital
		include : RShape CAP
		set-anchor 'overlay' BASE (SB + STROKE * HVCONTRAST) (CAP * PBARPOS - HALFSTROKE)
		save 'R' 'R'
		eject-contour 'strokeL'
		save 'Rrotunda' 0xA75A

	sketch # smcpR
		include markset.e
		include : RShape XH
		save 'smcpR' 0x280
		eject-contour 'strokeL'
		save 'rrotunda' 0xA75B

	sketch # Yr
		include markset.if
		local top : CAP * 0.85
		local bp 0.45
		include : PShape top 1 bp
		include : VBarLeft SB (top - 1) CAP

		local TURN (XH * 0.1)
		local right (RIGHTSB - O)
		include : dispiro
			widths.center
			g4.up.start (right - HALFSTROKE) DESCENDER [heading UPWARD]
			quadcontrols 0 0.4 8
			g4 MIDDLE ((top - STROKE) * bp)

		save 'Yr' 0x1A6
	define [CyrYaShape top] : glyph-construction
		local bowlTop (top * 1)
		local m : if SLAB (0.5 + HALFSTROKE / CAP) PBARPOS
		local bowlBottom ((top - STROKE) * m - HALFSTROKE)
		local turn : mix bowlTop bowlBottom (SMOOTHA / (SMOOTHA + SMOOTHB))
		local turnRadius : (bowlTop - bowlBottom) * 0.45
		local barright : WIDTH - SB * 1.25
		include : dispiro
			widths.lhs
			flat (barright - HALFSTROKE * 0.1) bowlTop [heading LEFTWARD]
			curl (SB + turnRadius - CORRECTION_OMIDS) bowlTop
			archv
			g4 (SB + O) turn
			arcvh
			flat (SB + turnRadius + CORRECTION_OMIDS) bowlBottom
			curl    (barright - HALFSTROKE * 0.1) bowlBottom [heading RIGHTWARD]
		include : VBarRight barright 0 top
		local left (SB + O + [if SLAB (JUT / 8) 0])
		include : dispiro
			widths.center
			g4.up.start (left + HALFSTROKE * HVCONTRAST) 0 [heading UPWARD]
			quadcontrols 0 [if SLAB 0.3 0.4] 8
			g4 MIDDLE ((top - STROKE) * m)

		if SLAB : begin
			include : RightwardTopSerif barright top SIDEJUT
			include : CenterBottomSerif (barright - HALFSTROKE * HVCONTRAST) 0 JUT
			include : LeftwardBottomSerif (SB + JUT / 8) 0 (SIDEJUT + JUT / 8)

	sketch # cyrYa
		include markset.capital
		include : CyrYaShape CAP

		save 'cyrYa' 0x42F

	sketch # cyrya
		include markset.e
		include : CyrYaShape XH

		save 'cyrya' 0x44F
	turned 'invsmcpR' 0x281 'cyrya' MIDDLE (XH / 2)

	### r
	local rbar : SB + RBALANCE + STROKE * HVCONTRAST
	local [rBottomSerif y] : tagged 'serifLB' : CenterBottomSerif (rbar - HALFSTROKE * HVCONTRAST + RBALANCE * 0.35) y (JUT + RBALANCE * 0.65)
	local [rTopSerif y] : tagged 'serifLT' : LeftwardTopSerif (rbar - STROKE * HVCONTRAST) y (SIDEJUT + RBALANCE * 0.3)

	sketch # r
		set-width WIDTH
		include markset.e

		local fine : SHOULDERFINE * CTHIN
		local rhookx (RIGHTSB + RBALANCE2 - OXE)
		local mixp : 0.54 + 2 * TANSLANT * STROKE / WIDTH
		local mixpin : 0.65 + TANSLANT * [linreg 72 0.1 108 0.5 STROKE]
		local rmiddle : mix (rbar - fine) rhookx mixp
		local rmiddlein : [mix rbar (rhookx - STROKE * HVCONTRAST * 1.05) mixpin] - CORRECTION_OMIDS
		local skew : Math.max 0 : (rmiddle - rmiddlein) / STROKE - TANSLANT * [linreg 72 0.25 108 0.75 STROKE]
		include : dispiro
			widths.lhs
			g4 rhookx (XH - RHOOK) [heading {.y [linreg 18 (-0.45) 126 (-0.5) STROKE] .x (-1.04)}]
			alsothru (0.37 - TANSLANT * 0.1) 0.72
			g4.left.mid (rmiddle - CORRECTION_OMIDS * [linreg 72 0.75 108 1 STROKE]) XO [widths.heading STROKE 0 {.y (-1) .x (-skew)}]
			#alsothru 0.75 [linreg 18 0.25 126 0.23 STROKE]
			archv
			straight.down.end (rbar - fine * HVCONTRAST) (XH * 0.53 + (SMALLSMOOTH - SMALLSMOOTHA)) [widths.heading fine 0 DOWNWARD]
		include : VBarRight rbar 0 XH
		set-anchor 'overlay' BASE (rbar - STROKE * 0.25) (XH * 0.5)

		if SLAB : begin
			include : rBottomSerif 0
			include : rTopSerif XH
		save 'r' 'r'
	turned nothing 0x279 'r' MIDDLE (XH / 2) [compsiteMarkSet markset.e {.anchors {.bottomright {.type BASE .x RIGHTSB - RBALANCE .y 0}}}]

	sketch # rlongleg
		include markset.p
		include glyphs.r false
		eject-contour 'serifLB'
		include : VBarRight rbar DESCENDER 0
		if SLAB : include : rBottomSerif DESCENDER
		save 'rlongleg' 0x27C
	turned nothing 0x27A 'rlongleg' MIDDLE (XH / 2) [compsiteMarkSet markset.b {.anchors {.bottomright {.type BASE .x RIGHTSB - RBALANCE .y 0}}}]

	sketch # rrtail
		include markset.p
		include glyphs.r false
		eject-contour 'serifLB'
		include : create-glyph : glyph-construction
			include glyphs.rtailBR
			apply-transform : Upright
			apply-transform : Translate rbar 0
			apply-transform : Italify
		save 'rrtail' 0x27D

	sketch # turnrrtail
		include markset.p
		include glyphs.r false
		eject-contour 'serifLT'
		include : FlipAround MIDDLE (XH / 2)
		include : create-glyph : glyph-construction
			include glyphs.rtailBR
			apply-transform : Upright
			apply-transform : Translate (RIGHTSB - RBALANCE) 0
			apply-transform : Italify

		save 'turnrrtail' 0x27B

	sketch # rflap
		include markset.e
		local rhookx (RIGHTSB + RBALANCE2 - OXE)
		local rmiddle : [mix rbar (rhookx - HALFSTROKE) 0.5] - CORRECTION_OMIDS

		include : dispiro
			widths.lhs
			g4   rhookx (XH - RHOOK)
			hookstart XO
			flat (rbar - STROKE * HVCONTRAST) (XH - SMALLSMOOTHA)
			curl (rbar - STROKE * HVCONTRAST) 0 [heading DOWNWARD]
		if SLAB : include : rBottomSerif 0

		save 'rflap' 0x27E
	turned nothing 0x2C79 'rrtail' MIDDLE (XH / 2)

	### C and c, also cyre
	define [CShape top bot] : glyph-construction
		include : dispiro
			widths.lhs
			g4 RIGHTSB (top - HOOK)
			hookstart (top - O)
			flat (SB + OX) (top - SMOOTHA)
			curl (SB + OX) (bot + SMOOTHB)
			hookend (bot + O)
			g4 RIGHTSB (bot + HOOK)

	sketch # C
		set-width WIDTH
		include markset.capital
		include : CShape CAP 0
		save 'C' 'C'
		save 'cyrEs' 0x421
		save 'lunateSigma' 0x3F9

	sketch # c
		set-width WIDTH
		include markset.e

		include : dispiro
			widths.lhs
			g4 RIGHTSB (XH - HOOK)
			hookstart XO
			flat.ai (SB + OX) (XH - SMALLSMOOTHA)
			curl.ai (SB + OX) (0 + SMALLSMOOTHB)
			hookend O
			g4 RIGHTSB HOOK
		save 'c' 'c'
		save 'cyres' 0x441
		save 'lunatesigma' 0x3F2

	turned 'turnC' 0x186 'C' MIDDLE (CAP / 2)
	turned 'turnc' 0x254 'c' MIDDLE (XH / 2)
	composite glyphs.turnc [into-unicode 0x037B]
	composite glyphs.turnC [into-unicode 0x03FD]
	composite glyphs.c     [DotAt (MIDDLE + HALFSTROKE / 4) (XH/2) DOTRADIUS] [into-unicode 0x037C]
	composite glyphs.turnc [DotAt (MIDDLE - HALFSTROKE / 4) (XH/2) DOTRADIUS] [into-unicode 0x037D]
	composite glyphs.C     [DotAt (MIDDLE + HALFSTROKE / 4) (CAP/2) DOTRADIUS] [into-unicode 0x03FE]
	composite glyphs.turnC [DotAt (MIDDLE - HALFSTROKE / 4) (CAP/2) DOTRADIUS] [into-unicode 0x03FF]

	sketch # strenchedC
		set-width WIDTH
		include markset.p
		include : CShape XH DESCENDER

		save 'strenchedC' 0x297

	sketch # Chooktop
		include glyphs.C AS_BASE
		include : VBarRight (RIGHTSB - OXHOOK) (CAP - HOOK) CAP
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST - OXHOOK) CAP HOOKX (-HOOK)

		save 'Chooktop' 0x187

	sketch # chooktop
		include glyphs.c AS_BASE
		include : VBarRight (RIGHTSB - OXHOOK) (XH - HOOK) XH
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST - OXHOOK) XH HOOKX (-HOOK)

		save 'chooktop' 0x188

	sketch # Cbar
		include glyphs.C AS_BASE
		include : HOverlayBar (SB * 0.3) [mix (SB + STROKE) (RIGHTSB - STROKE) 0.55] (CAP * OVERLAYPOS)

		save 'Cbar' 0xA792

	sketch # cbar
		include glyphs.c AS_BASE
		include : HOverlayBar (SB * 0.3) [mix (SB + STROKE) (RIGHTSB - STROKE) 0.55] (XH * OVERLAYPOS)

		save 'cbar' 0xA793

	sketch # ccurlytail
		include markset.e
		local fine : adviceBlackness 3
		local rinner : ((XH * 0.45) - fine * 1.5) / 2
		local m1 : SB + O + STROKE * HVCONTRAST
		local x2 : SB + HALFSTROKE * 0.6
		local y2 : -XH * 0.05
		include : dispiro
			widths.lhs
			g4 RIGHTSB (XH - HOOK)
			hookstart XH
			flat.ai (SB + OX) (XH - SMALLSMOOTHA)
			curl.ai (SB + OX) SMALLSMOOTHB
			arcvh
			CurlyTail fine rinner m1 0 RIGHTSB x2 y2 [linreg 500 (0.5) 375 (-0.25) WIDTH] nothing [linreg 500 (0) 375 (1) WIDTH]

		save 'ccurlytail' 0x255

	sketch # cyrE
		include markset.capital
		include glyphs.C
		include : FlipAround MIDDLE (CAP / 2)
		include : HBar [mix SB RIGHTSB 0.25] RIGHTSB (CAP / 2)

		save 'cyrE' 0x42D

	sketch # cyre
		include markset.e
		include glyphs.c
		include : FlipAround MIDDLE (XH / 2)
		include : HBar [mix SB RIGHTSB 0.25] RIGHTSB (XH / 2)

		save 'cyre' 0x44D

	sketch # cyrYe
		include markset.capital
		include glyphs.C
		include : HBar SB [mix RIGHTSB SB 0.25] (CAP / 2)

		save 'cyrYe' 0x404

	sketch # cyrye
		include markset.e
		include glyphs.c
		include : HBar SB [mix RIGHTSB SB 0.25] (XH / 2)

		save 'cyrye' 0x454

	sketch # sigma
		include markset.e
		start-from (RIGHTSB + 0.25 * SB) XH
		line-to    (RIGHTSB + 0.25 * SB) (XH - STROKE)
		line-to    MIDDLE  (XH - STROKE - O * 1.5)
		line-to    MIDDLE  (XH - O)
		include : dispiro
			widths.lhs
			flat (MIDDLE + 1) (XH - O)
			curl MIDDLE (XH - O)
			archv
			flat.ai (SB + OX) (XH - SMALLSMOOTHA)
			curl.ai (SB + OX) SMALLSMOOTHB
			arcvh
			g4   (MIDDLE + CORRECTION_OMIDS) O
			archv
			flat.ai (RIGHTSB - OX * 0.5) SMALLSMOOTHA
			curl.ai (RIGHTSB - OX * 0.5) (XH - SMALLSMOOTHB)
			arcvh
			flat MIDDLE (XH - HALFSTROKE - O) [widths HALFSTROKE 0]
			curl (MIDDLE - 1) (XH - HALFSTROKE - O)
		save 'sigma' 0x3C3

	sketch # sigmafinal
		include markset.p
		include : dispiro
			widths.lhs
			g4 RIGHTSB (XH - HOOK)
			hookstart XH
			flat.ai (SB + OX) (XH - SMALLSMOOTHA)
			curl.ai (SB + OX) SMALLSMOOTHB
			arcvh
			g4 (MIDDLE + CORRECTION_OMIDS) 0
			alsothru 0.5 0.1353
			g4.down.mid (RIGHTSB - STROKE * HVCONTRAST + OX) [mix DESCENDER STROKE [linreg 18 0.5 126 0.49 STROKE]] [heading DOWNWARD]
			arcvh
			flat (RIGHTSB - HOOKX + OX) (DESCENDER + STROKE) [heading LEFTWARD]
			curl [Math.min (RIGHTSB - STROKE * HVCONTRAST * 1.5) (RIGHTSB - HOOKX + OX - 1)] (DESCENDER + STROKE) [heading LEFTWARD]
		save 'sigmafinal' 0x3C2
	list CShape

	### G
	define [GShape top sma smb] : glyph-construction
		local ybar : top * 0.52 + STROKE * 0.25
		include : dispiro
			widths.lhs
			g4   RIGHTSB (top - HOOK)
			hookstart (top - O)
			flat (SB + OX) (top - sma)
			curl (SB + OX) smb
			arcvh
			g4   (MIDDLE + CORRECTION_OMIDS) O
			archv
			flat RIGHTSB sma
			curl RIGHTSB ybar [heading UPWARD]
		include : dispiro
			flat MIDDLE ybar [widths 0 STROKE]
			curl RIGHTSB ybar [heading RIGHTWARD]

	sketch # G
		set-width WIDTH
		include markset.capital

		include : GShape CAP SMOOTHA SMOOTHB

		save 'G' 'G'

	sketch # smcpG
		include markset.e
		include : GShape XH SMOOTHA SMOOTHB

		save 'smcpG' 0x262

	sketch # Ghooktop
		include glyphs.G AS_BASE
		include : VBarRight (RIGHTSB - OXHOOK) (CAP - HOOK) CAP
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST - OXHOOK) CAP HOOKX (-HOOK) nothing O

		save 'Ghooktop' 0x193

	sketch # smcpGhooktop
		include glyphs.smcpG AS_BASE
		include : VBarRight (RIGHTSB - OXHOOK) (XH - HOOK) XH
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST - OXHOOK) XH HOOKX (-HOOK) nothing O

		save 'smcpGhooktop' 0x29B

	sketch # Gbar
		include glyphs.G AS_BASE
		include : HOverlayBar [mix SB RIGHTSB 0.5] [mix RIGHTSB WIDTH 0.7] [mix 0 CAPMIDDLE 0.55]
		save 'Gbar' 0x1E4

	### g
	sketch # g.doublestorey
		include markset.p
		local obot : XH * GBARPOS - O - HALFSTROKE
		include : OShape XH obot SB (RIGHTSB - 0.3 * SB)

		local gleftx  ([mix 0 SB 0.85] + OX)
		local grightx ([mix WIDTH RIGHTSB 0.825] - OX)
		local groundy : Math.round : [mix DESCENDER (XH * GBARPOS) 0.64] + HALFSTROKE
		local gtipy : [mix groundy (obot + STROKE + O) 1.005] - STROKE * CTHIN
		include : dispiro
			g4.left.start [mix SB RIGHTSB 0.4] gtipy [widths 0 (STROKE * CTHIN)]
			g4 ([mix SB RIGHTSB 0.0575] + STROKE * 0.85) [mix groundy gtipy 0.5] [widths.rhs (STROKE * [mix CTHIN 1 0.5])]
			flat [mix SB RIGHTSB 0.435] groundy [widths 0 STROKE]
			curl [mix RIGHTSB SB 0.435] groundy
			archv 4
			g4 grightx [mix (DESCENDER + O) groundy (1.06 * SMALLSMOOTHA / (SMALLSMOOTHA + SMALLSMOOTHB))]
			arcvh
			g4 (MIDDLE + CORRECTION_OMIDS) (DESCENDER + O)
			archv
			g4 gleftx [mix (DESCENDER + O) groundy (1.06 * SMALLSMOOTHB / (SMALLSMOOTHA + SMALLSMOOTHB))]
			arcvh
			g4 [mix SB RIGHTSB 0.435] groundy [heading RIGHTWARD]
		local gm : mix SB (RIGHTSB - 0.3 * SB) 0.5
		start-from (RIGHTSB + 0.25 * SB - OX) XH
		line-to    (RIGHTSB + 0.25 * SB - OX) (XH - STROKE)
		line-to    gm  (XH - STROKE - O)
		line-to    gm  XH

		set-anchor 'overlay' BASE MIDDLE [mix (DESCENDER + O) groundy 0.5]
		save 'g.doublestorey'

	sketch # g.opendoublestorey
		include markset.p
		local obot : XH * GBARPOS - O - HALFSTROKE
		include : OShape XH obot SB (RIGHTSB - 0.3 * SB)

		local gleftx  ([mix 0 SB 0.85] + OX)
		local grightx ([mix WIDTH RIGHTSB 0.825] - OX)
		local groundy : Math.round : [mix DESCENDER (XH * GBARPOS) 0.64] + HALFSTROKE
		local gtipy : [mix groundy (obot + STROKE + O) 1.005] - STROKE * CTHIN
		include : dispiro
			g4.left.start [mix SB RIGHTSB 0.4] gtipy [widths 0 (STROKE * CTHIN)]
			g4 ([mix SB RIGHTSB 0.0575] + STROKE * 0.85) [mix groundy gtipy 0.5] [widths.rhs (STROKE * [mix CTHIN 1 0.5])]
			flat [mix SB RIGHTSB 0.435] groundy [widths 0 STROKE]
			curl [mix RIGHTSB SB 0.435] groundy
			archv 4
			g4 grightx [mix (DESCENDER + O) groundy (1.06 * SMALLSMOOTHA / (SMALLSMOOTHA + SMALLSMOOTHB))]
			hookend (DESCENDER + O)
			g4 gleftx [mix (DESCENDER + O) groundy (1.06 * SMALLSMOOTHB / (SMALLSMOOTHA + SMALLSMOOTHB))]
		local gm : mix SB (RIGHTSB - 0.3 * SB) 0.5
		start-from (RIGHTSB + 0.25 * SB - OX) XH
		line-to    (RIGHTSB + 0.25 * SB - OX) (XH - STROKE)
		line-to    gm  (XH - STROKE - O)
		line-to    gm  XH

		set-anchor 'overlay' BASE MIDDLE [mix (DESCENDER + O) groundy 0.5]
		save 'g.opendoublestorey'

	sketch # g.singlestorey
		include markset.p
		include : OBarRightShape
		include : dispiro
			widths.rhs
			flat RIGHTSB XH [heading DOWNWARD]
			curl RIGHTSB (DESCENDER + SMALLSMOOTHA)
			hookend (DESCENDER + O)
			g4 SB (DESCENDER + SHOOK)
		if SLAB : begin
			include : RightwardTopSerif RIGHTSB XH SIDEJUT
			tag-contour 'serifRT'

		save 'g.singlestorey'
		save 'scriptg' 0x261
		save 'cyrde.serbian'

	select-variant 'g' 'g' 'doublestorey' {
		.cv11 'g.doublestorey'
		.cv12 'g.singlestorey'
		.cv24 'g.opendoublestorey'
	}

	turned nothing 0x1D77 'g' MIDDLE [mix DESCENDER XH 0.5]

	sketch # scriptghooktop
		include glyphs.scriptg AS_BASE
		eject-contour 'serifRT'
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) XH HOOKX (-HOOK) nothing O

		save 'scriptghooktop' 0x260

	sketch # gbar
		include glyphs.g AS_BASE
		include : HBar [mix 0 SB 0.3] [mix WIDTH RIGHTSB 0.3] glyphs.g.anchors.overlay.y [Math.min [adviceBlackness 5] (0.5 / 3 * (CAP - STROKE * 4))]
		save 'gbar' 0x1E5

	### O and o

	sketch
		include markset.capital
		include : OShape CAP 0 SB RIGHTSB nothing SMOOTHA SMOOTHB

		save 'O' 'O'
		save 'Omicron' 0x39F
		save 'cyrO' 0x41E

	sketch # o
		set-width WIDTH
		include markset.e
		include : OShape XH 0 SB RIGHTSB nothing nothing nothing true
		save 'o' 'o'
		save 'omicron' 0x3BF
		save 'cyro' 0x43e

	sketch # Oslash

		local fine : 0.5 * OVERLAYSTROKE

		include glyphs.O AS_BASE
		include : dispiro
			flat (SB + O + fine) [mix CAP 0 1.05] [widths fine fine]
			curl (RIGHTSB - O - fine) [mix 0 CAP 1.05]

		save 'Oslash' 0xD8

	sketch # oslash

		local fine : 0.5 * OVERLAYSTROKE

		include glyphs.o AS_BASE
		include : dispiro
			flat (SB + O + fine) [mix XH 0 1.05] [widths fine fine]
			curl (RIGHTSB - O - fine) [mix 0 XH 1.05]

		save 'oslash' 0xF8

	sketch # Obar
		include glyphs.O AS_BASE
		include : HBar (SB + OX + 1) (RIGHTSB - OX - 1) (CAP * 0.5) OVERLAYSTROKE
		save 'Obar' 0x19F
		save 'cyrOe' 0x4E8
		save 'capSymbolTheta' 0x3F4

	sketch # obar
		include glyphs.o AS_BASE
		include : HBar (SB + OX + 1) (RIGHTSB - OX - 1) (XH * 0.5) OVERLAYSTROKE
		save 'obar' 0x275
		save 'cyroe' 0x4E9

	sketch # bulleye
		include glyphs.O AS_BASE
		local radius : Math.min DOTRADIUS ((RIGHTSB - SB - STROKE * 2) / 4)
		include : Ring (CAPMIDDLE + radius) (CAPMIDDLE - radius) (MIDDLE + radius) (MIDDLE - radius)

		save 'bulleye' 0x298

	sketch # oupperhalf
		include markset.e
		include : dispiro
			widths.rhs
			flat (SB + OX) (XH / 2) [heading UPWARD]
			curl (SB + OX) (XH - [Math.min (XH / 2 - 0.1) SMALLSMOOTHA])
			arcvh
			g4 (MIDDLE - CORRECTION_OMIDS) (XH - O)
			archv
			flat (RIGHTSB - OX) (XH - [Math.min (XH / 2 - 0.1) SMALLSMOOTHB])
			curl (RIGHTSB - OX) (XH / 2) [heading DOWNWARD]
		save 'oupperhalf' 0x1D16

	sketch # olowerhalf
		include markset.e
		include : dispiro
			widths.lhs
			flat (SB + OX) (XH / 2) [heading DOWNWARD]
			curl (SB + OX) [Math.min (XH / 2 - 0.1) SMALLSMOOTHB]
			arcvh
			g4 (MIDDLE + CORRECTION_OMIDS) O
			archv
			flat (RIGHTSB - OX) [Math.min (XH / 2 - 0.1) SMALLSMOOTHA]
			curl (RIGHTSB - OX) (XH / 2) [heading UPWARD]
		save 'olowerhalf' 0x1D17

	### Q
	sketch # Q
		set-width WIDTH

		include    glyphs.O AS_BASE
		local shift : linreg 18 0 126 0.25 STROKE
		include : dispiro
			widths.rhs
			flat (MIDDLE + WIDTH * 0.075 - STROKE * HVCONTRAST * shift) (-CAP * 0.2) [heading UPWARD]
			curl (MIDDLE - STROKE * HVCONTRAST * shift) 0
		#start-from MIDDLE 0
		#line-to    (MIDDLE + WIDTH * 0.15 - HALFSTROKE * HVCONTRAST) (-CAP * 0.2)
		#line-to    (MIDDLE + WIDTH * 0.15 + HALFSTROKE * HVCONTRAST) (-CAP * 0.2)
		#line-to    (MIDDLE + STROKE * HVCONTRAST) 0
		#line-to    (MIDDLE + STROKE * (1 - 0.5 / 3) * HVCONTRAST) (STROKE * 0.5)
		#reverse-last
		save 'Q' 'Q'
		save 'cyrQa' 0x51A

	### q
	sketch # q
		set-width WIDTH
		include markset.p

		include : OBarRightShape
		include : VBarRight RIGHTSB DESCENDER XH
		if SLAB : begin
			include : RightwardTopSerif RIGHTSB XH SIDEJUT
			tag-contour 'serifRT'
			include : CenterBottomSerif (RIGHTSB - HALFSTROKE * HVCONTRAST) DESCENDER JUT
		save 'q' 'q'
		save 'cyrqa' 0x51B

	sketch # Qrtail
		include markset.capital
		include : OBarRightShape CAP
		include : VBarRight RIGHTSB 0 CAP
		include : create-glyph : glyph-construction
			include glyphs.rtailBR
			apply-transform : Upright
			apply-transform : Translate RIGHTSB 0
			apply-transform : Italify
		if SLAB : begin
			include : RightwardTopSerif RIGHTSB CAP SIDEJUT
			tag-contour 'serifRT'

		save 'Qrtail' 0x24A

	sketch # qrtail
		include markset.e
		include : OBarRightShape
		include : VBarRight RIGHTSB 0 XH
		include : create-glyph : glyph-construction
			include glyphs.rtailBR
			apply-transform : Upright
			apply-transform : Translate RIGHTSB 0
			apply-transform : Italify
		if SLAB : begin
			include : RightwardTopSerif RIGHTSB XH SIDEJUT
			tag-contour 'serifRT'

		save 'qrtail' 0x24B

	sketch # qhooktop
		include markset.p
		include glyphs.q
		eject-contour 'serifRT'
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) XH HOOKX (-HOOK)
		save 'qhooktop' 0x2A0


	### N
	define [NShape top left right coward diagcoward xn] : glyph-construction
		local topstroke : adviceBlackness [fallback diagcoward 4]
		local stroke : adviceBlackness [fallback coward 1]
		local halftopstroke : topstroke / 2

		include : dispiro
			flat left 0 [widths.heading 0 stroke UPWARD]
			curl left (top * 0.4) [heading UPWARD]
			straight.up.end left top [widths.heading 0 topstroke UPWARD]
		include : dispiro
			flat right top [widths.heading 0 stroke DOWNWARD]
			curl right (top * 0.6) [heading DOWNWARD]
			straight.down.end right 0 [widths.heading 0 topstroke DOWNWARD]
		include : dispiro
			flat (left + halftopstroke) top [widths.heading topstroke 0 DOWNWARD]
			curl (right - halftopstroke) 0 [widths.heading 0 topstroke DOWNWARD]
		include : AINSerifs top left right stroke xn

	sketch # N
		set-width WIDTH
		include markset.capital
		include : NShape CAP SB RIGHTSB
		save 'N' 'N'
		save 'Nu' 0x39D

	sketch # smcpN
		include markset.e
		include : NShape XH SB RIGHTSB 3 3.5

		save 'smcpN' 0x274

	sketch # Nltail
		include glyphs.N AS_BASE
		eject-contour 'serifLB'
		include : VerticalHook (SB + HALFSTROKE * HVCONTRAST) 0 (-HOOKX) HOOK

		save 'Nltail' 0x19D
	list NShape

	### n
	sketch # n
		set-width WIDTH
		include markset.e

		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
			fine -- SHOULDERFINE
		include : VBarLeft SB 0 XH

		if SLAB : begin
			include : LeftwardTopSerif SB XH SIDEJUT
			tag-contour 'serifLT'
			if (para.isItalic)
			: then : include : tagged 'serifRB' : RightwardBottomSerif RIGHTSB 0 SIDEJUT
			: else : include : tagged 'serifRB' : CenterBottomSerif (RIGHTSB - HALFSTROKE * HVCONTRAST) 0 JUT
			if (!para.isItalic) : begin
				include : tagged 'serifLB' : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
		save 'n' 'n'
		save 'cyrpe.italic'

	sketch # napostrophe
		include glyphs.commaAbove
		apply-transform : Translate (WIDTH + SB - MIDDLE) 0
		include glyphs.n AS_BASE

		save 'napostrophe' 0x149

	sketch # eng
		include markset.p
		include glyphs.n false
		eject-contour 'serifRB'
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) 0 (-HOOKX) HOOK

		save 'eng' 0x14B

	sketch # Eng
		include markset.capital

		include : nShoulder
			left -- (SB + STROKE)
			right -- RIGHTSB
			top -- CAP
			bottom -- (HOOK + HALFSTROKE + O)
			sma -- SMOOTHA
			smb -- SMOOTHB
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) (HOOK + HALFSTROKE + O) [Math.max ((SB - RIGHTSB) / 2 + HALFSTROKE) (-HOOKX)] HOOK
		include : VBar (SB + HALFSTROKE * HVCONTRAST) 0 CAP

		save 'Eng' 0x14A

	sketch # nltail
		include glyphs.n AS_BASE
		eject-contour 'serifLB'
		include : VerticalHook (SB + HALFSTROKE * HVCONTRAST) 0 (-HOOKX) HOOK

		save 'nltail' 0x272

	sketch # ncurlytail
		local fine : adviceBlackness 4
		local rinner : clamp (WIDTH * 0.065) (XH * 0.05) (fine * 0.35)
		local wide : adviceBlackness 3
		local m1 : Math.min RIGHTSB (WIDTH - rinner * 2 - fine - OX)
		local x2 : mix SB m1 0.5
		local y2 : -fine
		include markset.e
		include : VBarLeft SB 0 XH wide
		include : dispiro
			nShoulderKnots
				left -- (SB + wide * HVCONTRAST)
				right -- m1
				fine -- SHOULDERFINE
				bottom -- (rinner * 2 + fine)
				stroke -- wide
			CurlyTail fine rinner m1 0 (m1 + rinner * 2 + fine) x2 y2

		if SLAB : begin
			include : LeftwardTopSerif SB XH SIDEJUT
			tag-contour 'serifLT'
			if (!para.isItalic) : begin
				include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
				tag-contour 'serifLB'

		save 'ncurlytail' 0x235
	# eta
	sketch # eta
		include markset.p
		set-anchor 'lf' BASE (SB + HALFSTROKE) 0

		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
			bottom -- DESCENDER
		include : VBarLeft SB 0 XH
		if SLAB : begin
			include : LeftwardTopSerif SB XH SIDEJUT
			tag-contour 'serifLT'

		save 'eta' 0x3B7

	sketch # latinEta
		include markset.if
		set-anchor 'lf' BASE (SB + HALFSTROKE) 0

		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
			top -- CAP
			bottom -- DESCENDER
		include : VBar (SB + HALFSTROKE * HVCONTRAST) 0 CAP
		if SLAB : begin
			include : LeftwardTopSerif SB CAP SIDEJUT
			tag-contour 'serifLT'
			if (para.isItalic)
			: then : include : tagged 'serifRB' : RightwardBottomSerif RIGHTSB DESCENDER SIDEJUT
			: else : include : tagged 'serifRB' : CenterBottomSerif (RIGHTSB - HALFSTROKE * HVCONTRAST) DESCENDER JUT
			if (!para.isItalic) : begin
				include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
				tag-contour 'serifLB'

		save 'latinEta' 0x220

	sketch # latineta
		include markset.p
		set-anchor 'lf' BASE (SB + HALFSTROKE) 0

		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
			bottom -- DESCENDER
		include : VBarLeft SB 0 XH
		if SLAB : begin
			include : LeftwardTopSerif SB XH SIDEJUT
			tag-contour 'serifLT'
			if (para.isItalic)
			: then : include : tagged 'serifRB' : RightwardBottomSerif RIGHTSB DESCENDER SIDEJUT
			: else : include : tagged 'serifRB' : CenterBottomSerif (RIGHTSB - HALFSTROKE * HVCONTRAST) DESCENDER JUT
			if (!para.isItalic) : begin
				include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
				tag-contour 'serifLB'
		save 'latineta' 0x19E

	### U
	define [UShape top bottom stroke oper] : glyph-construction
		include : dispiro
			widths.lhs stroke
			flat SB top [heading DOWNWARD]
			curl SB (bottom + SMOOTHB)
			arcvh
			g4   (MIDDLE + CORRECTION_OMIDS) (bottom + O)
			archv
			flat RIGHTSB (bottom + SMOOTHA)
			curl RIGHTSB top [heading UPWARD]
		if [not oper] : include : AIVSerifs top

	sketch # U
		set-width WIDTH
		include markset.capital
		include : UShape CAP 0

		save 'U' 'U'

	sketch # smcpU
		include markset.e
		include : UShape XH 0

		save 'smcpU' 0x1D1C
	list UShape

	### u
	sketch # u
		set-width WIDTH
		include markset.e
		set-anchor 'trailing' BASE (RIGHTSB - markHalfStroke) 0
		include glyphs.n
		eject-contour 'serifRB'
		eject-contour 'serifLB'
		retag-contour 'serifLT' 'serifRB'
		include : FlipAround MIDDLE (XH / 2)

		if SLAB : begin
			include : LeftwardTopSerif (RIGHTSB - STROKE * HVCONTRAST) XH SIDEJUT
			include : LeftwardTopSerif SB XH SIDEJUT

		save 'u' 'u'
	# upsilon
	sketch # upsilon
		include markset.e
		include : dispiro
			widths.lhs
			flat (SB + OX - O) XH [heading DOWNWARD]
			curl (SB + OX - O) SMALLSMOOTHB
			arcvh
			g4   (MIDDLE + CORRECTION_OMIDS) O
			archv
			flat (RIGHTSB - OX + O) SMALLSMOOTHA
			curl (RIGHTSB - OX + O) XH [heading UPWARD]

		save 'upsilon' 0x3C5
	define [LatinUpsilon2Shape top sma smb] : glyph-construction
		include : dispiro
			widths.lhs
			flat SB top [heading DOWNWARD]
			curl SB smb
			arcvh
			g4 (MIDDLE + CORRECTION_OMIDS) O
			archv
			flat RIGHTSB sma
			curl RIGHTSB (top - HOOK - HALFSTROKE) [heading UPWARD]
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) (top - HOOK - HALFSTROKE) (-(RIGHTSB - HALFSTROKE * HVCONTRAST - MIDDLE)) (-HOOK)

	sketch # latinUpsilon2
		include markset.e
		include : LatinUpsilon2Shape CAP SMOOTHA SMOOTHB

		save 'latinUpsilon2' 0x1B2

	sketch # latinupsilon2
		include markset.e
		include : LatinUpsilon2Shape XH SMALLSMOOTHA SMALLSMOOTHB
		save 'latinupsilon2' 0x28B

	### M
	define [MShape top] : glyph-construction
		local topstroke : adviceBlackness 5
		local halftopstroke : topstroke / 2

		include : dispiro
			flat SB 0 [widths.heading 0 STROKE UPWARD]
			curl SB (top * 0.2) [heading UPWARD]
			straight.up.end SB top [widths.heading 0 topstroke UPWARD]
		include : dispiro
			flat RIGHTSB 0 [widths.heading STROKE 0 UPWARD]
			curl RIGHTSB (top * 0.2) [heading UPWARD]
			straight.up.end RIGHTSB top [widths.heading topstroke 0 UPWARD]
		include : dispiro
			flat (SB + halftopstroke) top [widths.heading topstroke 0 DOWNWARD]
			curl MIDDLE (top * 0.3) [widths.heading (topstroke / 2) (topstroke / 2) DOWNWARD]
		include : dispiro
			flat (RIGHTSB - halftopstroke) top [widths.heading 0 topstroke DOWNWARD]
			curl MIDDLE (top * 0.3) [widths.heading (topstroke / 2) (topstroke / 2) DOWNWARD]
		include : AIMSerifs top

	sketch # M
		set-width WIDTH
		include markset.capital
		include : MShape CAP
		save 'M' 'M'
		save 'Mu' 0x39C
		save 'cyrEm' 0x41C

	sketch # cyrem
		include markset.e
		include : MShape XH
		save 'cyrem' 0x43C

	### m
	define [SmallMShape top bot mbot] : glyph-construction
		local m1 : mix (SB + O) (MIDDLE + MVERTSTROKE / 2 * HVCONTRAST) 0.5
		local m2 : mix (RIGHTSB - O) (MIDDLE - MVERTSTROKE / 2 * HVCONTRAST) 0.5
		include : mShoulderSpiro
			left   -- (SB + O + MVERTSTROKE * HVCONTRAST)
			right  -- (MIDDLE + MVERTSTROKE / 2 * HVCONTRAST)
			top    -- top
			bottom -- mbot
			width  -- MVERTSTROKE
			fine   -- (MVERTSTROKE * SHOULDERFINE / STROKE)
		include : mShoulderSpiro
			left   -- (MIDDLE + MVERTSTROKE * 0.5 * HVCONTRAST)
			right  -- (RIGHTSB - O)
			top    -- top
			bottom -- bot
			width  -- MVERTSTROKE
			fine   -- (MVERTSTROKE * SHOULDERFINE / STROKE)
		include : VBarLeft (SB + O) bot top MVERTSTROKE
		if SLAB : begin
			include : LeftwardTopSerif SB top SIDEJUT
			tag-contour 'serifLT'
			if (!para.isItalic) : include : LeftwardBottomSerif SB bot SIDEJUT
			include : RightwardBottomSerif RIGHTSB bot SIDEJUT
			tag-contour 'serifRB'

	sketch # m
		set-width WIDTH
		include markset.e
		include : SmallMShape XH 0 0
		save 'm.longleg'
		save 'cyrte.italic'
	sketch # m
		set-width WIDTH
		include markset.e
		include : SmallMShape XH 0 [XH * 0.2]
		save 'm.shortleg'
	select-variant 'm' 'm' 'longleg' {
		.'cv25' 'm.longleg'
		.'cv26' 'm.shortleg'
	}
	composite 'cyrtedescender.italic' glyphs.'cyrte.italic' [CyrDescender RIGHTSB] markset.e

	sketch # mltail
		include markset.p
		include glyphs.m
		eject-contour 'serifRB'
		include : VerticalHook (RIGHTSB - O - MVERTSTROKE / 2 * HVCONTRAST) 0 (-HOOKX) HOOK MVERTSTROKE

		save 'mltail' 0x271
	turned nothing 0x26F 'm' MIDDLE (XH / 2)

	sketch # capitalTurnm
		include markset.capital
		include : SmallMShape CAP 0 0
		include : FlipAround MIDDLE (CAP / 2)
		save 'capitalTurnm' 0x19C

	sketch # turnmleg
		include markset.p
		include glyphs.m
		eject-contour 'serifLT'
		include : FlipAround MIDDLE (XH / 2)
		include : VBarRight (RIGHTSB - O) DESCENDER 0 MVERTSTROKE
		save 'turnmleg' 0x270

	### H
	define [HShape top] : glyph-construction
		include : VBarLeft SB 0 top
		include : VBarRight RIGHTSB 0 top
		include : HBar (SB - O) (RIGHTSB + O) (top * BARPOS)
		include : AIHSerifs top

	sketch # H
		set-width WIDTH
		include markset.capital
		include : HShape CAP
		save 'H' 'H'
		save 'Eta' 0x397
		save 'cyrEn' 0x41D
	composite glyphs.cyrEn [CyrDescender RIGHTSB] [into-unicode 0x4A2]

	sketch # cyren
		include markset.e
		include : HShape XH
		save 'cyren' 0x43D
		save 'smcpH' 0x29C
	composite glyphs.cyren [CyrDescender RIGHTSB] [into-unicode 0x4A3]

	sketch # Hbar

		include glyphs.H AS_BASE
		include : HOverlayBar [mix SB 0 0.7] [mix RIGHTSB WIDTH 0.7] [mix CAPMIDDLE CAP 0.45]
		save 'Hbar' 0x126

	### h
	sketch # h
		set-width WIDTH
		include markset.b

		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
		include : VBarLeft SB 0 CAP
		if SLAB : begin
			include : LeftwardTopSerif SB CAP SIDEJUT
			if (para.isItalic)
			: then : include : RightwardBottomSerif RIGHTSB 0 SIDEJUT
			: else : include : CenterBottomSerif (RIGHTSB - HALFSTROKE * HVCONTRAST) 0 JUT
			tag-contour 'serifRB'
			if (!para.isItalic) : begin
				include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
				tag-contour 'serifLB'
		save 'h' 'h'
		save 'cyrshha' 0x4BB

	sketch # hhooktop
		include markset.b
		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
		include : HooktopLeftBar
		if SLAB : begin
			if (para.isItalic)
			: then : include : RightwardBottomSerif RIGHTSB 0 SIDEJUT
			: else : include : CenterBottomSerif (RIGHTSB - HALFSTROKE * HVCONTRAST) 0 JUT
			tag-contour 'serifRB'
			if (!para.isItalic) : begin
				include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) 0 JUT
				tag-contour 'serifLB'

		save 'hhooktop' 0x266

	sketch # hhooktopltail
		include markset.p
		include glyphs.hhooktop
		eject-contour 'serifRB'
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) 0 (-HOOKX) HOOK

		save 'hhooktopltail' 0x267

	sketch # hltail
		include markset.p
		include glyphs.h
		eject-contour 'serifRB'
		include : VerticalHook (RIGHTSB - HALFSTROKE * HVCONTRAST) 0 (-HOOKX) HOOK

		save 'hltail' 0xA727
	turned nothing 0x265 'h' MIDDLE (XH / 2) markset.p

	sketch # hookturnh
		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
			bottom -- (HOOK + HALFSTROKE + 1)
		include : VBarLeft SB 0 CAP
		include : create-glyph : glyph-construction
			include glyphs.rtailBR
			apply-transform : Upright
			apply-transform : Translate RIGHTSB (HOOK + HALFSTROKE)
			apply-transform : Italify
		include : FlipAround MIDDLE (XH / 2)
		include markset.p
		if SLAB : begin
			include : LeftwardTopSerif (RIGHTSB - STROKE * HVCONTRAST) XH SIDEJUT
			include : CenterBottomSerif (RIGHTSB - HALFSTROKE * HVCONTRAST) DESCENDER JUT

		save 'hookturnh' 0x2AE

	sketch # hookturnhrtail
		include : nShoulder
			left -- (SB + STROKE * HVCONTRAST)
			right -- RIGHTSB
			bottom -- (HOOK + HALFSTROKE + 1)
		include : VBarLeft SB 0 (XH - 1)
		include : create-glyph : glyph-construction
			include glyphs.rtailBR
			apply-transform : Upright
			apply-transform : Translate RIGHTSB (HOOK + HALFSTROKE)
			apply-transform : Italify
		include : FlipAround MIDDLE (XH / 2)
		include : create-glyph : glyph-construction
			include glyphs.rtailBR
			apply-transform : Upright
			apply-transform : Translate RIGHTSB 0
			apply-transform : Italify
		include markset.p
		if SLAB : begin
			include : LeftwardTopSerif (RIGHTSB - STROKE * HVCONTRAST) XH SIDEJUT

		save 'hookturnhrtail' 0x2AF

	sketch # hbar
		include glyphs.h AS_BASE
		include : HOverlayBar [mix SB 0 0.7] [mix SB RIGHTSB 0.5] [mix XH CAP 0.45]
		save 'hbar' 0x127
		save 'cyrtshe' 0x45B

	### F
	define [FShape top y noserif] : glyph-construction
		include : VBarLeft (SB * 1.5) 0 [fallback top CAP]
		include : HBarTop (SB * 1.5 - O) RIGHTSB [fallback top CAP]
		include : HBar (SB * 1.5 - O) (RIGHTSB - [Math.max HALFSTROKE ((RIGHTSB - SB) * 0.15)] - [if SLAB (STROKE * 0.25) 0]) ([fallback top CAP] * [fallback y [if SLAB 0.52 0.54]])
		if (SLAB && !noserif) : begin
			include : LeftwardTopSerif (SB * 1.5) [fallback top CAP] SIDEJUT
			include : CenterBottomSerif (SB * 1.5 + HALFSTROKE * HVCONTRAST) 0 JUT
			tag-contour 'serifBottom'
			include : DownwardRightSerif RIGHTSB [fallback top CAP] VJUT

	sketch # F
		set-width WIDTH
		include markset.capital
		include : FShape

		save 'F' 'F'

	sketch # Fltail
		include glyphs.F AS_BASE
		eject-contour 'serifBottom'
		include : VerticalHook (SB * 1.5 + HALFSTROKE * HVCONTRAST) 0 (-HOOKX) HOOK

		save 'Fltail' 0x191
	list FShape

	### long s, and f
	define fovershoot : fallback para.fovershoot (O * 6)

	sketch # longs.straight
		set-width WIDTH
		include markset.b
		include : dispiro
			widths.center
			flat (MIDDLE - FBALANCE) 0 [heading UPWARD]
			curl (MIDDLE - FBALANCE) (CAP - FHOOK)
			arcvh
			straight.right.end (MIDDLE - FBALANCE + HOOKX) (CAP - HALFSTROKE - fovershoot)
		set-anchor 'overlay' BASE (MIDDLE - FBALANCE + STROKE * 0.5 * HVCONTRAST) (CAP * OVERLAYPOS)
		if SLAB : begin
			include : CenterBottomSerif (MIDDLE - FBALANCE) 0 JUT
			tag-contour 'serifMB'

		save 'longs.straight'

	sketch # longs.upright
		include markset.b
		local m : MIDDLE - JBALANCE - HALFSTROKE * HVCONTRAST
		local r : m + (WIDTH * 0.5) + STROKE * HVCONTRAST - OXHOOK
		include : dispiro
			widths.lhs
			g4 r (CAP - HOOK)
			hookstart (CAP - O)
			flat m (CAP - SMOOTHA)
			curl m 0 [heading DOWNWARD]
		set-anchor 'overlay' BASE (m + STROKE * 0.65 * HVCONTRAST) (CAP * OVERLAYPOS)
		if SLAB : begin
			include : tagged 'serifLB' : CenterBottomSerif (m + HALFSTROKE * HVCONTRAST + RBALANCE * 0.35) 0 (JUT + RBALANCE * 0.65)

		save 'longs.upright'

	define [LongSShape top bottom hookx hooky fine] : glyph-construction
		local w [fallback fine STROKE]
		include : dispiro
			widths.center w
			straight.right.start (MIDDLE - hookx) (bottom + w / 2 + fovershoot)
			flat MIDDLE (bottom + hooky)
			curl MIDDLE (top - hooky)
			straight.right.end (MIDDLE + hookx) (top - w / 2 - fovershoot)

	sketch 'esh'
		include markset.if
		include : LongSShape CAP (-HOOK) HOOKX HOOK

		branch
			save 'longs.italic'
			save 'esh' 0x283

		branch
			include : HOverlayBar (MIDDLE - LONGJUT * 0.6) (MIDDLE + LONGJUT * 0.6) (XH * 0.25)
			save 'eshbar' 0x284

	sketch # longs
		set-width WIDTH

		if (para.isItalic)
			then : include glyphs.'longs.italic' AS_BASE
			else : include glyphs.'longs.upright' AS_BASE
		save 'longs' 0x17F

	sketch # eshcurlytail
		include markset.if
		local fine : adviceBlackness 3.5
		local rinner : LONGJUT / 2 - fine / 2
		local m1 : MIDDLE - HALFSTROKE * HVCONTRAST - FBALANCE
		local x2 : mix RIGHTSB m1 0.25
		local y2 : DESCENDER + O
		include glyphs.'longs.straight' false
		eject-contour 'serifMB'
		include : dispiro
			widths.lhs
			flat m1 XH [heading DOWNWARD]
			curl m1 (DESCENDER + fine + rinner * 2)
			CurlyTail
				fine -- fine
				rinner -- rinner
				xleft -- m1
				bottom -- DESCENDER
				right -- (m1 - LONGJUT)
				x2 -- x2
				y2 -- y2
		save 'eshcurlytail' 0x286

	sketch # ifishhook
		include markset.p
		include : VBar MIDDLE DESCENDER (XH - HOOK)
		include : VerticalHook MIDDLE (XH - HOOK) (-LONGJUT + LBALANCE) (-HOOK + HALFSTROKE)
		apply-transform : Translate LBALANCE 0
		if SLAB : begin
			include : CenterBottomSerif MIDDLE DESCENDER JUT

		save 'ifishhook' 0x27F

	sketch # iviby
		include markset.p
		include : VBar MIDDLE 0 (XH - HOOK - HALFSTROKE)
		include : VerticalHook MIDDLE (XH - HOOK - HALFSTROKE) (-LONGJUT) (-HOOK)
		include : VerticalHook MIDDLE 0 LONGJUT HOOK

		save 'iviby' 0x285
	define fbar : XH * 0.91 + STROKE * 0.25
	sketch # f.upright
		local fovershoot2 (O * 2)
		include markset.b
		local barleft : [mix SB RIGHTSB 0.35] - STROKE * 0.25 * HVCONTRAST
		include : dispiro
			widths.lhs
			g4 (RIGHTSB + RBALANCE2 - OXE) (CAP - HOOK * 0.75 - fovershoot2)
			hookstart (CAP - O - fovershoot2) {.shift 0.1 .skew 0.5}
			flat barleft (CAP - SMOOTHA * 0.8 - fovershoot2)
			curl barleft 0 [heading DOWNWARD]
		include : dispiro
			widths.rhs
			flat ([mix SB RIGHTSB 0] - HALFSTROKE * TANSLANT) fbar
			curl ([mix SB RIGHTSB 0.95] - HALFSTROKE * TANSLANT) fbar
		if SLAB : include : dispiro
			widths.lhs
			flat ([mix SB RIGHTSB 0.02] + HALFSTROKE * TANSLANT) 0
			curl ([mix SB RIGHTSB 0.875] + HALFSTROKE * TANSLANT) 0

		save 'f.upright'
		save 'lenisf' 0xAB35

	sketch # fltail
		include glyphs.'longs.italic' AS_BASE
		include : dispiro
			widths.rhs
			flat (MIDDLE - LONGJUT - HALFSTROKE * TANSLANT) fbar
			curl (MIDDLE + LONGJUT - HALFSTROKE * TANSLANT) fbar
		save 'f.italic'
		save 'fltail' 0x192

	italic-variant 'f' 'f'
	turned 'turnf' 0x25F 'f' MIDDLE (XH / 2) markset.p

		local shift (-(WIDTH * 0.055 + SB * 0.5))
		local barr RIGHTSB
		local hbarleft (SB + shift + STROKE * [if para.slantAngle 0.5 0.25])

		sketch # f_i
			include markset.b
			include : create-glyph : glyph-construction
				include glyphs.longs
				apply-transform : Translate shift 0
			include : VBarRight barr 0 fbar
			include : HBarTop hbarleft barr fbar
			if SLAB : begin
				if para.isItalic
				: then : include : tagged 'serifRB' : RightwardBottomSerif barr 0 SIDEJUT
				: else : include : tagged 'serifRB' : CenterBottomSerif (barr - HALFSTROKE * HVCONTRAST) 0 JUT
			save 'f_i' 0xFB01

		sketch # f_l.upright
			local m : MIDDLE - JBALANCE - HALFSTROKE * HVCONTRAST + shift
			include : dispiro
				widths.rhs
				flat m 0 [heading UPWARD]
				curl m (CAP - SMOOTHA)
				hookend (CAP - O)
				g4 (barr + OXHOOK) (CAP - HOOK)
			include : VBarRight barr 0 (CAP - HOOK)
			include : dispiro
				widths.rhs
				flat ([Math.min (m - STROKE * 0.3) hbarleft] - TANSLANT * HALFSTROKE) fbar
				curl ([mix SB barr 0.6] - TANSLANT * HALFSTROKE) fbar
			if SLAB : begin
				include : tagged 'serifLB' : CenterBottomSerif (m + HALFSTROKE * HVCONTRAST + RBALANCE * 0.35) 0 (JUT + RBALANCE * 0.65)
				include : tagged 'serifRB' : CenterBottomSerif (barr - HALFSTROKE * HVCONTRAST) 0 JUT
			save 'f_l.upright'

		sketch # f_l.italic
			include : create-glyph : glyph-construction
				include glyphs.'longs.italic' AS_BASE
				apply-transform : Translate shift 0
			include : VBarRight barr 0 CAP
			include : HBarTop hbarleft [mix SB barr 0.65] fbar
			if SLAB : include : tagged 'serifRB' : RightwardBottomSerif barr 0 SIDEJUT
			save 'f_l.italic'

		italic-variant 'f_l' 0xFB02

	* {LongSShape}

	### E
	define [EShape top] : glyph-construction
		include : FShape top nothing true
		include : HBarBottom (SB * 1.5 - O) RIGHTSB 0
		if SLAB : begin
			include : LeftwardTopSerif (SB * 1.5) [fallback top CAP] SIDEJUT
			include : CenterBottomSerif (SB * 1.5 + HALFSTROKE * HVCONTRAST) 0 JUT
			tag-contour 'serifBottom'
			include : DownwardRightSerif RIGHTSB [fallback top CAP] VJUT
			include : LeftwardBottomSerif (SB * 1.5) 0 SIDEJUT
			include : UpwardRightSerif RIGHTSB 0 VJUT

	sketch # turnE
		set-width WIDTH
		include markset.capital
		include : EShape CAP
		save 'E' 'E'
		save 'Epsilon' 0x395
		save 'cyrIe' 0x415

		include : FlipAround MIDDLE (CAP / 2)
		save 'turnE' 0x18E

	sketch # smcpturnE
		include markset.e
		include : EShape XH
		include : FlipAround MIDDLE (XH / 2)
		save 'smcpturnE' 0x2C7B

	### e
	define [SmallEShape top stroke barpos curly] : glyph-construction
		local barbottom (top * [fallback barpos EBARPOS] - HALFSTROKE)
		local hookx (RIGHTSB - OXHOOK + TAILADJX * TANSLANT)
		local hookmiddle : [mix (SB + O) hookx 0.55] + CORRECTION_OMIDS

		include : dispiro
			widths.lhs stroke
			flat (RIGHTSB - OX) barbottom [heading UPWARD]
			curl (RIGHTSB - OX) (top - SMALLSMOOTHB)
			arcvh
			g4 (MIDDLE - CORRECTION_OMIDS) (top - O)
			archv
			[if ((SMALLSMOOTHA + SMALLSMOOTHB) / top > 0.75) flat.ai flat] (SB + OX) (top - SMALLSMOOTHA)
			[if ((SMALLSMOOTHA + SMALLSMOOTHB) / top > 0.75) curl.ai curl] (SB + OX) (0 + SMALLSMOOTHB)
			hookend O nothing stroke
			g4 (RIGHTSB - OX * [if para.isItalic 0 0.5]) AHOOK
		include : HBarBottom (SB + (stroke / 2) + OX) (RIGHTSB - (stroke / 2) - OX) barbottom stroke

	sketch # cyrie
		include markset.e
		include : SmallEShape XH STROKE
		save 'e' 'e'
		save 'cyrie' 0x435

		include : FlipAround MIDDLE (XH / 2)
		save 'turne' 0x1DD
		save 'schwa' 0x259
		save 'cyrschwa' 0x4D9

	sketch # cyrSchwa
		include markset.capital
		include : SmallEShape CAP STROKE
		include : FlipAround MIDDLE (CAP / 2)
		save 'turnSmallE' 0x18F
		save 'cyrSchwa' 0x4D8

	define [RevSmallEShape top stroke barpos] : glyph-construction
		local barbottom (top * [fallback barpos EBARPOS] - HALFSTROKE)
		local hookx SB
		local hookmiddle : [mix (RIGHTSB - O) hookx 0.55] + CORRECTION_OMIDS

		include : dispiro
			widths.rhs stroke
			flat (SB + OX) barbottom [heading UPWARD]
			curl (SB + OX) (top - SMALLSMOOTHA)
			arcvh
			g4   MIDDLE (top - O)
			archv
			[if ((SMALLSMOOTHA + SMALLSMOOTHB) / top > 0.75) flat.ai flat] (RIGHTSB - OX) (top - SMALLSMOOTHB)
			[if ((SMALLSMOOTHA + SMALLSMOOTHB) / top > 0.75) curl.ai curl] (RIGHTSB - OX) SMALLSMOOTHA
			hookend O nothing stroke
			g4 (SB + O) AHOOK
		include : HBarBottom (SB + (stroke / 2)) (RIGHTSB - (stroke / 2)) barbottom stroke

	sketch # reve
		include markset.e
		include : RevSmallEShape XH STROKE
		save 'reve' 0x258

	list SmallEShape

	### T
	define [TShape top] : glyph-construction
		include : VBar MIDDLE 0 top
		local l : SB + OXE
		local r : RIGHTSB - OXE
		include : tagged 'strokeLT' : HBarTop l MIDDLE top
		include : tagged 'strokeRT' : HBarTop MIDDLE r top
		if SLAB : begin
			include : tagged 'serifRT' : DownwardRightSerif r top VJUT MVERTSTROKE
			include : tagged 'serifLT' : DownwardLeftSerif l top VJUT MVERTSTROKE
			include : tagged 'serifRB' : RightwardBottomSerif MIDDLE 0 (LONGJUT * 0.6)
			include : tagged 'serifRB' : LeftwardBottomSerif MIDDLE 0 (LONGJUT * 0.6)

	sketch # cyrTe
		include markset.capital
		set-anchor 'bottomright' BASE (MIDDLE + HALFSTROKE * HVCONTRAST) 0
		include : TShape CAP

		save 'T' 'T'
		save 'Tau' 0x3A4
		save 'cyrTe' 0x422

		branch
			include [CyrDescender (MIDDLE + HALFSTROKE * HVCONTRAST)]
			include markset.if
			save 'cyrTedescender' 0x4AC

		branch
			include : FlipAround MIDDLE (CAP / 2)
			save 'turnT' 0xA7B1

		branch
			include : HOverlayBar [mix MIDDLE SB 0.8] [mix MIDDLE RIGHTSB 0.8] [mix 0 CAP 0.45]
			save 'Tbar' 0x166

		branch
			eject-contour 'serifLT'
			eject-contour 'strokeLT'
			include : LeftHook (SB + LeftHook.extension) CAP MIDDLE
			save 'Thookleft' 0x1AC

	sketch # cyrtedescender.upright
		include markset.e
		include : TShape XH
		save 'cyrte.upright'

		include [CyrDescender (MIDDLE + HALFSTROKE * HVCONTRAST)]
		include markset.p
		save 'cyrtedescender.upright'

	italic-variant 'cyrtedescender' 0x4AD

	sketch # tau
		include markset.e
		include : HBar SB RIGHTSB (XH - HALFSTROKE)
		include : VBar MIDDLE 0 XH
		save 'tau' 0x3C4

	### t
	define tcenter : MIDDLE - TBALANCE - STROKE * 0.5 * HVCONTRAST
	define [SmallTShape top bot] : glyph-construction
		local hookx : tcenter + (WIDTH - SB * 2) * 0.8 + STROKE * 0.25 * HVCONTRAST
		local turn : [mix tcenter hookx 0.5] + CORRECTION_OMIDS
		local smb  : Math.max HOOK ((turn - tcenter) * 1.2)

		local g : dispiro
			widths.lhs
			flat tcenter top [heading DOWNWARD]
			curl tcenter (bot + smb)
			hookend (bot + O)
			g4 hookx (bot + HOOK)
		include g
		set-anchor 'bottomright' BASE g.knots.(g.knots.length - 1).x g.knots.(g.knots.length - 1).y
		set-anchor 'below' BASE [mix tcenter g.knots.(g.knots.length - 1).x : linreg 18 0.375 126 0.5 STROKE] bot
		include : dispiro
			widths.rhs
			flat (tcenter + HALFSTROKE - LONGJUT + TBALANCE2 - HALFSTROKE * TANSLANT) XH
			curl (tcenter + HALFSTROKE + LONGJUT + TBALANCE2 - HALFSTROKE * TANSLANT) XH

	sketch # t
		set-width WIDTH
		include markset.b
		include : SmallTShape CAP 0
		save 't' 't'
	turned nothing 0x287 't' MIDDLE (XH / 2) markset.p

	sketch # tltail
		include markset.if
		include glyphs.t
		local attach : utp currentGlyph.gizmo glyphs.t.anchors.bottomright
		include : VBarRight attach.x 0 attach.y
		include : VerticalHook (attach.x - HALFSTROKE * HVCONTRAST) 0 (-HOOKX) HOOK

		save 'tltail' 0x1AB

	sketch # thooktop
		include markset.e
		include : SmallTShape (XH - HALFSTROKE) 0
		include : VerticalHook (tcenter + HALFSTROKE * HVCONTRAST) XH HOOKX (-HOOK)

		save 'thooktop' 0x1AD

	sketch # trtail
		include markset.if
		include : SmallTShape CAP DESCENDER

		save 'trtail' 0x288

	sketch # tcurlytail
		include markset.b
		local fine : adviceBlackness 3.5
		local rinner : LONGJUT / 2 - fine / 2
		local x2 : mix SB tcenter 0.4
		local y2 : -fine
		include : HBarTop (tcenter + HALFSTROKE - LONGJUT + TBALANCE2) (tcenter + HALFSTROKE + LONGJUT + TBALANCE2) XH
		include : dispiro
			widths.lhs
			flat tcenter CAP [heading DOWNWARD]
			curl tcenter (fine + rinner * 2)
			CurlyTail fine rinner (tcenter+ STROKE * HVCONTRAST) 0 (tcenter + STROKE * HVCONTRAST + LONGJUT) x2 y2

		save 'tcurlytail' 0x236

	sketch # tbar

		include glyphs.t AS_BASE
		include : HOverlayBar ([mix MIDDLE SB 0.7] - TBALANCE * 0.5 - STROKE * 0.25 * HVCONTRAST) ([mix MIDDLE RIGHTSB 0.7] - TBALANCE * 0.5 - STROKE * 0.25 * HVCONTRAST) [mix 0 XH 0.6]
		save 'tbar' 0x167

	### S and s
	sketch # S
		set-width WIDTH
		include markset.capital
		define smooth : adviceSSmooth CAP (-1)
		include : dispiro
			widths.lhs
			g4   RIGHTSB (CAP - HOOK)
			hookstart CAPO
			g4   SB (CAP - smooth)
			alsothru 0.5 0.5 [widths (ESS / 2) (ESS / 2)]
			g4   RIGHTSB smooth [widths 0 STROKE]
			hookend O
			g4   SB HOOK
		save 'S' 'S'
		save 'cyrDze' 0x405

	sketch # s
		set-width WIDTH
		include markset.e
		define smooth : adviceSSmooth XH (-1 - [linreg 18 0 126 1 STROKE] * (3 - (WIDTH / 500) * 2.5 * [linreg 18 0 126 1 STROKE]))
		include : dispiro
			widths.lhs
			g4   (RIGHTSB + OX / 4) (XH - SHOOK)
			hookstart XO
			g4.down.mid   (SB + OX / 8) (XH - smooth)
			alsothru 0.5 0.5 [widths.center ESS]
			g4.down.mid   (RIGHTSB - OX / 8) (smooth) [widths 0 STROKE]
			hookend O
			g4   (SB - OX / 4) SHOOK
		save 's' 's'
		save 'cyrdze' 0x455

	sketch # revS
		include markset.capital
		local smooth : adviceSSmooth CAP 1
		include : dispiro
			widths.rhs
			g4   SB (CAP - HOOK)
			hookstart CAPO
			g4   RIGHTSB (CAP - smooth)
			alsothru 0.5 0.5 [widths (ESS / 2) (ESS / 2)]
			g4   SB smooth [widths STROKE 0]
			hookend O
			g4   RIGHTSB HOOK

		save 'revS' 0x1A7

	sketch # revs
		include markset.e
		local smooth : adviceSSmooth XH (1 + [linreg 18 0 126 1 STROKE] * (3.25 - (WIDTH / 500) * 2 * [linreg 18 0 126 1 STROKE]))
		include : dispiro
			widths.rhs
			g4   SB (XH - SHOOK)
			hookstart XO
			g4   RIGHTSB (XH - smooth)
			alsothru 0.5 0.5 [widths.center ESS]
			g4   SB (smooth) [widths STROKE 0]
			hookend O
			g4   RIGHTSB SHOOK

		save 'revs' 0x1A8
		save 'cyrghe.italic'

	sketch # srtail
		include glyphs.rtailBR
		apply-transform : Upright
		apply-transform : Translate (SB + STROKE * HVCONTRAST + OXHOOK) 0
		apply-transform : Italify
		include markset.p
		include glyphs.s
		include : VBarLeft (SB + OXHOOK) 0 SHOOK

		save 'srtail' 0x282

	sketch # Sswash
		include markset.if
		include glyphs.S
		include : dispiro
			widths.lhs [adviceBlackness 4.5]
			g4 (SB + OXHOOK) HOOK
			alsothru 0.15 0.6 important
			flat (RIGHTSB - 1) DESCENDER [widths STROKE 0]
			curl RIGHTSB DESCENDER

		save 'Sswash' 0x2C7E

	sketch # sswash
		include markset.p
		include glyphs.s
		include : dispiro
			widths.lhs [adviceBlackness 4.5]
			g4 (SB + OXHOOK) SHOOK
			alsothru 0.2 0.6 important
			flat (RIGHTSB - 1) DESCENDER [widths STROKE 0]
			curl RIGHTSB DESCENDER
		save 'sswash' 0x23F

	### Z and z
	sketch # Z
		set-width WIDTH
		include markset.capital

		local cor : 1.15 * HVCONTRAST

		include : HBarTop SB RIGHTSB CAP

		start-from SB STROKE
		line-to (SB + STROKE * cor) STROKE
		line-to RIGHTSB (CAP - STROKE)
		line-to (RIGHTSB - STROKE * cor) (CAP - STROKE)
		reverse-last

		include : HBarBottom SB RIGHTSB 0
		tag-contour 'strokeBottom'

		if SLAB : begin
			include : DownwardLeftSerif SB CAP VJUT
			include : UpwardRightSerif RIGHTSB 0 VJUT
			tag-contour 'serifRB'
		save 'Z' 'Z'
		save 'Zeta' 0x396

	sketch # z
		set-width WIDTH
		include markset.e

		local cor : 1.2 * HVCONTRAST

		include : HBarTop SB RIGHTSB XH

		start-from SB STROKE
		line-to (SB + STROKE * cor) STROKE
		line-to RIGHTSB (XH - STROKE)
		line-to (RIGHTSB - STROKE * cor) (XH - STROKE)
		reverse-last

		include : HBarBottom SB RIGHTSB 0
		tag-contour 'strokeBottom'
		if SLAB : begin
			include : DownwardLeftSerif SB XH VJUT
			include : UpwardRightSerif RIGHTSB 0 VJUT
			tag-contour 'serifRB'

		save 'z' 'z'

	sketch # Zdtail
		include glyphs.Z AS_BASE
		eject-contour 'strokeBottom'
		eject-contour 'serifRB'
		include : dispiro
			widths.lhs
			flat SB 0 [heading RIGHTWARD]
			curl (RIGHTSB - HOOKX) 0
			archv
			straight.down.end RIGHTSB (-HOOK) [widths.heading 0 STROKE DOWNWARD]

		save 'Zdtail' 0x224

	sketch # zdtail
		include glyphs.z AS_BASE
		eject-contour 'strokeBottom'
		eject-contour 'serifRB'
		include : dispiro
			widths.lhs
			flat SB 0 [heading RIGHTWARD]
			curl (RIGHTSB - HOOKX) 0
			archv
			straight.down.end RIGHTSB (-HOOK) [widths.heading 0 STROKE DOWNWARD]

		save 'zdtail' 0x225

	sketch # Zswash
		include markset.if
		local cor 1.15

		include : HBarTop SB RIGHTSB CAP

		start-from SB 0
		line-to (SB + STROKE * cor) 0
		line-to RIGHTSB (CAP - STROKE)
		line-to (RIGHTSB - STROKE * cor) (CAP - STROKE)
		reverse-last

		include : dispiro
			widths.lhs
			g4 SB 0
			alsothru 0.36 0.6 important
			flat (RIGHTSB - 1) DESCENDER
			curl RIGHTSB DESCENDER
		if SLAB : begin
			include : DownwardLeftSerif SB CAP VJUT

		save 'Zswash' 0x2C7F

	sketch # zswash
		include markset.p

		include : HBarTop SB RIGHTSB XH

		local cor 1.2
		start-from SB 0
		line-to (SB + STROKE * cor) 0
		line-to RIGHTSB (XH - STROKE)
		line-to (RIGHTSB - STROKE * cor) (XH - STROKE)
		reverse-last

		include : dispiro
			widths.lhs
			g4 (SB - OXHOOK) 0
			alsothru 0.36 0.6 important
			flat (RIGHTSB - 1) DESCENDER
			curl RIGHTSB DESCENDER

		if SLAB : begin
			include : DownwardLeftSerif SB XH VJUT

		save 'zswash' 0x240

	sketch # Zdesc
		include glyphs.Z AS_BASE
		eject-contour 'serifRB'
		include : VBarRight [mix SB RIGHTSB 1.05] (HALFSTROKE - LONGJUT) STROKE

		save 'Zdesc' 0x2C6B

	sketch # zdesc
		include glyphs.z AS_BASE
		eject-contour 'serifRB'
		include : VBarRight [mix SB RIGHTSB 1.05] (HALFSTROKE - LONGJUT) STROKE

		save 'zdesc' 0x2C6C

	sketch # zcurlytail
		include markset.e

		local fine : adviceBlackness 4
		local rinner : Math.max (XH * 0.04) (fine * 0.3)
		local x2 : mix (SB + STROKE) RIGHTSB 0.3
		local x1 : mix x2 (RIGHTSB - fine - rinner * 1.5) 0.45
		local y2 : -XH * 0.2
		local m1 : RIGHTSB - fine / 2 - rinner * 1.5 + O
		include : HCurlyTail fine STROKE rinner SB m1 (RIGHTSB + fine / 2) x1 x2 y2

		include glyphs.z
		eject-contour 'strokeBottom'
		eject-contour 'serifRB'
		save 'zcurlytail' 0x291

	return [object ISerifShape IotaShape LShape Belt VShape VHooktopShape WShape WHooktopShape YShape yBaseKnots SmallYShape KShape BShape ItalicCyrveShape PShape RShape CyrYaShape CShape GShape NShape UShape LatinUpsilon2Shape MShape SmallMShape HShape FShape fovershoot LongSShape EShape SmallEShape RevSmallEShape TShape SmallTShape]
