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

import [mix linreg clamp fallback SuffixCfg] from "@iosevka/util"
import [DependentSelector MathSansSerif] from "@iosevka/glyph/relation"

glyph-module

glyph-block Letter-Latin-C : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives
	glyph-block-import Mark-Adjustment : ExtendAboveBaseAnchors ExtendBelowBaseAnchors LeaningAnchor
	glyph-block-import Letter-Shared : CreateAccentedComposition CreateDependentComposite CreateTurnedLetter
	glyph-block-import Letter-Shared-Shapes : CurlyTail SerifedArcStart SerifedArcEnd
	glyph-block-import Letter-Shared-Shapes : InwardSlabArcStart InwardSlabArcEnd
	glyph-block-import Letter-Shared-Shapes : ArcStartSerif ArcEndSerif
	glyph-block-import Letter-Shared-Shapes : LetterBarOverlay PalatalHook RetroflexHook TopHook
	glyph-block-import Letter-Shared-Shapes : ArcStartSerifWidth ArcStartSerifDepth
	glyph-block-import Letter-Blackboard : BBS BBD

	define SLAB-NONE       0
	define SLAB-CLASSICAL  1
	define SLAB-INWARD     2
	define FLAT-CONNECTION 3

	glyph-block-export CShapeT
	define [CShapeT sink offset df st sb top bot ada adb hook sw origBar] : sink
		widths.lhs sw
		match st
			[Just SLAB-CLASSICAL] : SerifedArcStart.RtlLhs (df.rightSB - offset) top sw [fallback hook Hook] origBar
			[Just SLAB-INWARD] : InwardSlabArcStart.RtlLhs (df.rightSB - offset) top sw
			[Just FLAT-CONNECTION] : list
				flat (df.width - offset) (top - offset)
				curl [arch.adjust-x.top df.middle (sw -- sw)] (top - offset)
				archv
			_ : list
				g4 (df.rightSB - offset) (top - [fallback hook Hook])
				hookstart (top - offset) (sw -- sw)

		flatside.ld (df.leftSB + offset) bot top ada adb

		match sb
			[Just SLAB-CLASSICAL] : SerifedArcEnd.LtrLhs (df.rightSB - offset) bot sw [fallback hook Hook] origBar
			[Just SLAB-INWARD] : InwardSlabArcEnd.LtrLhs (df.rightSB - offset) bot sw
			[Just FLAT-CONNECTION] : list
				arcvh
				flat [arch.adjust-x.bot df.middle (sw -- sw)] (bot + O + offset)
				curl (df.width - offset) (bot + O + offset)
			_ : list
				hookend (bot + offset) (sw -- sw)
				g4 (df.rightSB - offset) (bot + [fallback hook Hook])

	define [RevCShapeT sink offset df st sb top bot ada adb hook sw origBar] : sink
		widths.rhs sw
		match st
			[Just SLAB-CLASSICAL] : SerifedArcStart.LtrRhs (df.leftSB + offset) top sw [fallback hook Hook] origBar
			[Just SLAB-INWARD] : InwardSlabArcStart.LtrRhs (df.leftSB + offset) top sw
			[Just FLAT-CONNECTION] : list
				flat (0 + offset) (top - offset)
				curl [arch.adjust-x.top df.middle (sw -- sw)] (top - offset)
				archv
			_ : list
				g4 (df.leftSB + offset) (top - [fallback hook Hook])
				hookstart (top - offset) (sw -- sw)

		flatside.rd (df.rightSB - offset) bot top ada adb

		match sb
			[Just SLAB-CLASSICAL] : SerifedArcEnd.RtlRhs (df.leftSB + offset) bot sw [fallback hook Hook]
			[Just SLAB-INWARD] : InwardSlabArcEnd.RtlRhs (df.leftSB + offset) bot sw
			[Just FLAT-CONNECTION] : list
				arcvh
				flat [arch.adjust-x.bot df.middle (sw -- sw)] (bot + O + offset)
				curl (0 + offset) (bot + O + offset)
			_ : list
				hookend (bot + offset) (sw -- sw)
				g4 (df.leftSB + offset) (bot + [fallback hook Hook])

	define [AutoStartSerifR df sty top hook sw] : match sty
		[Just SLAB-CLASSICAL] : ArcStartSerif.R df.rightSB top [fallback sw Stroke] [fallback hook Hook]
		[Just SLAB-INWARD]    : ArcStartSerif.InwardR df.rightSB top [fallback sw Stroke] [fallback hook Hook]
		__ : glyph-proc

	define [AutoStartSerifL df sty top hook sw] : match sty
		[Just SLAB-CLASSICAL] : ArcStartSerif.L df.leftSB top [fallback sw Stroke] [fallback hook Hook]
		[Just SLAB-INWARD]    : ArcStartSerif.InwardL df.leftSB top [fallback sw Stroke] [fallback hook Hook]
		__ : glyph-proc

	define [AutoStartSerifRB df sty bot hook sw] : match sty
		[Just SLAB-CLASSICAL] : ArcEndSerif.R df.rightSB bot [fallback sw Stroke] [fallback hook Hook]
		[Just SLAB-INWARD]    : ArcEndSerif.InwardR df.rightSB bot [fallback sw Stroke] [fallback hook Hook]
		__ : glyph-proc

	define [AutoStartSerifLB df sty bot hook sw] : match sty
		[Just SLAB-CLASSICAL] : ArcEndSerif.L df.leftSB bot [fallback sw Stroke] [fallback hook Hook]
		[Just SLAB-INWARD]    : ArcEndSerif.InwardL df.leftSB bot [fallback sw Stroke] [fallback hook Hook]
		__ : glyph-proc

	define [CCurlyTailShape df slabType top bot] : glyph-proc
		local sw : AdviceStroke2 2 3 XH
		local fine : AdviceStroke2 3 3 XH
		local loopTop : bot + 0.45 * XH

		include : dispiro
			match slabType
				[Just SLAB-CLASSICAL] : SerifedArcStart.RtlLhs df.rightSB top sw Hook
				[Just SLAB-INWARD] : InwardSlabArcStart.RtlLhs df.rightSB top sw Hook
				__ : list [g4 df.rightSB (top - Hook) [widths.lhs sw]] [hookstart top (sw -- sw)]
			flatside.ld df.leftSB bot top SmallArchDepthA SmallArchDepthB
			CurlyTail.n fine bot df.rightSB 0 bot (yLoopTop -- loopTop)

	glyph-block-export CLetterForm
	define [CLetterForm] : with-params [df sty styBot top bot [ada ArchDepthA] [adb ArchDepthB] [hook Hook] [sw Stroke] [ob nothing]] : namespace
		export : define [base] : CShapeT dispiro 0 df sty styBot top bot ada adb hook sw ob
		export : define [topSerif] : AutoStartSerifR df sty top hook sw
		export : define [botSerif] : AutoStartSerifRB df styBot bot hook sw

		export : define [revBase] : RevCShapeT dispiro 0 df sty styBot top bot ada adb hook sw ob
		export : define [revTopSerif] : AutoStartSerifL df sty top hook sw
		export : define [revBotSerif] : AutoStartSerifLB df styBot bot hook sw

		export : define [hookTop] : TopHook.toRight.arcStart df.rightSB top hook (refSw -- sw)

		# Used by Cyrillic Koppa
		export : define [baseTopOnly] : CShapeT dispiro 0 df sty SLAB-NONE top bot ada adb hook sw ob
		export : define [descBase] : CShapeT dispiro 0 df sty (styBot || SLAB-CLASSICAL) top bot ada adb hook sw ob

		export : define [full] : composite-proc [base] [topSerif] [botSerif]
		export : define [revFull] : composite-proc [revBase] [revTopSerif] [revBotSerif]

	glyph-block-export CConfig
	define CConfig : object
		serifless               { SLAB-NONE      SLAB-NONE      }
		bottomSerifed           { SLAB-NONE      SLAB-CLASSICAL }
		bottomInwardSerifed     { SLAB-NONE      SLAB-INWARD    }
		unilateralSerifed       { SLAB-CLASSICAL SLAB-NONE      }
		bilateralSerifed        { SLAB-CLASSICAL SLAB-CLASSICAL }
		unilateralInwardSerifed { SLAB-INWARD    SLAB-NONE      }
		bilateralInwardSerifed  { SLAB-INWARD    SLAB-INWARD    }
		hybridSerifed1          { SLAB-INWARD    SLAB-CLASSICAL }

	foreach { suffix { sty styBot } } [Object.entries CConfig] : do
		create-glyph "C.\(suffix)" : glyph-proc
			include : MarkSet.capital
			local lf : CLetterForm [DivFrame 1] sty styBot CAP 0
			include : lf.full

		create-glyph "smcpC.\(suffix)" : glyph-proc
			include : MarkSet.e
			local lf : CLetterForm [DivFrame 1] sty styBot XH 0
			include : lf.full

		create-glyph "revC.\(suffix)" : glyph-proc
			include : MarkSet.capital
			local lf : CLetterForm [DivFrame 1] sty styBot CAP 0
			include : lf.revFull

		create-glyph "CHookTop.\(suffix)" : glyph-proc
			include : MarkSet.capital
			local lf : CLetterForm [DivFrame 1] sty styBot CAP 0
			include : union [lf.base] [lf.hookTop] [lf.botSerif]
			include : ExtendAboveBaseAnchors (CAP + Ascender - XH)
			include : LeaningAnchor.Above.VBar.r RightSB

		create-glyph "currency/euroSign.\(suffix)" : glyph-proc
			include [refer-glyph "C.\(suffix)"] AS_BASE ALSO_METRICS
			include : union
				LetterBarOverlay.l SB (CAP * 0.4)
				LetterBarOverlay.l SB (CAP * 0.6)

		create-glyph "c.\(suffix)" : glyph-proc
			include : MarkSet.e
			local lf : CLetterForm [DivFrame 1] sty styBot XH 0
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : lf.full

		create-glyph "c/centKernelStd.\(suffix)" : glyph-proc
			set-width 0
			set-mark-anchor 'cvDecompose' Middle (XH / 2)
			local lf : CLetterForm [DivFrame 1] sty styBot XH 0
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : lf.full

		create-glyph "c/centKernelCap.\(suffix)" : glyph-proc
			set-width 0
			set-mark-anchor 'cvDecompose' Middle (CAP / 2)
			local t : CAP / 2 + XH / 2
			local b : CAP / 2 - XH / 2
			local lf : CLetterForm [DivFrame 1] sty styBot t b
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : lf.full

		create-glyph "revc.\(suffix)" : glyph-proc
			include : MarkSet.e
			local lf : CLetterForm [DivFrame 1] sty styBot XH 0
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : lf.revFull

		create-glyph "turncSideways.\(suffix)" : glyph-proc
			local df : DivFrame (XH / Width) 2 (XH * 0.1 / SB)
			include : df.markSet.e
			local top : Width - SB
			local p : mix 1 (Width / UPM) 0.5
			include : PointingTo Width XH Width 0 : function [] : glyph-proc
				local lf : CLetterForm df sty styBot top 0 (hook -- (Hook * p))
				include : lf.full
				include : FlipAround df.middle (top / 2)
				include : Translate 0 (SB / 2)

		create-glyph "cyrl/esWide.\(suffix)" : glyph-proc
			local df : include : DivFrame para.advanceScaleT 3
			include : df.markSet.e
			local desc : (-LongVJut) + QuarterStroke
			include : ExtendBelowBaseAnchors desc
			local lf : CLetterForm df sty styBot XH desc
				ada -- [df.archDepthAOf SmallArchDepth Stroke]
				adb -- [df.archDepthBOf SmallArchDepth Stroke]
			include : lf.full

		create-glyph "cHookTop.\(suffix)" : glyph-proc
			include : MarkSet.e
			local lf : CLetterForm [DivFrame 1] sty styBot XH 0
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : union [lf.base] [lf.hookTop] [lf.botSerif]
			include : ExtendAboveBaseAnchors Ascender
			include : LeaningAnchor.Above.VBar.r RightSB

		create-glyph "cCurlyTail.\(suffix)" : glyph-proc
			include : MarkSet.e
			include : CCurlyTailShape [DivFrame 1] sty XH 0
			include : AutoStartSerifR [DivFrame 1] sty XH

		create-glyph "stretchedC.\(suffix)" : glyph-proc
			include : MarkSet.p
			local lf : CLetterForm [DivFrame 1] sty styBot XH Descender
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : lf.full

		create-glyph "stretchedCCurlyTail.\(suffix)" : glyph-proc
			include : MarkSet.p
			include : CCurlyTailShape [DivFrame 1] sty XH Descender
			include : AutoStartSerifR [DivFrame 1] sty XH

		define [KoppaShapeT styTop styBot top base] : union
			VBar.r (Middle + [HSwToV Stroke]) Descender HalfStroke
			difference base
				Rect (top / 2) Descender (Middle + [HSwToV Stroke]) (Width * 4)
				Rect (XH / 2) [mix Stroke Hook 0.5] Middle (Width * 4)
			if (styTop && [not para.isItalic])
				HSerif.mb (Middle + [HSwToV HalfStroke]) Descender MidJutSide
				no-shape

		if [not styBot] : create-glyph "cyrl/Koppa.\(suffix)" : glyph-proc
			include : MarkSet.capDesc
			local lf : CLetterForm [DivFrame 1] sty styBot CAP 0
			include : KoppaShapeT sty styBot CAP : union [lf.baseTopOnly] [lf.topSerif]

		if [not styBot] : create-glyph "cyrl/koppa.\(suffix)" : glyph-proc
			include : MarkSet.p
			local lf : CLetterForm [DivFrame 1] sty styBot XH 0
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : KoppaShapeT sty styBot XH : union [lf.baseTopOnly] [lf.topSerif]

		create-glyph "C/descBase.\(suffix)" : glyph-proc
			include : MarkSet.capital
			local lf : CLetterForm [DivFrame 1] sty styBot CAP 0
			include : union [lf.descBase] [lf.topSerif]
			include : VBar.r RightSB 0 [ArcStartSerifDepth Hook] [ArcStartSerifWidth Stroke]

		create-glyph "c/descBase.\(suffix)" : glyph-proc
			include : MarkSet.e
			local lf : CLetterForm [DivFrame 1] sty styBot XH 0
				ada -- SmallArchDepthA
				adb -- SmallArchDepthB
			include : union [lf.descBase] [lf.topSerif]
			include : VBar.r RightSB 0 [ArcStartSerifDepth Hook] [ArcStartSerifWidth Stroke]

		create-glyph "romanSixLateForm.\(suffix)" : glyph-proc
			include : MarkSet.capDesc
			local lf : CLetterForm [DivFrame 1] sty styBot CAP 0
			include : union [lf.descBase] [lf.topSerif]
			include : VBar.r RightSB Descender [ArcStartSerifDepth Hook] [ArcStartSerifWidth Stroke]
			if styBot : begin
				include : HSerif.rb (RightSB - [HSwToV : 0.5 * [ArcStartSerifWidth Stroke]]) Descender Jut
				include : HSerif.lb (RightSB - [HSwToV : 0.5 * [ArcStartSerifWidth Stroke]]) Descender MidJutSide

	select-variant 'C' 'C'
	link-reduced-variant 'C/sansSerif' 'C' MathSansSerif
	select-variant 'revC' 0x2183 (follow -- 'C')

	alias 'cyrl/Es' 0x421 'C'
	alias 'grek/lunateSigma' 0x3F9 'C'

	select-variant 'CHookTop' 0x187
	select-variant 'smcpC' 0x1D04 (follow -- 'C')

	select-variant 'currency/euroSign' 0x20AC

	select-variant 'c' 'c'
	link-reduced-variant 'c/sansSerif' 'c' MathSansSerif
	link-reduced-variant 'c/ascBase' 'c' (follow -- 'cHookTop')
	select-variant 'revc' 0x2184 (follow -- 'c')

	select-variant 'c/centKernelStd' (follow -- 'c')
	select-variant 'c/centKernelCap' (follow -- 'c')

	alias 'cyrl/es' 0x441 'c'
	alias 'grek/lunateSmallSigma' 0x3F2 'c.serifless'

	select-variant 'turncSideways' 0x1D12 (follow -- 'c')
	select-variant 'cyrl/esWide' 0x1C83 (follow -- 'c')

	select-variant 'cCurlyTail' 0x255
	select-variant 'cHookTop' 0x188
	select-variant 'stretchedC' 0x297 (follow -- 'c')
	select-variant 'stretchedCCurlyTail' 0x1DF0F (follow -- 'cCurlyTail')

	select-variant 'cyrl/Koppa' 0x480 (follow -- 'CTopSerifOnly')
	select-variant 'cyrl/koppa' 0x481 (follow -- 'cTopSerifOnly')

	select-variant 'C/descBase'
	select-variant 'c/descBase'
	select-variant 'romanSixLateForm' 0x2185 (follow -- 'C/descBase')

	CreateTurnedLetter 'turnC' 0x186 'C' HalfAdvance (CAP / 2)
	CreateTurnedLetter 'turnc' 0x254 'c' HalfAdvance (XH / 2)
	CreateTurnedLetter 'turnSmcpC' 0x1D10 'smcpC' HalfAdvance (XH / 2)

	alias 'grek/revLunateSigma' 0x3FD 'revC'
	alias 'grek/revLunateSmallSigma' 0x37B 'revc.serifless'

	CreateTurnedLetter 'turnc/descBase' null 'c/ascBase' HalfAdvance (XH / 2)
	derive-composites 'turncRetroflexHook' 0x1D97 'turnc/descBase'
		RetroflexHook.l SB 0 (yAttach -- DToothlessRise)

	derive-composites 'CPalatalHook' 0xA7C4 'C/descBase'
		PalatalHook.r RightSB 0 (yAttach -- DToothlessRise)

	derive-composites 'cPalatalHook' 0xA794 'c/descBase'
		PalatalHook.r RightSB 0 (yAttach -- DToothlessRise)

	derive-composites 'cRTail' 0x1DF1D 'c/descBase'
		RetroflexHook.r RightSB 0 (yAttach -- DToothlessRise)

	derive-composites 'grek/dotLunateSigma' 0x3FE 'grek/lunateSigma' 'innerDot'
	derive-composites 'grek/dotRevLunateSigma' 0x3FF 'grek/revLunateSigma' 'innerDot'
	derive-composites 'grek/dotLunateSmallSigma' 0x37C 'grek/lunateSmallSigma' 'innerDotSmall'
	derive-composites 'grek/dotRevLunateSmallSigma' 0x37D 'grek/revLunateSmallSigma' 'innerDotSmall'
	derive-composites 'CRevDot' 0xA73E 'revC' 'innerDotSmall'
	derive-composites 'cRevDot' 0xA73F 'revc' 'innerDotSmall'

	create-glyph 'CBarOverlay' : LetterBarOverlay.l.in SB 0 CAP
	create-glyph 'cBarOverlay' : LetterBarOverlay.l.in SB 0 XH
	derive-composites 'CBar' 0xA792 'C' 'CBarOverlay'
	derive-composites 'cBar' 0xA793 'c' 'cBarOverlay'

	derive-composites 'CCedilla' 0xC7 'C' 'cedillaExtShapeBelowOArc'
	derive-composites 'cCedilla' 0xE7 'c' 'cedillaExtShapeBelowOArc'

	derive-glyphs 'cyrl/The' 0x4AA "cyrl/Es" : function [src gr] : glyph-proc
		include [refer-glyph src] AS_BASE ALSO_METRICS
		local desc : (-LongVJut) + QuarterStroke
		include : ExtendBelowBaseAnchors desc
		include : difference
			VBar.m [arch.adjust-x.bot Middle] desc (Stroke + O) VJutStroke
			OShapeOutline.NoOvershoot CAP 0 SB RightSB Stroke ArchDepthA ArchDepthB

	derive-multi-part-glyphs 'cyrl/The.BSH' null { 'cyrl/Es' 'invCommaBelow' } : lambda [srcs gr] : glyph-proc
		local { base mark } srcs
		include : refer-glyph mark
		include : Translate Width AccentClearance
		include [refer-glyph base] AS_BASE ALSO_METRICS
		include : ExtendBelowBaseAnchors (-AccentHeight)

	alias 'cyrl/The.CHU' null 'CCedilla'

	derive-glyphs 'cyrl/the' 0x4AB "cyrl/es" : function [src gr] : glyph-proc
		include [refer-glyph src] AS_BASE ALSO_METRICS
		local desc : (-LongVJut) + QuarterStroke
		include : ExtendBelowBaseAnchors desc
		include : difference
			VBar.m [arch.adjust-x.bot Middle] desc (Stroke + O) VJutStroke
			OShapeOutline.NoOvershoot XH 0 SB RightSB Stroke SmallArchDepthA SmallArchDepthB

	derive-multi-part-glyphs 'cyrl/the.BSH' null { 'cyrl/es' 'invCommaBelow' } : lambda [srcs gr] : glyph-proc
		local { base mark } srcs
		include : refer-glyph mark
		include : Translate Width AccentClearance
		include [refer-glyph base] AS_BASE ALSO_METRICS
		include : ExtendBelowBaseAnchors (-AccentHeight)

	alias 'cyrl/the.CHU' null 'cCedilla'

	CreateAccentedComposition 'CAcute' 0x106 'C' 'acuteAbove'
	CreateAccentedComposition 'cAcute' 0x107 'c' 'acuteAbove'

	CreateAccentedComposition 'CAcute.PLK' null 'C' 'kreskaAbove'
	CreateAccentedComposition 'cAcute.PLK' null 'c' 'kreskaAbove'

	create-glyph 'mathbb/C' 0x2102 : glyph-proc
		include : MarkSet.capital
		include : CShapeT dispiro 0 [DivFrame 1] SLAB-NONE SLAB-NONE CAP 0 ArchDepthA ArchDepthB Hook BBS
		include : intersection
			CShapeT spiro-outline 0.1 [DivFrame 1] SLAB-NONE SLAB-NONE CAP 0 ArchDepthA ArchDepthB Hook BBS
			VBar.l (SB + BBD) 0 CAP BBS

	create-glyph 'mathbb/c' 0x1D554 : glyph-proc
		include : MarkSet.capital
		include : CShapeT dispiro 0 [DivFrame 1] SLAB-NONE SLAB-NONE XH 0 SmallArchDepthA SmallArchDepthB Hook BBS
		include : intersection
			CShapeT spiro-outline 0.1 [DivFrame 1] SLAB-NONE SLAB-NONE XH 0 SmallArchDepthA SmallArchDepthB Hook BBS
			VBar.l (SB + BBD + OX) 0 CAP BBS

	define CentConfig : SuffixCfg.weave
		object # slope
			""          0
			"slanted"   0.08
		object # body
			open        0
			through     1
			interrupted 2
		object # height
			""         { 0 XH (Descender / 2) (XH - Descender / 2)   "std" }
			"cap"      { (CAP / 2 - XH / 2) (CAP / 2 + XH / 2) 0 CAP "cap" }

	foreach { suffix { sl fillType { bMask tMask bot top selector }}} [pairs-of CentConfig] : do
		define [xBot df] : mix df.leftSB df.rightSB (0.5 - sl)
		define [xTop df] : mix df.leftSB df.rightSB (0.5 + sl)

		define swBarThick : AdviceStroke 3
		define swBarFine : AdviceStroke [StrokeWidthBlend 3 5.5]

		define [FullBar df sw] : dispiro
			flat [xBot df] bot [widths.center.heading sw Downward]
			curl [xTop df] top [widths.center.heading sw Downward]

		define [InterruptBar df] : begin
			local cofine : AdviceStroke 4
			return : union
				dispiro
					flat [xTop df] top [widths.center.heading cofine Downward]
					curl df.middle [mix top bot 0.5] [widths.center.heading swBarFine Downward]
				dispiro
					flat [xBot df] bot [widths.center.heading cofine Upward]
					curl df.middle [mix bot top 0.5] [widths.center.heading swBarFine Upward]

		define [OutlineMask df] : lift-@ : spiro-outline
			curl     (@x1 = df.leftSB + HalfStroke)  (@y2 - SmallArchDepthA)
			arch.rhs (sw -- Stroke)                  (@y2 = tMask - HalfStroke)
			flat     (@x3 = df.rightSB - HalfStroke) (@y2 - SmallArchDepthB)
			curl      @x3                            (@y5 + SmallArchDepthA)
			arch.rhs (sw -- Stroke)                  (@y5 = bMask + HalfStroke)
			flat      @x1                            (@y5 + SmallArchDepthB)

		define [InterruptMask df] : begin
			define gap : Math.max (XH / 8) [AdviceStroke2 6 6 XH]
			return : HBar.m 0 df.width [mix bot top 0.5] gap

		create-glyph "cent/bar.\(suffix)" : glyph-proc
			local df : include : DivFrame 1
			set-base-anchor 'cvDecompose' df.middle [mix bot top 0.5]
			DependentSelector.set currentGlyph selector

			include : difference [FullBar df swBarThick] [OutlineMask df]
			if (fillType === 1) : include : intersection [FullBar df swBarFine] [OutlineMask df]
			if (fillType === 2) : include : intersection [InterruptBar df]
				difference [OutlineMask df] [InterruptMask df]

	select-variant 'cent/bar' (follow -- 'cent')

	CreateDependentComposite 'cent/centSign' 0xA2 "cent/bar" : object
		'std' 'c/centKernelStd'
		'cap' 'c/centKernelCap'
