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

glyph-module

import [mix slY] from "@iosevka/util"

glyph-block LetterLike-Fraktur-Lower-D : begin
	glyph-block-import Common-Derivatives
	glyph-block-import CommonShapes
	glyph-block-import LetterLike-Fraktur-Common : LowerDf S F T fraktur-stroke change-pen
	glyph-block-import LetterLike-Fraktur-Common : DecoSizeX DecoSizeY SlopeA SlopeB
	glyph-block-import LetterLike-Fraktur-Common : Wave FHook PHexTop PHexBot

	create-glyph "frak/d" 0x1D521 : glyph-proc
		local df : include : LowerDf 1
		include : df.markSet.b

		local oBox : S.box XH 0 df.leftSB df.rightSB
		local dBox : S.box Ascender 0 df.leftSB df.rightSB

		include : lift-@ : fraktur-stroke S
			corner             (@xT = [oBox.xp PHexTop]) (@yT = oBox.top)
			corner             (@xL = oBox.left)         [slY @xT @yT @xL SlopeA]
			corner              @xL                      [slY @xB @yB @xL SlopeB]
			corner             (@xB = [oBox.xp PHexBot]) (@yB = oBox.bot)
			straight.up.mid    (oBox.right - OX)          oBox.yMid
			[g4.sl SlopeB].mid  @xT                       @yT
			g2                  @xL                      [slY @xT @yT @xL SlopeB]
			[g2.sr SlopeA].end [oBox.xp 0.25]             dBox.top                 [change-pen T]
