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

glyph-module

glyph-block LetterLike-Fraktur-Upper-IJ : begin
	glyph-block-import Common-Derivatives
	glyph-block-import CommonShapes
	glyph-block-import LetterLike-Fraktur-Common : UpperDf 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

	define [TopStroke df] : glyph-proc
		local iBox : S.box CAP 0 df.leftSB df.rightSB
		include : lift-@ : fraktur-stroke S
			g2.ld.start iBox.right         (@yT = iBox.top)
			~~~ [Wave.h O]
			g2.ld.end   (@xL = iBox.left)  (@yT - Wave.DepthY) [change-pen F]
			~~~ [Wave.vc (-Wave.DepthX)]
			g2.ld.end    @xL               ([iBox.yp 0.625] - 2 * F.thick)

	define [BottomStroke df bot archScalar] : glyph-proc
		local gap : 2.5 * Wave.DepthY + 1 * S.thick
		local jBox : S.box [S.yt (CAP - gap)] bot df.leftSB df.rightSB
		local ada1 : 0.6 * archScalar * ArchDepthA
		local ada2 : archScalar * ArchDepthA
		include : lift-@ : fraktur-stroke S
			g4        [T.connR S jBox.right]    (@yT - FHook) [change-pen T]
			hookstart (sw -- S.thick)           (@yT = [T.connT S jBox.top])
			g4        ([jBox.xp 0.6] - S.thick) (jBox.top - ada1) [change-pen S]
			g4        (jBox.right - OX)         (jBox.bot + ada2)
			hookend (sw -- S.thick)             (@yB = jBox.bot)
			g2        jBox.left                 (@yB + SHook)

	create-glyph "frak/I" 0x2111 : glyph-proc
		local df : include : UpperDf 1
		include : df.markSet.capital

		include : TopStroke df
		include : BottomStroke df 0 0.75

	create-glyph "frak/J" 0x1D50D : glyph-proc
		local df : include : UpperDf 1
		include : df.markSet.capDesc

		include : TopStroke df
		include : BottomStroke df Descender 1
