$$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-Yi : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives
	glyph-block-import Letter-Shared-Shapes : SerifFrame
	glyph-block-import Letter-Cyrillic-Ze : CyrZe

	do "Yi"
		create-glyph 'armn/Yi' 0x545 : glyph-proc
			local df : include : DivFrame 1
			include : df.markSet.capital
			local ze : CyrZe 0 0 CAP 0
				left  -- df.leftSB
				right -- df.rightSB
				blend -- (1 + (2 * O) / (df.rightSB - df.leftSB))
				hook  -- Hook
				op    -- HBarPos
			include : ze.Shape
			if SLAB : begin
				local midy : mix 0 CAP HBarPos
				local vJut : Math.min VJut : CAP - 2 * Hook - df.mvs
				include : VBar.l (df.leftSB - 2 * O) (midy - 0.5 * vJut) (midy + 0.5 * vJut) df.mvs
