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

import [mix linreg clamp fallback] from "@iosevka/util"
import [DesignParameters] from "../../meta/aesthetics.mjs"

glyph-module

glyph-block Letter-Greek-Upper-Theta : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives

	create-glyph 'grek/Theta' 0x398 : glyph-proc
		include : MarkSet.capital
		local xMidLeft  : SB + [HSwToV Stroke] - O * 3
		local xMidRight : RightSB - [HSwToV Stroke] + O * 3
		local yBar : 0.5 * CAP
		include [refer-glyph 'O'] AS_BASE
		include : HBar.m xMidLeft xMidRight yBar

		if SLAB : begin
			define jutSw : Math.min [AdviceStroke 4] (0.33 * (xMidRight - xMidLeft))
			define jut : Math.min VJut (Stroke + 2 * jutSw)
			include : VBar.l xMidLeft (yBar - 0.5 * jut) (yBar + 0.5 * jut) jutSw
			include : VBar.r xMidRight (yBar - 0.5 * jut) (yBar + 0.5 * jut) jutSw
