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

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

glyph-module

glyph-block Symbol-Math-Other : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives
	glyph-block-import NotGlyphFn : NotGlyphSw

	alias 'mathBullet' 0x2219 'bullet'
	alias 'whiteDiamondOperator' 0x22C4 'whiteDiamondOperatorImpl.NWID'
	alias 'mathstar' 0x22C6 'blackStar.NWID'

	create-glyph 'notdivides' 0x2224 : glyph-proc
		include : refer-glyph 'stile'
		include : dispiro
			widths.center NotGlyphSw
			flat [mix SB RightSB 0.1] [mix SymbolMid TackBot 0.5]
			curl [mix SB RightSB 0.9] [mix SymbolMid TackTop 0.5]

	create-glyph 'notparallel' 0x2226 : glyph-proc
		include : refer-glyph 'parallel'
		include : dispiro
			widths.center NotGlyphSw
			flat SB [mix SymbolMid TackBot 0.5]
			curl RightSB [mix SymbolMid TackTop 0.5]

	WithDotVariants 'barWithDot' 0x237F : function [DrawAt kr ov] : glyph-proc
		include : refer-glyph 'stile'
		include : DrawAt Middle SymbolMid (PeriodRadius * kr - ov)

	create-glyph 'barStroke' 0x27CA : glyph-proc
		include : refer-glyph 'stile'
		include : HBar.m [mix SB RightSB 0.1] [mix SB RightSB 0.9] SymbolMid OverlayStroke

	create-glyph 'revnotdivides' 0x2AEE : glyph-proc
		include : refer-glyph 'stile'
		include : dispiro
			widths.center NotGlyphSw
			flat [mix SB RightSB 0.1] [mix SymbolMid TackTop 0.5]
			curl [mix SB RightSB 0.9] [mix SymbolMid TackBot 0.5]

	create-glyph 'doubleBarStroke' 0x2AF2 : glyph-proc
		include : refer-glyph 'parallel'
		include : HBar.m SB RightSB SymbolMid OverlayStroke

	create-glyph 'doubleBarTilde' 0x2AF3 : composite-proc
		refer-glyph 'parallel'
		refer-glyph 'sym'

	create-glyph 'tripleBarStroke' 0x2AF5 : glyph-proc
		include : refer-glyph 'interleave'
		include : HBar.m [mix SB 0 0.5] [mix RightSB Width 0.5] SymbolMid OverlayStroke

	create-glyph 'sqrt' 0x221A : glyph-proc
		include : dispiro
			widths.center OperatorStroke
			flat SB [mix ParenBot ParenTop 0.45]
			curl Middle ParenBot [heading Downward]
		include : dispiro
			widths.center OperatorStroke
			flat Width ParenTop
			curl Middle ParenBot [heading Downward]
