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

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

glyph-module

glyph-block Symbol-Pictograph-Astronomy : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives
	glyph-block-import Symbol-Arrow-Shared : ArrowShape

	do
		local obot : PictTop - RightSB + SB

		create-glyph 'neuter' 0x26B2 : glyph-proc
			include : OShape PictTop obot SB RightSB OperatorStroke
			include : VBar.m Middle PictBot obot OperatorStroke

		create-glyph 'venus' 0x2640 : glyph-proc
			include : refer-glyph 'neuter'
			include : HBar.m SB RightSB [mix PictBot (obot + OperatorStroke) 0.5] OperatorStroke

	turned 'earth' 0x2641 'venus' Middle SymbolMid

	create-glyph 'mercury' 0x263F : glyph-proc
		include : refer-glyph 'venus'
		local ext : (RightSB - SB) / 2
		include : ApparentTranslate 0 (-ext / 2)
		local otop : PictTop - ext / 2 - OperatorStroke / 4
		include : dispiro
			g4.down.start (SB + OX) (otop + ext - O) [widths.lhs.heading OperatorStroke Downward]
			arcvh
			g4.right.mid Middle (otop + O) [heading Rightward]
			archv
			g4.up.end (RightSB - OX) (otop + ext - O) [heading Upward]

	create-glyph 'mars' 0x2642 : glyph-proc
		local otop : PictBot + RightSB - SB
		include : OShape otop PictBot SB RightSB OperatorStroke
		include : ArrowShape Middle (otop - OperatorStroke / 3) Middle PictTop ((RightSB - SB) * 0.4)
