Iosevka/font-src/glyphs/symbol/mosaic.ptl

912 lines
32 KiB
Text

###### Teletext symbols
$$include '../../meta/macros.ptl'
import [mix linreg clamp fallback] from"../../support/utils.mjs"
glyph-module
glyph-block Symbol-Mosaic : begin
if recursive : return nothing
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
define MosaicTop fontMetrics.os2.sTypoAscender
define MosaicBottom fontMetrics.os2.sTypoDescender
for-width-kinds WideWidth4
define top MosaicTop
define bottom MosaicBottom
define left 0
define right MosaicWidth
# Corner numbers
# 1 2 3
# 4 5
# 6 7
# 8 9 0
define [PatternCorner23 bit] : match bit
1 : corner [mix left right (0 / 2)] [mix top bottom (0 / 3)]
2 : corner [mix left right (1 / 2)] [mix top bottom (0 / 3)]
3 : corner [mix left right (2 / 2)] [mix top bottom (0 / 3)]
4 : corner [mix left right (0 / 2)] [mix top bottom (1 / 3)]
5 : corner [mix left right (2 / 2)] [mix top bottom (1 / 3)]
6 : corner [mix left right (0 / 2)] [mix top bottom (2 / 3)]
7 : corner [mix left right (2 / 2)] [mix top bottom (2 / 3)]
8 : corner [mix left right (0 / 2)] [mix top bottom (3 / 3)]
9 : corner [mix left right (1 / 2)] [mix top bottom (3 / 3)]
0 : corner [mix left right (2 / 2)] [mix top bottom (3 / 3)]
# Corner numbers
# 1 2 3
# 4 5 6
# 7 8 9
define [PatternCorner22 bit] : match bit
1 : corner [mix left right (0 / 2)] [mix top bottom (0 / 2)]
2 : corner [mix left right (1 / 2)] [mix top bottom (0 / 2)]
3 : corner [mix left right (2 / 2)] [mix top bottom (0 / 2)]
4 : corner [mix left right (0 / 2)] [mix top bottom (1 / 2)]
5 : corner [mix left right (1 / 2)] [mix top bottom (1 / 2)]
6 : corner [mix left right (2 / 2)] [mix top bottom (1 / 2)]
7 : corner [mix left right (0 / 2)] [mix top bottom (2 / 2)]
8 : corner [mix left right (1 / 2)] [mix top bottom (2 / 2)]
9 : corner [mix left right (2 / 2)] [mix top bottom (2 / 2)]
define [PatternPolygon22 bits] : spiro-outline : bits.map : x => [PatternCorner22 (x - 0)]
define [BEGlyphName unicode] : MangleName ('be' + [unicode.toString 16 :.toUpperCase])
define [BMGlyphName unicode] : MangleName ('blockMosaic/' + [unicode.toString 16 :.toUpperCase])
define [BdGlyphName unicode] : MangleName ('bd' + [unicode.toString 16 :.toUpperCase])
### Block mosaic
do "Block Mosaic" : begin
define [BlockMosaicTile w h id] : glyph-proc
local column : id % w
local row : Math.floor (id / w)
define cw : (right - left) / w
define ch : (top - bottom) / h
include : spiro-outline
corner (column * cw) (top - row * ch)
corner ((column + 1) * cw) (top - row * ch)
corner ((column + 1) * cw) (top - (row + 1) * ch)
corner (column * cw) (top - (row + 1) * ch)
define [BlockMosaicPattern w h bits] : glyph-proc
if (bits.length > 0) : include : union
BlockMosaicTile w h bits.0
BlockMosaicPattern w h : bits.slice 1
define [BlockMosaic23 unicode pattern] : begin
create-glyph [BMGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : BlockMosaicPattern 2 3 : [pattern.split ''].map : x => x - 1
define [BlockMosaic unicode w h pattern] : begin
create-glyph [BMGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : BlockMosaicPattern w h pattern
BlockMosaic23 0x1FB00 '1'
BlockMosaic23 0x1FB01 '2'
BlockMosaic23 0x1FB02 '12'
BlockMosaic23 0x1FB03 '3'
BlockMosaic23 0x1FB04 '13'
BlockMosaic23 0x1FB05 '23'
BlockMosaic23 0x1FB06 '123'
BlockMosaic23 0x1FB07 '4'
BlockMosaic23 0x1FB08 '14'
BlockMosaic23 0x1FB09 '24'
BlockMosaic23 0x1FB0A '124'
BlockMosaic23 0x1FB0B '34'
BlockMosaic23 0x1FB0C '134'
BlockMosaic23 0x1FB0D '234'
BlockMosaic23 0x1FB0E '1234'
BlockMosaic23 0x1FB0F '5'
BlockMosaic23 0x1FB10 '15'
BlockMosaic23 0x1FB11 '25'
BlockMosaic23 0x1FB12 '125'
BlockMosaic23 0x1FB13 '35'
BlockMosaic23 0x1FB14 '235'
BlockMosaic23 0x1FB15 '1235'
BlockMosaic23 0x1FB16 '45'
BlockMosaic23 0x1FB17 '145'
BlockMosaic23 0x1FB18 '245'
BlockMosaic23 0x1FB19 '1245'
BlockMosaic23 0x1FB1A '345'
BlockMosaic23 0x1FB1B '1345'
BlockMosaic23 0x1FB1C '2345'
BlockMosaic23 0x1FB1D '12345'
BlockMosaic23 0x1FB1E '6'
BlockMosaic23 0x1FB1F '16'
BlockMosaic23 0x1FB20 '26'
BlockMosaic23 0x1FB21 '126'
BlockMosaic23 0x1FB22 '36'
BlockMosaic23 0x1FB23 '136'
BlockMosaic23 0x1FB24 '236'
BlockMosaic23 0x1FB25 '1236'
BlockMosaic23 0x1FB26 '46'
BlockMosaic23 0x1FB27 '146'
BlockMosaic23 0x1FB28 '1246'
BlockMosaic23 0x1FB29 '346'
BlockMosaic23 0x1FB2A '1346'
BlockMosaic23 0x1FB2B '2346'
BlockMosaic23 0x1FB2C '12346'
BlockMosaic23 0x1FB2D '56'
BlockMosaic23 0x1FB2E '156'
BlockMosaic23 0x1FB2F '256'
BlockMosaic23 0x1FB30 '1256'
BlockMosaic23 0x1FB31 '356'
BlockMosaic23 0x1FB32 '1356'
BlockMosaic23 0x1FB33 '2356'
BlockMosaic23 0x1FB34 '12356'
BlockMosaic23 0x1FB35 '456'
BlockMosaic23 0x1FB36 '1456'
BlockMosaic23 0x1FB37 '2456'
BlockMosaic23 0x1FB38 '12456'
BlockMosaic23 0x1FB39 '3456'
BlockMosaic23 0x1FB3A '13456'
BlockMosaic23 0x1FB3B '23456'
BlockMosaic 0x1FB95 4 4 {0 2 5 7 8 10 13 15}
BlockMosaic 0x1FB96 4 4 {1 3 4 6 9 11 12 14}
BlockMosaic 0x1FB97 4 4 {4 5 6 7 12 13 14 15}
do "ArchDepth Mosaic" : begin
define [SmoothMosaic23 unicode pattern] : begin
create-glyph [MangleName ('blockMosaicSmooth23/' + pattern)] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
define corners : [pattern.split ''].map : x => [PatternCorner23 (x - 0)]
include : spiro-outline corners
SmoothMosaic23 0x1FB3C '689'
SmoothMosaic23 0x1FB3D '680'
SmoothMosaic23 0x1FB3E '489'
SmoothMosaic23 0x1FB3F '480'
SmoothMosaic23 0x1FB40 '189'
SmoothMosaic23 0x1FB41 '42308'
SmoothMosaic23 0x1FB42 '4308'
SmoothMosaic23 0x1FB43 '62308'
SmoothMosaic23 0x1FB44 '6308'
SmoothMosaic23 0x1FB45 '2308'
SmoothMosaic23 0x1FB46 '6508'
SmoothMosaic23 0x1FB47 '970'
SmoothMosaic23 0x1FB48 '870'
SmoothMosaic23 0x1FB49 '950'
SmoothMosaic23 0x1FB4A '850'
SmoothMosaic23 0x1FB4B '930'
SmoothMosaic23 0x1FB4C '25081'
SmoothMosaic23 0x1FB4D '5081'
SmoothMosaic23 0x1FB4E '27081'
SmoothMosaic23 0x1FB4F '7081'
SmoothMosaic23 0x1FB50 '2081'
SmoothMosaic23 0x1FB51 '7084'
SmoothMosaic23 0x1FB52 '69031'
SmoothMosaic23 0x1FB53 '6031'
SmoothMosaic23 0x1FB54 '49031'
SmoothMosaic23 0x1FB55 '4031'
SmoothMosaic23 0x1FB56 '9031'
SmoothMosaic23 0x1FB57 '142'
SmoothMosaic23 0x1FB58 '143'
SmoothMosaic23 0x1FB59 '162'
SmoothMosaic23 0x1FB5A '163'
SmoothMosaic23 0x1FB5B '182'
SmoothMosaic23 0x1FB5C '1653'
SmoothMosaic23 0x1FB5D '18973'
SmoothMosaic23 0x1FB5E '1873'
SmoothMosaic23 0x1FB5F '18953'
SmoothMosaic23 0x1FB60 '1853'
SmoothMosaic23 0x1FB61 '1893'
SmoothMosaic23 0x1FB62 '235'
SmoothMosaic23 0x1FB63 '135'
SmoothMosaic23 0x1FB64 '237'
SmoothMosaic23 0x1FB65 '137'
SmoothMosaic23 0x1FB66 '230'
SmoothMosaic23 0x1FB67 '1473'
define [SmoothMosaic22 unicode pattern] : begin
create-glyph [MangleName ('blockMosaicSmooth22/' + pattern)] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
define corners : [pattern.split ''].map : x => [PatternCorner22 (x - 0)]
include : spiro-outline corners
SmoothMosaic22 0x1FB68 '15793'
SmoothMosaic22 0x1FB69 '17935'
SmoothMosaic22 0x1FB6A '17953'
SmoothMosaic22 0x1FB6B '17593'
SmoothMosaic22 0x1FB6C '175'
SmoothMosaic22 0x1FB6D '315'
SmoothMosaic22 0x1FB6E '359'
SmoothMosaic22 0x1FB6F '579'
SmoothMosaic22 0x1FB9A '1379'
SmoothMosaic22 0x1FB9B '1739'
### Blocks
do 'Block Shapes'
define [FillBlock hStart hEnd vStart vEnd] : spiro-outline
corner [mix left right hStart] [mix bottom top vStart]
corner [mix left right hStart] [mix bottom top vEnd]
corner [mix left right hEnd] [mix bottom top vEnd]
corner [mix left right hEnd] [mix bottom top vStart]
define [BlockElementGlyph unicode hStart hEnd vStart vEnd] : begin
create-glyph [BEGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : FillBlock hStart hEnd vStart vEnd
define [BlockElementGlyph2 unicode hStart1 hEnd1 vStart1 vEnd1 hStart2 hEnd2 vStart2 vEnd2] : begin
create-glyph [BEGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : union
FillBlock hStart1 hEnd1 vStart1 vEnd1
FillBlock hStart2 hEnd2 vStart2 vEnd2
BlockElementGlyph 0x2588 0 1 0 1
BlockElementGlyph 0x1FB86 0 1 (1 / 8) 1
BlockElementGlyph 0x1FB85 0 1 (2 / 8) 1
BlockElementGlyph 0x1FB84 0 1 (3 / 8) 1
BlockElementGlyph 0x2580 0 1 (1 / 2) 1
BlockElementGlyph 0x1FB83 0 1 (5 / 8) 1
BlockElementGlyph 0x1FB82 0 1 (6 / 8) 1
BlockElementGlyph 0x2594 0 1 (7 / 8) 1
BlockElementGlyph 0x2595 (7 / 8) 1 0 1
BlockElementGlyph 0x1FB87 (6 / 8) 1 0 1
BlockElementGlyph 0x1FB88 (5 / 8) 1 0 1
BlockElementGlyph 0x2590 (1 / 2) 1 0 1
BlockElementGlyph 0x1FB89 (3 / 8) 1 0 1
BlockElementGlyph 0x1FB8A (2 / 8) 1 0 1
BlockElementGlyph 0x1FB8B (1 / 8) 1 0 1
foreach [fill : range 1 8] : begin
BlockElementGlyph (0x2580 + fill) 0 1 0 (fill / 8)
BlockElementGlyph (0x2590 - fill) 0 (fill / 8) 0 1
if (fill >= 2 && fill <= 7) : begin
BlockElementGlyph (0x1FB70 - 2 + fill) ((fill - 1) / 8) (fill / 8) 0 1
BlockElementGlyph (0x1FB76 - 2 + fill) 0 1 (1 - (fill - 1) / 8) (1 - fill / 8)
BlockElementGlyph2 0x1FB7C 0 (1 / 8) 0 1 0 1 0 (1 / 8)
BlockElementGlyph2 0x1FB7D 0 (1 / 8) 0 1 0 1 (7 / 8) 1
BlockElementGlyph2 0x1FB7E (7 / 8) 1 0 1 0 1 (7 / 8) 1
BlockElementGlyph2 0x1FB7F (7 / 8) 1 0 1 0 1 0 (1 / 8)
BlockElementGlyph2 0x1FB80 0 1 (7 / 8) 1 0 1 0 (1 / 8)
create-glyph [BEGlyphName 0x1FB81] [MangleUnicode 0x1FB81] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : union
FillBlock 0 1 (7 / 8) 1
FillBlock 0 1 (5 / 8) (6 / 8)
FillBlock 0 1 (3 / 8) (4 / 8)
FillBlock 0 1 0 (1 / 8)
create-glyph [BEGlyphName 0x1FBB5] [MangleUnicode 0x1FBB5] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName "arrowLeft"
include : refer-glyph : BEGlyphName 0x1FB80
create-glyph [BEGlyphName 0x1FBB6] [MangleUnicode 0x1FBB6] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName "arrowRight"
include : refer-glyph : BEGlyphName 0x1FB80
create-glyph [BEGlyphName 0x1FBB7] [MangleUnicode 0x1FBB7] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName "arrowDown"
include : refer-glyph : BEGlyphName 0x2595
create-glyph [BEGlyphName 0x1FBB8] [MangleUnicode 0x1FBB8] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName "arrowUp"
include : refer-glyph : BEGlyphName 0x2595
create-glyph [BEGlyphName 0x1FBBC] [MangleUnicode 0x1FBBC] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName "blackSmallCircle"
include : refer-glyph : BEGlyphName 0x2595
include : refer-glyph : BEGlyphName 0x1FB80
define [Shade _steps fill box] : glyph-proc
local steps : Math.abs _steps
local sign : if (_steps >= 0) 1 (-1)
local sw : (top - bottom) / steps * fill
local skew : [Math.round (MosaicWidth / Width)] * (top - bottom) / 2
include : ForceUpright
include : intersection
glyph-proc
foreach j [range (-steps * 4 - 2) (steps * 4 + 2)] : begin
local y0 : mix top bottom (j / steps)
local y1 : y0 + sign * skew
include : spiro-outline
corner 0 (y0 - sw / 2)
corner MosaicWidth (y1 - sw / 2)
corner MosaicWidth (y1 + sw / 2)
corner 0 (y0 + sw / 2)
fallback box [FillBlock 0 1 0 1]
define FillLight (1 / 8)
define FillMedium (1 / 4)
define FillHeavy (1 / 2)
create-glyph [MangleName 'lightShade'] [MangleUnicode 0x2591] : glyph-proc
set-width MosaicWidth
include : Shade 4 FillLight
create-glyph [MangleName 'denseShade'] : glyph-proc
set-width MosaicWidth
include : Shade 16 FillHeavy
define [MediumShade unicode bits] : begin
create-glyph [BEGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : Shade 8 FillMedium : PatternPolygon22 bits
define [InverseMediumShade unicode bits] : begin
create-glyph [BEGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : Shade (-8) (1 - FillMedium) : PatternPolygon22 bits
include : difference
FillBlock 0 1 0 1
PatternPolygon22 bits
MediumShade 0x2592 {1 3 9 7}
MediumShade 0x1FB8C {1 2 8 7}
MediumShade 0x1FB8D {2 3 9 8}
MediumShade 0x1FB8E {1 3 6 4}
MediumShade 0x1FB8F {4 6 9 7}
InverseMediumShade 0x1FB90 {1 3 9 7}
InverseMediumShade 0x1FB94 {1 2 8 7}
# InverseMediumShade 0x1FB93 {2 3 9 8}
InverseMediumShade 0x1FB92 {1 3 6 4}
InverseMediumShade 0x1FB91 {4 6 9 7}
MediumShade 0x1FB9C {1 3 7}
MediumShade 0x1FB9D {1 3 9}
MediumShade 0x1FB9E {3 7 9}
MediumShade 0x1FB9F {1 7 9}
create-glyph [MangleName 'heavyShade'] [MangleUnicode 0x2593] : glyph-proc
set-width MosaicWidth
include : Shade 8 FillHeavy
create-glyph [MangleName 'upperLeftToLowerRightFill'] [MangleUnicode 0x1FB98] : glyph-proc
set-width MosaicWidth
include : Shade (-4) FillHeavy
create-glyph [MangleName 'upperRightToLowerLeftFill'] [MangleUnicode 0x1FB99] : glyph-proc
set-width MosaicWidth
include : Shade 4 FillHeavy
define filldata : list
list 0x2596 0 0 1 0
list 0x2597 0 0 0 1
list 0x2598 1 0 0 0
list 0x2599 1 0 1 1
list 0x259A 1 0 0 1
list 0x259B 1 1 1 0
list 0x259C 1 1 0 1
list 0x259D 0 1 0 0
list 0x259E 0 1 1 0
list 0x259F 0 1 1 1
foreach [{unicode lt rt lb rb} : items-of filldata] : begin
create-glyph [BEGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
define t top
define b bottom
define l 0
define r MosaicWidth
local mx : mix l r 0.5
local my : mix b t 0.5
if lt : include : spiro-outline
corner l t
corner l my
corner mx my
corner mx t
if rt : include : spiro-outline
corner mx t
corner mx my
corner r my
corner r t
if lb : include : spiro-outline
corner l my
corner l b
corner mx b
corner mx my
if rb : include : spiro-outline
corner mx my
corner mx b
corner r b
corner r my
### Box drawing glyphs
do "Box Drawing"
local light : AdviceStroke 3.5
local heavy : Math.max (light * 2) (Width * 0.15)
local midx : MosaicWidth / 2
# Add a little overshoot to the lines to make them join vertically
local verticalOvershoot 1.02
local topy : mix bottom top verticalOvershoot
local boty : mix top bottom verticalOvershoot
local midy : mix boty topy 0.5
define [boxdraw unicode u d l r] : begin
create-glyph [BdGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local stopH : [Math.max u d] / 2
local stopV : [Math.max l r] / 2
if l : include : HBar.m 0 (midx + stopH) midy l
if r : include : HBar.m (midx - stopH) MosaicWidth midy r
if d : include : VBar.m midx boty (midy + stopV) d
if u : include : VBar.m midx (midy - stopV) topy u
define [dlboxdraw unicode u d l r] : begin
create-glyph [BdGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local stopH : [Math.max u d] - light * 1 - light * 0.5 * HVContrast
local stopV : [Math.max l r] - light * 1.5
local capH : [Math.max u d] - light * 1
local capV : [Math.max l r] - light * 1
if l : begin
include : HBar.m 0 (midx - stopH) (midy + (l - light)) light
if (l > light) : include : HBar.m 0 (midx - stopH) (midy - (l - light)) light
if r : begin
include : HBar.m (midx + stopH) MosaicWidth (midy + (r - light)) light
if (r > light) : include : HBar.m (midx + stopH) MosaicWidth (midy - (r - light)) light
if d : begin
include : VBar.m (midx + (d - light)) boty (midy - stopV) light
if (d > light) : include : VBar.m (midx - (d - light)) boty (midy - stopV) light
if u : begin
include : VBar.m (midx + (u - light)) (midy + stopV) topy light
if (u > light) : include : VBar.m (midx - (u - light)) (midy + stopV) topy light
if (stopH > 0 && [not u]) : include : HBar.m (midx - stopH - light * HVContrast) (midx + stopH + light * HVContrast) (midy + capV) light
if (stopH > 0 && [not d]) : include : HBar.m (midx - stopH - light * HVContrast) (midx + stopH + light * HVContrast) (midy - capV) light
if (stopV > 0 && [not l]) : include : VBar.m (midx - capH) (midy - stopV - light) (midy + stopV + light) light
if (stopV > 0 && [not r]) : include : VBar.m (midx + capH) (midy - stopV - light) (midy + stopV + light) light
define [complexBoxDraw unicodeStart U D L R fn dl] : begin
local order {
{light light light light}
{light light heavy light}
{light light light heavy}
{light light heavy heavy}
{heavy light light light}
{light heavy light light}
{heavy heavy light light}
{heavy light heavy light}
{heavy light light heavy}
{light heavy heavy light}
{light heavy light heavy}
{heavy light heavy heavy}
{light heavy heavy heavy}
{heavy heavy heavy light}
{heavy heavy light heavy}
{heavy heavy heavy heavy}
}
local existings {}
local n 0
foreach {u d l r} [items-of order] : begin
local newcome true
local masked {(U * u) (D * d) (L * l) (R * r)}
foreach existing [items-of existings] : if ('' + existing === '' + masked) : set newcome false
if newcome : begin
if ([not dl]
|| ([not masked.0] || [not masked.1] || (masked.0 === masked.1))
&& ([not masked.2] || [not masked.3] || (masked.2 === masked.3))
&& (masked.0 > light || masked.1 > light || masked.2 > light || masked.3 > light)
) : begin
[fallback fn boxdraw].apply null {(unicodeStart + n) :: masked}
inc n
existings.push masked
# Straight
boxdraw 0x2500 0 0 light light
boxdraw 0x2501 0 0 heavy heavy
boxdraw 0x2502 light light 0 0
boxdraw 0x2503 heavy heavy 0 0
boxdraw 0x2574 0 0 light 0
boxdraw 0x2575 light 0 0 0
boxdraw 0x2576 0 0 0 light
boxdraw 0x2577 0 light 0 0
boxdraw 0x2578 0 0 heavy 0
boxdraw 0x2579 heavy 0 0 0
boxdraw 0x257A 0 0 0 heavy
boxdraw 0x257B 0 heavy 0 0
boxdraw 0x257C 0 0 light heavy
boxdraw 0x257D light heavy 0 0
boxdraw 0x257E 0 0 heavy light
boxdraw 0x257F heavy light 0 0
dlboxdraw 0x2550 0 0 heavy heavy
dlboxdraw 0x2551 heavy heavy 0 0
# Complex
complexBoxDraw 0x250C 0 1 0 1
complexBoxDraw 0x2510 0 1 1 0
complexBoxDraw 0x2514 1 0 0 1
complexBoxDraw 0x2518 1 0 1 0
complexBoxDraw 0x251C 1 1 0 1
complexBoxDraw 0x2524 1 1 1 0
complexBoxDraw 0x252C 0 1 1 1
complexBoxDraw 0x2534 1 0 1 1
complexBoxDraw 0x253C 1 1 1 1
complexBoxDraw 0x2552 0 1 0 1 dlboxdraw 1
complexBoxDraw 0x2555 0 1 1 0 dlboxdraw 1
complexBoxDraw 0x2558 1 0 0 1 dlboxdraw 1
complexBoxDraw 0x255B 1 0 1 0 dlboxdraw 1
complexBoxDraw 0x255E 1 1 0 1 dlboxdraw 1
complexBoxDraw 0x2561 1 1 1 0 dlboxdraw 1
complexBoxDraw 0x2564 0 1 1 1 dlboxdraw 1
complexBoxDraw 0x2567 1 0 1 1 dlboxdraw 1
complexBoxDraw 0x256A 1 1 1 1 dlboxdraw 1
# Dashed
define [hDashed unicode segments weight] : begin
create-glyph [BdGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
foreach j [range 0 segments] : include : HBar.m [mix (MosaicWidth * j / segments) (MosaicWidth * (j + 1) / segments) 0.2] [mix (MosaicWidth * j / segments) (MosaicWidth * (j + 1) / segments) 0.8] midy weight
define [vDashed unicode segments weight] : begin
create-glyph [BdGlyphName unicode] [MangleUnicode unicode] : glyph-proc
set-width MosaicWidth
include : ForceUpright
foreach j [range 0 segments] : include : VBar.m
begin midx
mix [mix boty topy (j / segments)] [mix boty topy ((j + 1) / segments)] 0.2
mix [mix boty topy (j / segments)] [mix boty topy ((j + 1) / segments)] 0.8
begin weight
hDashed 0x2504 3 light
hDashed 0x2505 3 heavy
hDashed 0x2508 4 light
hDashed 0x2509 4 heavy
hDashed 0x254C 2 light
hDashed 0x254D 2 heavy
vDashed 0x2506 3 light
vDashed 0x2507 3 heavy
vDashed 0x250A 4 light
vDashed 0x250B 4 heavy
vDashed 0x254E 2 light
vDashed 0x254F 2 heavy
# Arcs
local bdArcRadius : Math.min (midx + O * 2) ((midy - boty) / 2)
create-glyph [BdGlyphName 0x256D] [MangleUnicode 0x256D] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : dispiro
widths.center light
flat midx boty [heading Upward]
curl midx (midy - bdArcRadius) [heading Upward]
arcvh
flat (midx + bdArcRadius) midy [heading Rightward]
curl MosaicWidth midy [heading Rightward]
create-glyph [BdGlyphName 0x256E] [MangleUnicode 0x256E] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : dispiro
widths.center light
flat midx boty [heading Upward]
curl midx (midy - bdArcRadius) [heading Upward]
arcvh
flat (midx - bdArcRadius) midy [heading Leftward]
curl 0 midy [heading Leftward]
create-glyph [BdGlyphName 0x256F] [MangleUnicode 0x256F] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : dispiro
widths.center light
flat midx topy [heading Downward]
curl midx (midy + bdArcRadius) [heading Downward]
arcvh
flat (midx - bdArcRadius) midy [heading Leftward]
curl 0 midy [heading Leftward]
create-glyph [BdGlyphName 0x2570] [MangleUnicode 0x2570] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : dispiro
widths.center light
flat midx topy [heading Downward]
curl midx (midy + bdArcRadius) [heading Downward]
arcvh
flat (midx + bdArcRadius) midy [heading Rightward]
curl MosaicWidth midy [heading Rightward]
create-glyph [BdGlyphName 0x2571] [MangleUnicode 0x2571] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : dispiro
widths.center light
flat MosaicWidth topy
curl 0 boty
create-glyph [BdGlyphName 0x2572] [MangleUnicode 0x2572] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : dispiro
widths.center light
flat 0 topy
curl MosaicWidth boty
create-glyph [BdGlyphName 0x2573] [MangleUnicode 0x2573] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : BdGlyphName 0x2571
include : refer-glyph : BdGlyphName 0x2572
# Diamond
define [DiamondBarRaw hStart vStart hEnd vEnd] : begin
define zStartX : mix left right hStart
define zStartY : mix bottom top vStart
define zEndX : mix left right hEnd
define zEndY : mix bottom top vEnd
return : dispiro
widths.center light
corner [mix zStartX zEndX (-1)] [mix zStartY zEndY (-1)]
corner [mix zStartX zEndX (+2)] [mix zStartY zEndY (+2)]
define [DiamondMask] : spiro-outline
corner [mix left right 0] [mix bottom top 0]
corner [mix left right 0] [mix bottom top 1]
corner [mix left right 1] [mix bottom top 1]
corner [mix left right 1] [mix bottom top 0]
define [DiamondBoxDrawing unicode a b c d] : begin
create-glyph [BdGlyphName unicode] [MangleUnicode unicode] : glyph-proc
local candidates {}
if a : candidates.push [DiamondBarRaw 0.5 1 0 0.5]
if b : candidates.push [DiamondBarRaw 1 0.5 0.5 1]
if c : candidates.push [DiamondBarRaw 0 0.5 0.5 0]
if d : candidates.push [DiamondBarRaw 0.5 0 1 0.5]
set-width MosaicWidth
include : ForceUpright
include : intersection
DiamondMask
union.apply null candidates
DiamondBoxDrawing 0x1FBA0 1 0 0 0
DiamondBoxDrawing 0x1FBA1 0 1 0 0
DiamondBoxDrawing 0x1FBA2 0 0 1 0
DiamondBoxDrawing 0x1FBA3 0 0 0 1
DiamondBoxDrawing 0x1FBA4 1 0 1 0
DiamondBoxDrawing 0x1FBA5 0 1 0 1
DiamondBoxDrawing 0x1FBA6 0 0 1 1
DiamondBoxDrawing 0x1FBA7 1 1 0 0
DiamondBoxDrawing 0x1FBA8 1 0 0 1
DiamondBoxDrawing 0x1FBA9 0 1 1 0
DiamondBoxDrawing 0x1FBAA 0 1 1 1
DiamondBoxDrawing 0x1FBAB 1 0 1 1
DiamondBoxDrawing 0x1FBAC 1 1 0 1
DiamondBoxDrawing 0x1FBAD 1 1 1 0
DiamondBoxDrawing 0x1FBAE 1 1 1 1
create-glyph [BEGlyphName 0x1FBBD] [MangleUnicode 0x1FBBD] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : difference
glyph-proc : include : refer-glyph : BEGlyphName 0x2588
glyph-proc : include : refer-glyph : BdGlyphName 0x2573
create-glyph [BEGlyphName 0x1FBBE] [MangleUnicode 0x1FBBE] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : difference
glyph-proc : include : refer-glyph : BEGlyphName 0x2588
glyph-proc : include : refer-glyph : BdGlyphName 0x1FBA3
create-glyph [BdGlyphName 0x1FBBF] [MangleUnicode 0x1FBBF] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : difference
glyph-proc : include : refer-glyph : BEGlyphName 0x2588
glyph-proc : include : refer-glyph : BdGlyphName 0x1FBAE
create-glyph [BdGlyphName 0x1FBAF] [MangleUnicode 0x1FBAF] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : intersection
glyph-proc : include : refer-glyph : BdGlyphName 0x253C
Rect [mix bottom top 0.35] [mix bottom top 0.65] 0 MosaicWidth
glyph-block Symbol-Mosaic-Powerline : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives : refer-glyph
define MosaicTop fontMetrics.os2.sTypoAscender
define MosaicBottom fontMetrics.os2.sTypoDescender
for-width-kinds WideWidth4
local pwlMidOrig : (MosaicTop + MosaicBottom) / 2
local pwlTop : (MosaicTop - pwlMidOrig) * para.powerlineScaleY + para.powerlineShiftY + pwlMidOrig
local pwlBot : (MosaicBottom - pwlMidOrig) * para.powerlineScaleY + para.powerlineShiftY + pwlMidOrig
local pwlMid : mix pwlBot pwlTop (1 / 2)
local pwlNear : 0 * para.powerlineScaleX + para.powerlineShiftX
local pwlFar : MosaicWidth * para.powerlineScaleX + para.powerlineShiftX
define [RotatedPowerline gidNew unicodeNew gidSource] : begin
create-glyph [MangleName gidNew] [MangleUnicode unicodeNew] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph [MangleName gidSource]
include : FlipAround (MosaicWidth / 2) pwlMid
create-glyph [MangleName 'powerline/triangleRight'] [MangleUnicode 0xE0B0] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : spiro-outline
corner (pwlNear + O) pwlTop
corner pwlNear pwlTop
corner pwlFar pwlMid
corner pwlNear pwlBot
corner (pwlNear + O) pwlBot
create-glyph [MangleName 'powerline/angleRight'] [MangleUnicode 0xE0B1] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local fine : AdviceStroke 4
include : intersection
spiro-outline
corner (pwlNear - MosaicWidth) pwlTop
corner pwlNear pwlTop
corner pwlFar pwlMid
corner pwlNear pwlBot
corner (pwlNear - MosaicWidth) pwlBot
union
dispiro
widths.rhs fine
flat pwlNear pwlTop
curl pwlFar pwlMid
dispiro
widths.rhs fine
flat pwlFar pwlMid
curl pwlNear pwlBot
RotatedPowerline 'powerline/triangleLeft' 0xE0B2 'powerline/triangleRight'
RotatedPowerline 'powerline/angleLeft' 0xE0B3 'powerline/angleRight'
create-glyph [MangleName 'powerline/hemiCircleRight'] [MangleUnicode 0xE0B4] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : spiro-outline
corner (pwlNear + O) pwlTop
g4 pwlNear pwlTop
g4.down.mid pwlFar pwlMid
g4 pwlNear pwlBot
corner (pwlNear + O) pwlBot
create-glyph [MangleName 'powerline/arcRight'] [MangleUnicode 0xE0B5] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local fine : AdviceStroke 4
include : dispiro
widths.rhs fine
corner (pwlNear + O) pwlTop [heading Rightward]
g4 pwlNear pwlTop [heading Rightward]
g4.down.mid pwlFar pwlMid [heading Downward]
g4 pwlNear pwlBot [heading Leftward]
corner (pwlNear + O) pwlBot [heading Leftward]
RotatedPowerline 'powerline/hemiCircleLeft' 0xE0B6 'powerline/hemiCircleRight'
RotatedPowerline 'powerline/arcLeft' 0xE0B7 'powerline/arcRight'
create-glyph [MangleName 'powerline/underline'] [MangleUnicode 0xE0AE] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local fine : AdviceStroke 4
include : HBar.b 0 MosaicWidth pwlBot
create-glyph [MangleName 'powerline/overline'] [MangleUnicode 0xE0AF] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local fine : AdviceStroke 4
include : HBar.t 0 MosaicWidth pwlTop
create-glyph [MangleName 'powerline/cornerBottomLeft'] [MangleUnicode 0xE0B8] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : spiro-outline
corner (pwlNear + O) pwlTop
corner pwlNear pwlTop
corner pwlFar pwlBot
corner (pwlNear + O) pwlBot
create-glyph [MangleName 'powerline/slashBottomLeft'] [MangleUnicode 0xE0B9] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local fine : AdviceStroke 4
include : dispiro
widths.rhs fine
flat pwlNear pwlTop
curl pwlFar pwlBot
create-glyph [MangleName 'powerline/cornerTopLeft'] [MangleUnicode 0xE0BC] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : spiro-outline
corner (pwlNear + O) pwlTop
corner pwlNear pwlTop
corner pwlFar pwlTop
corner (pwlNear + O) pwlBot
create-glyph [MangleName 'powerline/slashTopLeft'] [MangleUnicode 0xE0BD] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local fine : AdviceStroke 4
include : dispiro
widths.rhs fine
flat pwlNear pwlBot
curl pwlFar pwlTop
RotatedPowerline 'powerline/cornerBottomRight' 0xE0BA 'powerline/cornerTopLeft'
RotatedPowerline 'powerline/slashBottomRight' 0xE0BB 'powerline/slashTopLeft'
RotatedPowerline 'powerline/cornerTopRight' 0xE0BE 'powerline/cornerBottomLeft'
RotatedPowerline 'powerline/slashTopRight' 0xE0BF 'powerline/slashBottomLeft'
glyph-block Symbol-Mosaic-NotDef : begin
glyph-block-import CommonShapes : Rect
glyph-block-import Common-Derivatives : refer-glyph
create-glyph '.notdef' : glyph-proc
define sw : AdviceStroke 8
include : union
intersection
glyph-proc : include : refer-glyph "be2592.NWID"
Rect CAP 0 SB RightSB
difference
Rect CAP 0 SB RightSB
Rect (CAP - sw) (0 + sw) (SB + sw) (RightSB - sw)
set currentGlyph.glyphRank (9999)
create-glyph '.notdefCloneE000' 0xF00F : glyph-proc
include [refer-glyph '.notdef'] AS_BASE ALSO_METRICS
glyph-block Symbol-Geometric-Mosaic-Inverted : for-width-kinds WideWidth1
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Symbol-Geometric-Shared : GeometricDim UnicodeWeightGrade GeometricSizes
define MosaicTop fontMetrics.os2.sTypoAscender
define MosaicBottom fontMetrics.os2.sTypoDescender
create-glyph [MangleName 'uni25D8'] [MangleUnicode 0x25D8] : glyph-proc
set-width MosaicWidth
include : difference
refer-glyph : MangleName 'be2588'
refer-glyph : MangleName 'blackCircle'
include : difference
refer-glyph : MangleName 'be2588'
refer-glyph : MangleName 'blackCircle'
create-glyph [MangleName 'uni25DA'] [MangleUnicode 0x25DA] : glyph-proc
set-width MosaicWidth
include : difference
refer-glyph : MangleName 'be2580'
refer-glyph : MangleName 'whiteCircle'
create-glyph [MangleName 'uni25DB'] [MangleUnicode 0x25DB] : glyph-proc
set-width MosaicWidth
include : difference
refer-glyph : MangleName 'be2584'
refer-glyph : MangleName 'whiteCircle'
create-glyph [MangleName 'uni25D9'] [MangleUnicode 0x25D9] : glyph-proc
set-width MosaicWidth
include : refer-glyph : MangleName 'uni25DA'
include : refer-glyph : MangleName 'uni25DB'