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

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

glyph-module

glyph-block Symbol-Pictograph-Metric-Marks : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives

	create-glyph 'metmark' 0xEF0F : glyph-proc
		include : VBar.m Middle (-fontMetrics.os2.usWinDescent) (fontMetrics.os2.usWinAscent) ShoulderFine
		include : HBar.m Middle Width 0 ShoulderFine
		include : HBar.m Middle Width CAP ShoulderFine
		include : HBar.m Middle Width XH ShoulderFine
		include : HBar.m Middle Width Descender ShoulderFine
		include : HBar.m 0 Middle SymbolMid ShoulderFine
		include : HBar.m 0 Middle ParenTop ShoulderFine
		include : HBar.m 0 Middle ParenBot ShoulderFine

	define MosaicTop      fontMetrics.os2.sTypoAscender
	define MosaicBottom   fontMetrics.os2.sTypoDescender
	define MarkerSize     (UPM / 12)
	define MarkerBarWidth (UPM / 50)

	create-glyph 'boxMarkLeft' 0xEF06 : glyph-proc
		set-width 0
		include : spiro-outline
			corner 0 ParenTop
			corner 0 (ParenTop + MarkerSize * 1.5)
			corner (-MarkerSize * 1.5) ParenTop
		include : spiro-outline
			corner 0 ParenBot
			corner 0 (ParenBot - MarkerSize * 1.5)
			corner (-MarkerSize * 1.5) ParenBot

	create-glyph 'boxMarkRight' 0xEF07 : glyph-proc
		set-width 0
		include : spiro-outline
			corner 0 ParenTop
			corner 0 (ParenTop + MarkerSize * 1.5)
			corner (+MarkerSize * 1.5) ParenTop
		include : spiro-outline
			corner 0 ParenBot
			corner 0 (ParenBot - MarkerSize * 1.5)
			corner (+MarkerSize * 1.5) ParenBot

	create-glyph 'mosaicMarkLeft' 0xEF08 : glyph-proc
		set-width 0
		include : spiro-outline
			corner 0 MosaicTop
			corner 0 (MosaicTop + MarkerSize * 1.5)
			corner (-MarkerSize * 1.5) MosaicTop
		include : spiro-outline
			corner 0 MosaicBottom
			corner 0 (MosaicBottom - MarkerSize * 1.5)
			corner (-MarkerSize * 1.5) MosaicBottom

	create-glyph 'mosaicMarkRight' 0xEF09 : glyph-proc
		set-width 0
		include : spiro-outline
			corner 0 MosaicTop
			corner 0 (MosaicTop + MarkerSize * 1.5)
			corner (+MarkerSize * 1.5) MosaicTop
		include : spiro-outline
			corner 0 MosaicBottom
			corner 0 (MosaicBottom - MarkerSize * 1.5)
			corner (+MarkerSize * 1.5) MosaicBottom

	create-glyph 'baselineMarkUnder' 0xEF0A : glyph-proc
		set-width 0
		include : HBar.m (-Width * 2) (Width * 2) 0 MarkerBarWidth

	create-glyph 'baselineMarkLeft' 0xEF0B : glyph-proc
		set-width 0
		include : spiro-outline
			corner 0 0
			corner (-MarkerSize * 1.5) (+MarkerSize * 1.5)
			corner (-MarkerSize * 1.5) (-MarkerSize * 1.5)

	create-glyph 'baselineMarkRight' 0xEF0C : glyph-proc
		set-width 0
		include : spiro-outline
			corner 0 0
			corner (+MarkerSize * 1.5) (+MarkerSize * 1.5)
			corner (+MarkerSize * 1.5) (-MarkerSize * 1.5)
