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

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

glyph-module

glyph-block Symbol-Pictograph-Kome : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives

	for-width-kinds WideWidth1 "Kome"
		WithDotVariants [MangleName 'kome'] [MangleUnicode 0x203B] : function [DrawAt kdr ov]
			glyph-proc
				set-width MosaicWidth
				local sw : AdviceStroke 3.75
				local shapeSize : Math.min (MosaicWidth / 2 - SB) ((ParenTop - ParenBot) / 2)
				include : dispiro
					widths.center sw
					flat (MosaicWidth / 2 - shapeSize) (SymbolMid - shapeSize)
					curl (MosaicWidth / 2 + shapeSize) (SymbolMid + shapeSize)

				include : dispiro
					widths.center sw
					flat (MosaicWidth / 2 + shapeSize) (SymbolMid - shapeSize)
					curl (MosaicWidth / 2 - shapeSize) (SymbolMid + shapeSize)

				local r0 : Math.min
					(RightSB - SB + (sw * Math.SQRT1_2) - sw * 3) / 4
					DotRadius * kdr
				local r  : shapeSize - r0 + (sw / 2 * Math.SQRT1_2)

				include : DrawAt (MosaicWidth / 2 + r) SymbolMid (r0 - ov)
				include : DrawAt (MosaicWidth / 2 - r) SymbolMid (r0 - ov)
				include : DrawAt (MosaicWidth / 2) (SymbolMid + r) (r0 - ov)
				include : DrawAt (MosaicWidth / 2) (SymbolMid - r) (r0 - ov)
