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

import [mix linreg clamp fallback] from "@iosevka/util"
import as Gr from "@iosevka/glyph/relation"

glyph-module

glyph-block Symbol-Mosaic-Inverted : for-width-kinds WideWidth1
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives

	define MosaicTop    fontMetrics.os2.sTypoAscender
	define MosaicBottom fontMetrics.os2.sTypoDescender

	create-glyph [MangleName : NameUni 0x25D8] [MangleUnicode 0x25D8] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName 'blackCircle'

	create-glyph [MangleName : NameUni 0x25DA] [MangleUnicode 0x25DA] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2580
			refer-glyph : MangleName 'whiteCircle'

	create-glyph [MangleName : NameUni 0x25DB] [MangleUnicode 0x25DB] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2584
			refer-glyph : MangleName 'whiteCircle'

	create-glyph [MangleName : NameUni 0x25D9] [MangleUnicode 0x25D9] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName 'whiteCircle'

	create-glyph [MangleName 'negBlackDiamond'] [MangleUnicode 0x1CC8D] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName 'blackDiamond'

	# create-glyph [MangleName 'negBlackDiamond.mosc'] : glyph-proc
	# 	set-width MosaicWidth
	# 	include : ForceUpright
	# 	include : difference
	# 		refer-glyph : MangleName : NameUni 0x2588
	# 		refer-glyph : MangleName 'blockMosaicSmooth22/2486'
	# Gr.linkSingleGlyphPairGr glyphStore [MangleName 'negBlackDiamond'] [MangleName 'negBlackDiamond.mosc'] Gr.MosaicForm

	create-glyph [MangleName : NameUni 0x1CC8E] [MangleUnicode 0x1CC8E] : glyph-proc
		set-width MosaicWidth
		include : refer-glyph : MangleName : NameUni 0x1FB7D
		include : with-transform [ApparentTranslate (MosaicWidth / 16) ((MosaicBottom - MosaicTop) / 16)] : refer-glyph : MangleName 'blackSmallSquare'

	create-glyph [MangleName : NameUni 0x1CC8F] [MangleUnicode 0x1CC8F] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			with-transform [ApparentTranslate (MosaicWidth / 16) ((MosaicBottom - MosaicTop) / 16)] : refer-glyph : MangleName 'blackSmallSquare'

	create-glyph [MangleName : NameUni 0x1F8B4] [MangleUnicode 0x1F8B4] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName 'arrowLeft'

	create-glyph [MangleName : NameUni 0x1F8B5] [MangleUnicode 0x1F8B5] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName 'arrowUp'

	create-glyph [MangleName : NameUni 0x1F8B6] [MangleUnicode 0x1F8B6] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName 'arrowRight'

	create-glyph [MangleName : NameUni 0x1F8B7] [MangleUnicode 0x1F8B7] : glyph-proc
		set-width MosaicWidth
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName 'arrowDown'

glyph-block Symbol-Mosaic-Inverted-Box-Drawing : for-width-kinds WideWidth4
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives

	define MosaicTop    fontMetrics.os2.sTypoAscender
	define MosaicBottom fontMetrics.os2.sTypoDescender

	create-glyph [MangleName : NameUni 0x1FBBD] [MangleUnicode 0x1FBBD] : glyph-proc
		set-width MosaicWidth
		include : ForceUpright
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName : NameUni 0x2573

	create-glyph [MangleName : NameUni 0x1FBBE] [MangleUnicode 0x1FBBE] : glyph-proc
		set-width MosaicWidth
		include : ForceUpright
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName : NameUni 0x1FBA3

	create-glyph [MangleName : NameUni 0x1FBBF] [MangleUnicode 0x1FBBF] : glyph-proc
		set-width MosaicWidth
		include : ForceUpright
		include : difference
			refer-glyph : MangleName : NameUni 0x2588
			refer-glyph : MangleName : NameUni 0x1FBAE
