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

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

glyph-module

glyph-block Letter-Armenian-Upper-Ini-Ken-Vew : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives
	glyph-block-import Letter-Shared-Shapes : nShoulder uBowl SerifFrame
	glyph-block-import Letter-Armenian-Shared-Shapes : ArmHBar

	# Common Params
	define barPos : XH / 2
	define highBarPos XH
	define jut Jut

	do "Ini"
		create-glyph 'armn/Ini' 0x53B : glyph-proc
			local df : include : DivFrame 1
			include : df.markSet.capital
			local barPosB : barPos - df.mvs / 2
			include : nShoulder.shape
				top    -- highBarPos
				bottom -- barPosB
				left   -- (df.leftSB + [HSwToV df.mvs])
				right  -- df.rightSB
				ada    -- ArchDepthA
				adb    -- ArchDepthB
				stroke -- df.mvs
			include : VBar.l df.leftSB 0 CAP df.mvs
			if SLAB : begin
				local sf : SerifFrame.fromDf df CAP 0
				local sf2 : SerifFrame.fromDf df highBarPos barPosB
				include : composite-proc sf.lt.full sf.lb.full sf2.rb.full

	do "Ken"
		create-glyph 'armn/Ken' 0x53F : glyph-proc
			local df : include : DivFrame 1
			include : df.markSet.capital
			local barPosB : barPos - df.mvs / 2
			include : uBowl.shape
				top    -- CAP
				bottom -- barPosB
				left   -- df.leftSB
				right  -- (df.rightSB - [HSwToV df.mvs])
				ada    -- ArchDepthA
				adb    -- ArchDepthB
				stroke -- df.mvs
			include : VBar.r df.rightSB 0 highBarPos df.mvs
			if SLAB : begin
				local sf : SerifFrame.fromDf df CAP 0
				local sf2 : SerifFrame.fromDf df highBarPos 0
				include : composite-proc sf.lt.full sf2.rt.full sf.rb.full

	do "Vew"
		create-glyph 'armn/Vew' 0x54E : glyph-proc
			local df : include : DivFrame 1
			include : df.markSet.capital
			local barPosB : barPos - df.mvs / 2
			include : uBowl.shape
				top    -- highBarPos
				bottom -- barPosB
				left   -- df.leftSB
				right  -- (df.rightSB - [HSwToV df.mvs])
				ada    -- ArchDepthA
				adb    -- ArchDepthB
				stroke -- df.mvs
			include : VBar.r df.rightSB 0 CAP df.mvs
			include : [ArmHBar.right df].base
			if SLAB : begin
				local sf : SerifFrame.fromDf df highBarPos 0
				local sf2 : SerifFrame.fromDf df CAP 0
				include : composite-proc sf.lt.full sf2.rt.full sf.rb.full
