Iosevka/glyphs/symbol-other.ptl

342 lines
12 KiB
Plaintext

###### Other 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 geometricSymbols
### # IPA tonal marks
### symbol-block 'Phonetic Symbols'
local triangleSize : Math.min (PERIODRADIUS) (XH / 5)
sketch # trianglecolon
start-from (MIDDLE - triangleSize * 1.35) XH
line-to MIDDLE (XH - triangleSize * 2.75)
line-to (MIDDLE + triangleSize * 1.35) XH
start-from (MIDDLE - triangleSize * 1.35) 0
line-to MIDDLE (0 + triangleSize * 2.75)
line-to (MIDDLE + triangleSize * 1.35) 0
save 'trianglecolon' 0x2D0
sketch # halftrianglecolon
start-from (MIDDLE - triangleSize * 1.35) XH
line-to MIDDLE (XH - triangleSize * 2.75)
line-to (MIDDLE + triangleSize * 1.35) XH
save 'halftrianglecolon' 0x2D1
foreach tone [range 4 downtill 0] : begin
create-glyph ('tone' + tone) : glyph-construction
assign-unicode (0x2E5 + 4 - tone)
include : VBarRight [mix SB RIGHTSB 0.9] 0 CAP OPERATORSTROKE
include : HBar [mix SB RIGHTSB 0.1] ([mix SB RIGHTSB 0.9] - 1) [mix (OPERATORSTROKE / 2) (CAP - OPERATORSTROKE / 2) (tone / 4)] OPERATORSTROKE
### # Suit card
### symbol-block 'Suit Cards'
local heartTop : mix parenMid parenTop 0.6
local heartBot : mix parenMid parenBot 0.6
sketch # heart
local y1 : mix heartBot heartTop 0.5
local y2 : mix heartBot heartTop 0.75
local y3 : mix heartBot heartTop 0.75
include : spiro-outline
corner MIDDLE heartBot
quadcontrols 1 (2 / 3)
g4 (RIGHTSB - O) y2
arcvh
g4 [mix MIDDLE RIGHTSB 0.5] heartTop
archv
corner MIDDLE y3
arcvh
g4 [mix MIDDLE SB 0.5] heartTop
archv
g4 (SB + O) y2
quadcontrols 0 (1 / 3)
close
save 'heart' 0x2665
sketch # spade
include glyphs.heart
apply-transform : Upright
apply-transform : Translate (-MIDDLE) (-heartBot)
apply-transform : Scale 1 (-0.75)
apply-transform : Translate MIDDLE heartTop
apply-transform : Italify
include : HBarBottom [mix SB RIGHTSB 0.25] [mix RIGHTSB SB 0.25] heartBot
include : VBar MIDDLE heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)]
save 'spade' 0x2660
sketch # clubs
local circleRadius : (heartTop - heartBot) * 0.2
include : RingAt MIDDLE (heartTop - circleRadius) circleRadius
include : RingAt (SB + O + circleRadius) [mix heartBot heartTop 0.45] circleRadius
include : RingAt (RIGHTSB - O - circleRadius) [mix heartBot heartTop 0.45] circleRadius
include : HBarBottom [mix SB RIGHTSB 0.25] [mix RIGHTSB SB 0.25] heartBot
include : VBar MIDDLE heartBot [mix heartBot heartTop (1 - 0.75 * 0.75)]
save 'clubs' 0x2663
sketch # diamond
start-from MIDDLE heartTop
line-to RIGHTSB parenMid
line-to MIDDLE heartBot
line-to SB parenMid
save 'diamond' 0x2666
### symbol-block 'Planets'
sketch # venus
local obot : operTop - RIGHTSB + SB
include : OShape operTop obot SB RIGHTSB OPERATORSTROKE
include : VBar MIDDLE operBot obot OPERATORSTROKE
include : HBar SB RIGHTSB [mix operBot (obot + OPERATORSTROKE) 0.5] OPERATORSTROKE
save 'venus' 0x2640
turned 'earth' 0x2641 'venus' MIDDLE parenMid
sketch # mars
local otop : operBot + RIGHTSB - SB
include : OShape otop operBot SB RIGHTSB OPERATORSTROKE
include : ArrowShape MIDDLE (otop - OPERATORSTROKE / 3) MIDDLE operTop ((RIGHTSB - SB) * 0.4)
save 'mars' 0x2642
### symbol-block 'Musical'
sketch # quaver
local fine : adviceBlackness 5
local noteSize : MIDDLE + fine / 2 - SB
local y1 : mix operBot operTop 0.8
local y2 : mix operBot operTop 0.4
local x3 : mix SB RIGHTSB 0.7
local y3 : mix operBot operTop 0.25
include : Ring (operBot + 0.8 * noteSize) operBot SB (SB + noteSize)
include : VBarRight (SB + noteSize) (operBot + 0.4 * noteSize) operTop fine
include : dispiro
widths.rhs fine
g4 (SB + noteSize) operTop
bezcontrols.absolute RIGHTSB y1 RIGHTSB y2
g4 x3 y3
save 'quaver' 0x266A
### symbol-block 'Metric marks'
sketch # metmark
include : VBar MIDDLE (-font.OS_2.usWinDescent) (font.OS_2.usWinAscent) SHOULDERFINE
include : HBar MIDDLE WIDTH 0 SHOULDERFINE
include : HBar MIDDLE WIDTH CAP SHOULDERFINE
include : HBar MIDDLE WIDTH XH SHOULDERFINE
include : HBar MIDDLE WIDTH DESCENDER SHOULDERFINE
include : HBar 0 MIDDLE parenMid SHOULDERFINE
include : HBar 0 MIDDLE parenTop SHOULDERFINE
include : HBar 0 MIDDLE parenBot SHOULDERFINE
save 'metmark' 0xE09F
### symbol-block 'Flags'
local sw [adviceBlackness 4]
local flagDown : 0.07 * (parenTop - parenBot)
local delta 0.01
local curliness 0.9
sketch # Black flag
include : VBarLeft SB operBot (operTop - sw) sw
include : spiro-outline
corner SB operTop
g2 (SB + delta) operTop
alsothru 0.5 (1 - curliness)
g2 MIDDLE (operTop - flagDown / 2)
alsothru 0.5 curliness
g2 (RIGHTSB - delta) (operTop - flagDown)
corner RIGHTSB (operTop - flagDown)
corner RIGHTSB (operMid - flagDown)
g2 (RIGHTSB - delta) (operMid - flagDown)
alsothru 0.5 (1 - curliness)
g2 MIDDLE (operMid - flagDown / 2)
alsothru 0.5 curliness
g2 (SB + delta) operMid
corner SB operMid
close
save 'blackflag' 0x2691
sketch # White flag
include : VBarLeft SB operBot (operTop - sw / 2) sw
include : VBarRight RIGHTSB (operMid - flagDown + sw / 2) (operTop - flagDown) sw
include : dispiro
widths.rhs sw
corner SB operTop [heading RIGHTWARD]
g2 (SB + delta) operTop [heading RIGHTWARD]
alsothru 0.5 (1 - curliness)
g2 MIDDLE (operTop - flagDown / 2)
alsothru 0.5 curliness
g2 (RIGHTSB - delta) (operTop - flagDown) [heading RIGHTWARD]
corner RIGHTSB (operTop - flagDown) [heading RIGHTWARD]
include : dispiro
widths.rhs sw
corner RIGHTSB (operMid - flagDown) [heading LEFTWARD]
g2 (RIGHTSB - delta) (operMid - flagDown) [heading LEFTWARD]
alsothru 0.5 (1 - curliness)
g2 MIDDLE (operMid - flagDown / 2)
alsothru 0.5 curliness
g2 (SB + delta) operMid [heading LEFTWARD]
corner SB operMid [heading LEFTWARD]
save 'whiteflag' 0x2690
### symbol-block 'Other typographic symbols'
sketch # Kome
local sw : adviceBlackness 3.75
local radius : (RIGHTSB - SB) / 2
include : dispiro
widths.center sw
flat (MIDDLE - radius) (parenMid - radius)
curl (MIDDLE + radius) (parenMid + radius)
include : dispiro
widths.center sw
flat (MIDDLE + radius) (parenMid - radius)
curl (MIDDLE - radius) (parenMid + radius)
local r0 : Math.min ((RIGHTSB - SB + (sw / [Math.sqrt 2]) - sw * 3) / 4) DOTRADIUS
local r : radius - r0 + (sw / 2 / [Math.sqrt 2])
include : RingAt (MIDDLE + r) parenMid r0
include : RingAt (MIDDLE - r) parenMid r0
include : RingAt MIDDLE (parenMid + r) r0
include : RingAt MIDDLE (parenMid - r) r0
save 'kome' 0x203B
sketch # bolt
local sw : [adviceBlackness 3.5] / 2
local l : mix SB RIGHTSB 0.1
local r : mix RIGHTSB SB 0.1
start-from [mix l r 0.6] operTop
line-to (l - sw / 2) (operMid - sw)
line-to (r - sw * 2.25) (operMid - sw)
line-to [mix r l 0.6] operBot
line-to (r + sw / 2) (operMid + sw)
line-to (l + sw * 2.25) (operMid + sw)
save 'bolt' 0x26A1
local light : adviceBlackness 4.5
local heavy : Math.max (light * 1.5) (WIDTH * 0.15)
local shapesize 0.8
local shapesizeCheck : shapesize * 1.1
foreach [{gid unicode sw} : items-of {{'lightcheck' 0x2713 light} {'heavycheck' 0x2714 heavy}} ] : sketch
include : dispiro
widths.center sw
g4 SB [mix operMid [mix operBot operTop 0.46] shapesizeCheck]
alsothru 0.5 0.4
g4 [mix SB RIGHTSB 0.4] [mix operMid [mix operBot operTop 0.05] shapesizeCheck] [heading DOWNWARD]
include : dispiro
widths.center sw
g4 [mix SB RIGHTSB 0.4] [mix operMid [mix operBot operTop 0.05] shapesizeCheck] [heading UPWARD]
alsothru 0.5 0.6
g4 RIGHTSB [mix operMid [mix operBot operTop 0.9] shapesizeCheck]
save gid unicode
foreach [{gid unicode sw} : items-of {{'heavygreekcross' 0x271A heavy}} ] : sketch
include : dispiro
widths.center sw
g4 [mix WIDTH RIGHTSB 0.5] operMid
g4 [mix 0 SB 0.5] operMid
include : dispiro
widths.center sw
g4 MIDDLE [mix operMid operTop (0.8 * shapesize * 7/8)]
g4 MIDDLE [mix operMid operBot (0.9 * shapesize * 7/8)]
save gid unicode
foreach [{gid unicode sw} : items-of {{'lightcross' 0x2715 light} {'heavycross' 0x2716 heavy}} ] : sketch
include : dispiro
widths.center sw
g4 RIGHTSB [mix operMid operTop (0.8 * shapesize)]
g4 SB [mix operMid operBot (0.9 * shapesize)]
include : dispiro
widths.center sw
g4 SB [mix operMid operTop (0.8 * shapesize)]
g4 RIGHTSB [mix operMid operBot (0.9 * shapesize)]
save gid unicode
foreach [{gid unicode sw} : items-of {{'lightballotcross' 0x2717 light} {'heavyballotcross' 0x2718 heavy}} ] : sketch
include : dispiro
widths.center sw
g4 RIGHTSB [mix operMid [mix operBot operTop 0.9] shapesize]
alsothru 0.53 0.45
g4 SB [mix operMid operBot (1.05 * shapesize)]
include : dispiro
widths.center sw
g4 [mix SB RIGHTSB 0.1] [mix operMid [mix operBot operTop 0.86] shapesize]
alsothru 0.47 0.5
g4 [mix SB RIGHTSB 0.9] [mix operMid [mix operBot operTop 0.05] shapesize]
save gid unicode
### ### Ligature-orienteds
### symbol-block 'Ligature-oriented Subglyphs' : if (para.spacing > 0) : begin
# Shifted arrowheads
local arrowheadsKern : clamp 0 (WIDTH * 0.4) (WIDTH - OPERATORSTROKE * 3)
sketch
include glyphs.greater AS_BASE ALSO_METRICS
include : Translate arrowheadsKern 0
save 'liggreater.shift1'
include : Translate arrowheadsKern 0
save 'liggreater.shift2'
include : Translate (-arrowheadsKern * 3) 0
save 'liggreater.shiftN1'
sketch
include glyphs.less AS_BASE ALSO_METRICS
include : Translate (-arrowheadsKern) 0
save 'ligless.shift1'
include : Translate (-arrowheadsKern) 0
save 'ligless.shift2'
include : Translate (arrowheadsKern * 3) 0
save 'ligless.shiftN1'
# arrows
# ->
define arrowheadSlope : (RIGHTSB - SB) / (parenTop - parenBot) * 4
define [ArrowBarConfig extend kern join] : let [cleft O] [cright (WIDTH - O)] [arrowr : WIDTH + extend] [arrowl : 0 - extend] : list
list 'fr' SB arrowr
list 'lf' arrowl RIGHTSB
list 'cr' cleft arrowr
list 'lc' arrowl cright
list 'lxc' [mix arrowl 0 0.5] cright
list 'fr1' SB (arrowr + kern)
list 'l1f' (arrowl - kern) RIGHTSB
list 'cr1' cleft (arrowr + kern)
list 'l1c' (arrowl - kern) cright
list 'fr2' SB (arrowr + kern * 2)
list 'l2f' (arrowl - kern * 2) RIGHTSB
list 'cr2' cleft (arrowr + kern * 2)
list 'l2c' (arrowl - kern * 2) cright
list 'cf' cleft RIGHTSB
list 'fc' SB cright
list 'jf' (-join) RIGHTSB
list 'fj' SB (WIDTH + join)
list 'jr' (-join) arrowr
list 'lj' arrowl (WIDTH + join)
list 'j1f' (-join - kern) RIGHTSB
list 'fj1' SB (WIDTH + join + kern)
list 'lr' arrowl arrowr
list 'cc' cleft cright
local arrowextend [clamp 0 WIDTH (RIGHTSB - OPERATORSTROKE / 2 * arrowheadSlope)]
local arrowj : clamp 0 WIDTH (SB + OPERATORSTROKE / 2 * arrowheadSlope)
foreach [{subclass left right} : items-of [ArrowBarConfig arrowextend arrowheadsKern arrowj]] : sketch
include : HBar left right parenMid OPERATORSTROKE
set currentGlyph.cmpPriority (-3)
save ('lighyphen.' + subclass)
# =>
# local dblarrowd : XH * [linreg 18 0.15 126 0.275 STROKE]
# local sw : Math.min OPERATORSTROKE (dblarrowd * [clamp 0.45 0.75 ((1 - WHITENESS) * 1)])
local sw OPERATORSTROKE
local dblarrowd ((parenTop - parenBot) * designParameters.equal_wideness + sw / 2)
local dblextend : clamp 0 WIDTH (RIGHTSB - (dblarrowd - sw / 2) * arrowheadSlope)
local dblarrowj : clamp 0 WIDTH (SB + (dblarrowd - sw / 2) * arrowheadSlope)
foreach [{subclass left right} : items-of [ArrowBarConfig dblextend arrowheadsKern dblarrowj]] : sketch
include : HBarTop left right (parenMid + dblarrowd) sw
include : HBarBottom left right (parenMid - dblarrowd) sw
set currentGlyph.cmpPriority (-3)
save ('ligequal.' + subclass)
sketch
include glyphs.exclam
include : Translate (((RIGHTSB - WIDTH) + (WIDTH - arrowextend / 2)) / 2 - MIDDLE) 0
include : HBar (-arrowextend) (RIGHTSB - WIDTH) parenMid OPERATORSTROKE
save 'ligexclam.htmlcommentstart'