### Punctuation symbols
$$include '../../meta/macros.ptl'

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

glyph-module

glyph-block Symbol-Punctuation-Guillemet : begin
	glyph-block-import CommonShapes
	glyph-block-import Common-Derivatives

	define guilTop : mix SymbolMid ParenTop 0.5
	define guilBot : mix SymbolMid ParenBot 0.5
	define extension 0.55
	define guilLeft  : mix Middle SB extension
	define guilRight : mix Middle RightSB extension

	create-glyph 'singleGuillemetLeft.straight' : glyph-proc
		local extension 0.55

		local sw : AdviceStroke 3
		local fine : AdviceStroke 4

		include : intersection
			MaskAboveLine guilLeft SymbolMid guilRight [mix SymbolMid guilBot 0.5] 2
			dispiro
				flat guilLeft  SymbolMid [widths.rhs sw]
				curl guilRight guilTop [widths.center fine]
		include : intersection
			MaskBelowLine guilLeft SymbolMid guilRight [mix SymbolMid guilTop 0.5] 2
			dispiro
				flat guilLeft  SymbolMid [widths.lhs sw]
				curl guilRight guilBot [widths.center fine]

		include : Translate (-(RightSB - SB) * 0.05) 0

	create-glyph 'singleGuillemetLeft.curly' : glyph-proc
		local extension 0.55

		local sw : AdviceStroke 3
		local fine : AdviceStroke 4

		include : intersection
			MaskAboveLine guilLeft SymbolMid guilRight [mix SymbolMid guilBot 0.5] 2
			dispiro
				g4 guilLeft  (SymbolMid + sw * 0.25) [widths.rhs sw]
				quadControls 0.6 0.3
				g4 guilRight guilTop [widths.center fine]
		include : intersection
			MaskBelowLine guilLeft SymbolMid guilRight [mix SymbolMid guilTop 0.5] 2
			dispiro
				g4 guilLeft  (SymbolMid - sw * 0.25) [widths.lhs sw]
				quadControls 0.6 0.3
				g4 guilRight guilBot [widths.center fine]
		include : VBar.l guilLeft (SymbolMid - sw * 0.25) (SymbolMid + sw * 0.25) sw

		include : Translate (-(RightSB - SB) * 0.05) 0

	select-variant 'singleGuillemetLeft' 0x2039 (follow -- 'guillemet')

	derive-glyphs 'guillemetLeft' 0xAB 'singleGuillemetLeft' : function [src sel] : glyph-proc
		include : refer-glyph src
		include : Translate ((RightSB - SB) * 0.5) 0
		include : refer-glyph src
		include : Translate (-(RightSB - SB) * 0.25) 0

	turned 'singleGuillemetRight' 0x203A "singleGuillemetLeft" Middle SymbolMid
	turned 'guillemetRight' 0xBB "guillemetLeft" Middle SymbolMid
