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

import [mix linreg clamp fallback] from "@iosevka/util"
import [IsSuperscript IsSubscript] from "@iosevka/glyph/relation"

glyph-module

glyph-block Letter-Latin-Rhotic : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives
	glyph-block-import Letter-Shared-Shapes : RhoticHookShape

	create-glyph 'rhoticHook' 0x2DE : glyph-proc
		include : RhoticHookShape (-[HSwToV Stroke]) Width (XH / 2) (XH * 0.3) Stroke true

	create-glyph 'rhoticHook/sup' : glyph-proc
		local sw : [AdviceStroke 3.5] / 0.7
		include : RhoticHookShape (-[HSwToV Stroke] - 3 * SB) Width (XH / 2) (XH * 0.3) sw true
		include : Ungizmo
		include : Translate (-Middle) (-CAP)
		include : Scale 0.7
		include : Translate (Middle) (CAP + AccentStackOffset / 2)
		include : Regizmo

		IsSuperscript.set currentGlyph

	create-glyph 'rhoticHook/sub' : glyph-proc
		include [refer-glyph 'rhoticHook/sup'] AS_BASE ALSO_METRICS
		include : ApparentTranslate 0 ((Descender / 2) - (CAP + AccentStackOffset / 2) + 0.7 * CAP)

		IsSubscript.set currentGlyph
