###### Letter-like symbols

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

import [mix linreg clamp fallback] from '../support/utils'
import [designParameters] from '../meta/aesthetics'

export : define [apply] : begin
	glyph-module-entry commonShapes overmarks letterBasic

	### Currency
	sketch # currency
		local sw : adviceBlackness 3.5
		local radius : (RIGHTSB - SB) / 2
		include : OShape (parenMid + radius * 0.9) (parenMid - radius * 0.9) (MIDDLE - radius * 0.9) (MIDDLE + radius * 0.9) sw
		foreach j [range 0 4] : begin
			local angle : Math.PI * (j / 2 + 1 / 4)
			include : dispiro
				widths.center sw
				flat (MIDDLE + radius * 0.87 * [Math.cos angle]) (parenMid + radius * 0.87 * [Math.sin angle])
				curl (MIDDLE + radius * [Math.sqrt 2] * [Math.cos angle]) (parenMid + radius * [Math.sqrt 2] * [Math.sin angle])
		save 'currency' 0xA4
	
	sketch # dollar
		include markset.capital
		define top : CAP * 0.95
		define bot : CAP * 0.05
		define smooth : adviceSSmooth (top - bot) (-1)
		include : dispiro
			widths.lhs
			g4   RIGHTSB (top - HOOK)
			hookstart (top - O)
			g4   SB (top - smooth)
			alsothru 0.5 0.5 [widths (ESS / 2) (ESS / 2)]
			g4   RIGHTSB (bot + smooth) [widths 0 STROKE]
			hookend (bot + O)
			g4   SB (bot + HOOK)
		include : dispiro
			widths.center
			flat MIDDLE (top - HALFSTROKE)
			curl MIDDLE (CAP - DESCENDER / 2) [heading UPWARD]
		include : dispiro
			widths.center
			flat MIDDLE (DESCENDER / 2) [heading UPWARD]
			curl MIDDLE (bot + HALFSTROKE)
		save 'dollar' '$'

	sketch # euro
		include glyphs.C
		include : HOverlayBar [mix SB 0 0.7] [mix SB RIGHTSB 0.7] (CAP * 0.4)
		include : HOverlayBar [mix SB 0 0.7] [mix SB RIGHTSB 0.7] (CAP * 0.6)
		save 'euro' 0x20AC
	
	sketch # cent
		include glyphs.c AS_BASE
		include : dispiro
			widths.center
			flat MIDDLE (XH - HALFSTROKE)
			curl MIDDLE (XH - DESCENDER / 2) [heading UPWARD]
		include : dispiro
			widths.center
			flat MIDDLE (DESCENDER / 2) [heading UPWARD]
			curl MIDDLE HALFSTROKE
		save 'cent' 0xA2
	
	sketch # yen
		include glyphs.Y AS_BASE
		include : HOverlayBar SB RIGHTSB (CAP * 0.45)
		include : HOverlayBar SB RIGHTSB (CAP * 0.25)
		save 'yen' 0xA5
	
	sketch # sterlingbase
		include : dispiro
			widths.lhs
			g4 [mix SB RIGHTSB 0.95] (CAP - HOOK * 0.85)
			hookstart (CAP - O) true
			flat [mix SB RIGHTSB 0.2] [CAP - SMOOTHA]
			curl [mix SB RIGHTSB 0.2] [mix STROKE CAP 0.3]
			g4   SB STROKE
		include : HBarBottom SB RIGHTSB 0
		save 'sterlingbase'

	sketch # sterling
		set-width WIDTH
		include glyphs.sterlingbase
		include : HOverlayBar [mix SB RIGHTSB 0.05] [mix SB RIGHTSB 0.7] (CAP * 0.53)
		save 'sterling' 0xA3
	
	sketch # liraSymbol
		set-width WIDTH
		include glyphs.sterlingbase
		include : HOverlayBar [mix SB RIGHTSB 0.05] [mix SB RIGHTSB 0.7] (CAP * 0.4)
		include : HOverlayBar [mix SB RIGHTSB 0.05] [mix SB RIGHTSB 0.7] (CAP * 0.63)
		save 'liraSymbol' 0x20A4
	
	sketch # won
		include glyphs.W AS_BASE
		include : HOverlayBar [mix SB 0 0.7] [mix RIGHTSB WIDTH 0.7] (CAP * 0.6)
		include : HOverlayBar [mix SB 0 0.7] [mix RIGHTSB WIDTH 0.7] (CAP * 0.35)
		save 'won' 0x20A9
	
	sketch # frenchFranc
		include glyphs.F
		include : HOverlayBar (SB * 0.5) (SB * 3 + STROKE * HVCONTRAST) [mix 0 XH 0.4]
		save 'frenchFranc' 0x20A3

	### 'Letterlike Symbols'
	sketch # numero
		local fine : adviceBlackness 4.5
		include : OShape XH [Math.max (fine * 2) (CAP * 0.1)] (MIDDLE + [Math.max (fine / 2) ((RIGHTSB - SB) * 0.1)]) [mix RIGHTSB WIDTH 0.5] fine (SMOOTHA * fine / STROKE) (SMOOTHB * fine / STROKE)
		include : NShape CAP (SB / 2) MIDDLE 4.5 5.5 0.7
		include : HBarBottom (MIDDLE + fine / 2) [mix RIGHTSB WIDTH 0.5] 0 fine
	
		save 'numero' 0x2116
	alias 'Ohm' 0x2126 'Omega'
	turned 'Mho' 0x2127 'Ohm' MIDDLE (CAP / 2)
	
	sketch # ell
		include markset.b
		local fine : adviceBlackness 3.5
		local radius : Math.max fine (WIDTH * 0.15)
		local middle : MIDDLE - fine / 2
		local left : middle - radius * 1.25
		local right : middle + radius * 1.5
		local sma : SMOOTHA * 0.6
		local smb : SMOOTHB * 0.6
		include : dispiro
			widths.center fine
			g2   left [mix 0 CAP 0.33]
			quadcontrols 1 0.6
			g2   right [mix 0 CAP 0.8]
			arcvh
			g2   [mix middle right 0.5] (CAPO - fine / 2)
			archv
			flat middle (CAP - sma)
			curl middle (SMOOTHB * 0.5 + fine / 2)
			hookend (O + fine / 2)
			g2   (middle + radius * 2) SHOOK
	
		save 'ell' 0x2113
	
	sketch # estimated
		include : SmallEShape CAP [adviceBlackness 4] 0.5
		save 'estimated' 0x212E

	turned 'turniota' 0x2129 'iota' MIDDLE (XH / 2)