Iosevka/glyphs/symbol-math.ptl

358 lines
12 KiB
Plaintext

###### Mathematical 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 letterExt
### Letter-like
sketch # micro
include glyphs.mu AS_BASE
if SLAB : if (!para.isItalic) : begin
include : CenterBottomSerif (SB + HALFSTROKE * HVCONTRAST) DESCENDER JUT
tag-contour 'serifLB'
save 'micro' 0xB5
sketch # forall
include : LambdaShape OPERATORSTROKE
eject-contour 'serif'
include : HBar (SB + OPERATORSTROKE) (RIGHTSB - OPERATORSTROKE) (XH / 2) OPERATORSTROKE
include : FlipAround MIDDLE (CAP / 2)
save 'forall' 0x2200
sketch # exists
include : HBarTop (SB * 1.5 - O) RIGHTSB CAP OPERATORSTROKE
include : HBarBottom (SB * 1.5 - O) RIGHTSB 0 OPERATORSTROKE
include : HBar (SB * 1.5 - O) (RIGHTSB - HALFSTROKE) (CAP * 0.5) OPERATORSTROKE
include : VBarLeft (SB * 1.5) 0 CAP OPERATORSTROKE
include : FlipAround MIDDLE (CAP / 2)
save 'exists' 0x2203
sketch # emptyset
include : OShape CAP 0 SB RIGHTSB OPERATORSTROKE
local fine : OPERATORSTROKE / 2
include : dispiro
widths.center OPERATORSTROKE
flat (SB + O + fine) [mix CAP 0 1.05]
curl (RIGHTSB - O - fine) [mix 0 CAP 1.05]
save 'emptyset' 0x2205
sketch # increment
include : LambdaShape OPERATORSTROKE
eject-contour 'serif'
include : HBarBottom (SB + (OPERATORSTROKE / 2)) (RIGHTSB - (OPERATORSTROKE / 2)) 0 OPERATORSTROKE
save 'increment' 0x2206
turned 'nabla' 0x2207 'increment' MIDDLE (CAP / 2)
if [not recursive] : let [s : (RIGHTSB - SB - O * 4 + (FULLWIDTH - WIDTH) * 0.5) / CAP] : let [df : Miniature (glyphs -- {'eight' 'rotetedpropto'}) (crowd -- 4) (scale -- s) (slantAngle -- 0)] : begin
sketch # infty
set-width FULLWIDTH
include df.eight
apply-transform : Translate (-MIDDLE) (-CAP / 2)
apply-transform : Rotate (Math.PI / 2)
apply-transform : Scale s
apply-transform : Translate FWMIDDLE parenMid
apply-transform : Italify
save 'infty' 0x221E
sketch # propto
set-width FULLWIDTH
include df.rotetedpropto
apply-transform : Translate (-MIDDLE) (-CAP / 2)
apply-transform : Rotate (Math.PI / 2)
apply-transform : Scale s
apply-transform : Translate FWMIDDLE parenMid
apply-transform : Italify
save 'propto' 0x221D
sketch # partial
include markset.b
include : OShape (CAP * 0.65) 0 SB RIGHTSB OPERATORSTROKE
include : dispiro
widths.lhs OPERATORSTROKE
flat (RIGHTSB - OX) SMALLSMOOTHA
curl (RIGHTSB - OX) (CAP - SMALLSMOOTHB)
hookend CAPO
g4 SB (CAP - HOOK)
save 'partial' 0x2202
### Mathematical Operators
sketch # mathO
local sw OPERATORSTROKE
local k 1
include : OShape (parenMid + (RIGHTSB - SB) * 0.5 + sw * k) (parenMid - (RIGHTSB - SB) * 0.5 - sw * k) (SB - sw * k) (RIGHTSB + sw * k) sw (SMALLSMOOTHA * 3) (SMALLSMOOTHB * 3)
save 'mathO'
sketch # plus
include : HBar SB RIGHTSB parenMid OPERATORSTROKE
include : VBar MIDDLE (parenMid - (RIGHTSB - SB) * 0.55) (parenMid + (RIGHTSB - SB) * 0.55) OPERATORSTROKE
save 'plus' '+'
sketch # minus
include : HBar SB RIGHTSB parenMid OPERATORSTROKE
save 'minus' 0x2212
sketch # plusminus
include : HBarBottom SB RIGHTSB 0 OPERATORSTROKE
include glyphs.plus
save 'plusminus' 0xB1
turned 'minusplus' 0x2213 'plusminus' MIDDLE parenMid
local equalHalfSpace : (parenTop - parenBot) * designParameters.equal_wideness
sketch # equal
include : HBar SB RIGHTSB (parenMid + equalHalfSpace) OPERATORSTROKE
include : HBar SB RIGHTSB (parenMid - equalHalfSpace) OPERATORSTROKE
save 'equal' '='
sketch # less
local top : mix parenMid parenTop 0.5
local bot : mix parenMid parenBot 0.5
local exp : Math.sqrt : 1 + (top - bot) / (2 * (RIGHTSB - SB)) * (top - bot) / (2 * (RIGHTSB - SB))
include : dispiro
widths.center OPERATORSTROKE
flat RIGHTSB top
curl SB [mix top bot 0.5] [widths.heading (OPERATORSTROKE / 2 * exp) (OPERATORSTROKE / 2 * exp) LEFTWARD]
include : dispiro
widths.center OPERATORSTROKE
flat RIGHTSB bot
curl SB [mix top bot 0.5] [widths.heading (OPERATORSTROKE / 2 * exp) (OPERATORSTROKE / 2 * exp) LEFTWARD]
save 'less' '<'
sketch # greater
local top : mix 0 CAP 0.75
local bot : mix 0 CAP 0.1
include glyphs.less
include : FlipAround MIDDLE parenMid
save 'greater' '>'
sketch # multiply
local radius : (RIGHTSB - SB) / 2
include : dispiro
widths.center OPERATORSTROKE
flat (MIDDLE - radius) (parenMid - radius)
curl (MIDDLE + radius) (parenMid + radius)
include : dispiro
widths.center OPERATORSTROKE
flat (MIDDLE + radius) (parenMid - radius)
curl (MIDDLE - radius) (parenMid + radius)
save 'multiply' 0xD7
sketch # divide
include glyphs.minus
local radius : (RIGHTSB - SB) / 2
include : Ring (parenMid + radius + DOTRADIUS) (parenMid + radius - DOTRADIUS) (MIDDLE - DOTRADIUS + O) (MIDDLE + DOTRADIUS - O) true
include : Ring (parenMid - radius + DOTRADIUS) (parenMid - radius - DOTRADIUS) (MIDDLE - DOTRADIUS + O) (MIDDLE + DOTRADIUS - O) true
save 'divide' 0xF7
composite 'mathAsterisk' glyphs.'smallasterisk.low' [into-unicode 0x2217]
composite 'oplus' glyphs.mathO glyphs.plus [into-unicode 0x2295]
composite 'ominus' glyphs.mathO glyphs.minus [into-unicode 0x2296]
composite 'oasterisk' glyphs.mathO glyphs.mathAsterisk [into-unicode 0x229B]
sketch # negate
include glyphs.minus
include : VBarRight RIGHTSB (parenMid - (RIGHTSB - SB) * 0.55) parenMid OPERATORSTROKE
save 'negate' 0xAC
sketch # vee
include : dispiro
widths.center OPERATORSTROKE
flat SB operTop
curl MIDDLE operBot [heading DOWNWARD]
include : dispiro
widths.center OPERATORSTROKE
flat RIGHTSB operTop
curl MIDDLE operBot [heading DOWNWARD]
save 'vee' 0x2228
turned 'wedge' 0x2227 'vee' MIDDLE parenMid
sketch # cup
include : UShape operTop operBot OPERATORSTROKE true
save 'cup' 0x222A
turned 'cap' 0x2229 'cup' MIDDLE parenMid
sketch # lesseq
local fine : Math.max [adviceBlackness 4] (XH * 0.1)
local top : [mix parenMid parenTop 0.5] - fine
local bot : [mix parenMid parenBot 0.5] + fine
include : dispiro
widths.center OPERATORSTROKE
flat RIGHTSB (top + fine)
curl SB ([mix top bot 0.5] + fine) [heading LEFTWARD]
include : dispiro
widths.center OPERATORSTROKE
flat SB ([mix top bot 0.5] + fine) [heading RIGHTWARD]
curl RIGHTSB (bot + fine)
branch
include : HBar SB RIGHTSB (bot - fine) OPERATORSTROKE
save 'lesseq' 0x2264
branch
include : dispiro
widths.center OPERATORSTROKE
flat SB ([mix top bot 0.5] - fine) [heading RIGHTWARD]
curl RIGHTSB (bot - fine)
save 'lesseqslant' 0x2A7D
sketch # greatereq
local fine : Math.max [adviceBlackness 4] (XH * 0.1)
local top : [mix parenMid parenTop 0.5] - fine
local bot : [mix parenMid parenBot 0.5] + fine
include : dispiro
widths.center OPERATORSTROKE
flat SB (top + fine)
curl RIGHTSB ([mix top bot 0.5] + fine) [heading RIGHTWARD]
include : dispiro
widths.center OPERATORSTROKE
flat RIGHTSB ([mix top bot 0.5] + fine) [heading LEFTWARD]
curl SB (bot + fine)
branch
include : HBar SB RIGHTSB (bot - fine) OPERATORSTROKE
save 'greatereq' 0x2265
branch
include : dispiro
widths.center OPERATORSTROKE
flat RIGHTSB ([mix top bot 0.5] - fine) [heading LEFTWARD]
curl SB (bot - fine)
save 'greatereqslant' 0x2A7E
sketch # subst
local top : mix parenMid parenTop 0.5
local bot : mix parenMid parenBot 0.5
include : dispiro
widths.lhs OPERATORSTROKE
flat RIGHTSB top [heading LEFTWARD]
curl (SB + (top - bot) / 2) top
archv
g4 SB parenMid
arcvh
flat (SB + (top - bot) / 2) bot
curl RIGHTSB bot [heading RIGHTWARD]
save 'subst' 0x2282
sketch # element
include glyphs.subst
include : HBar (SB + HALFSTROKE) RIGHTSB parenMid OPERATORSTROKE
save 'element' 0x2208
turned nothing 0x2283 'subst' MIDDLE parenMid
turned nothing 0x220B 'element' MIDDLE parenMid
sketch # sym
include : WaveShape
l -- SB
r -- RIGHTSB
cy -- parenMid
extendy -- ((operTop - parenMid) * 0.17)
tension -- 0.15
sw -- OPERATORSTROKE
save 'sym' 0x223C
sketch # ident
include : HBar SB RIGHTSB (parenMid + equalHalfSpace * 1.5) OPERATORSTROKE
include : HBar SB RIGHTSB parenMid OPERATORSTROKE
include : HBar SB RIGHTSB (parenMid - equalHalfSpace * 1.5) OPERATORSTROKE
save 'ident' 0x2261
vdual 'approx' 0x2248 'sym' (equalHalfSpace * 1.75)
### 'Negative Operators'
define [notGlyph newid unicode oldid top bot prop shift] : create-glyph [fallback newid : 'not' + oldid] : glyph-construction
assign-unicode unicode
include glyphs.(oldid)
include : dispiro
widths.center OPERATORSTROKE
flat ([fallback shift 0] + [mix SB RIGHTSB [fallback prop 0.25]]) [fallback bot operBot]
curl ([fallback shift 0] + [mix RIGHTSB SB [fallback prop 0.25]]) [fallback top operTop]
define [notGlyph.right newid unicode oldid top bot prop shift] : notGlyph newid unicode oldid top bot prop (-OPERATORSTROKE * 0.5)
define [notGlyph.left newid unicode oldid top bot prop shift] : notGlyph newid unicode oldid top bot prop (OPERATORSTROKE * 0.5)
notGlyph 'noteq' 0x2260 'equal'
notGlyph 'notident' 0x2262 'ident'
notGlyph.left 'notless' 0x226E 'less'
notGlyph.right 'notgreater' 0x226F 'greater'
notGlyph 'notapprox' 0x2249 'approx' [mix parenMid operTop 0.75] [mix parenMid operBot 0.75]
notGlyph 'notsym' 0x2241 'sym' [mix parenMid operTop 0.75] [mix parenMid operBot 0.75]
notGlyph.left 'notsubst' 0x2284 'subst'
notGlyph.right 'notturnsubst' 0x2285 'turnsubst'
notGlyph.left 'notelement' 0x2209 'element'
notGlyph.right 'notturnelement' 0x220C 'turnelement'
notGlyph.left 'notlesseq' 0x2270 'lesseq'
notGlyph.right 'notgreatereq' 0x2271 'greatereq'
notGlyph.right 'nonexist' 0x2204 'exists' (CAP - DESCENDER / 2) (DESCENDER / 2) 0.4
### 'Large Operators'
sketch # sum
include : SigmaShape parenTop parenBot OPERATORSTROKE
save 'sum' 0x2211
sketch # product
include : PiShape parenTop parenBot (shrinkrate -- 0) (_fine -- OPERATORSTROKE)
save 'product' 0x220F
turned 'coproduct' 0x2210 'product' MIDDLE parenMid
sketch # integrate
include : LongSShape parenTop parenBot HOOK (HOOK * 0.75) OPERATORSTROKE
save 'integrate' 0x222B
dual 'doubleintegrate' 0x222C 'integrate' (0.5 * WIDTH)
sketch # ringintegrate
include glyphs.integrate
include : OShape (parenMid + (RIGHTSB - SB) / 2) (parenMid - (RIGHTSB - SB) / 2) SB RIGHTSB OPERATORSTROKE
save 'ringintegrate' 0x222E
sketch # Vee
include : dispiro
widths.center OPERATORSTROKE
flat SB parenTop
curl MIDDLE parenBot [heading DOWNWARD]
include : dispiro
widths.center OPERATORSTROKE
flat RIGHTSB parenTop
curl MIDDLE parenBot [heading DOWNWARD]
save 'Vee' 0x22C1
turned 'Wedge' 0x22C0 'Vee' MIDDLE parenMid
sketch # Cup
include : UShape parenTop parenBot OPERATORSTROKE true
save 'Cup' 0x22C3
turned 'Cap' 0x22C2 'Cup' MIDDLE parenMid
### Others
alias 'mathbullet' 0x2219 'bullet'
sketch # sqrt
include : dispiro
widths.center OPERATORSTROKE
flat SB [mix parenBot parenTop 0.45]
curl MIDDLE parenBot [heading DOWNWARD]
include : dispiro
widths.center OPERATORSTROKE
flat WIDTH parenTop
curl MIDDLE parenBot [heading DOWNWARD]
save 'sqrt' 0x221A