746 lines
25 KiB
Text
746 lines
25 KiB
Text
###### Teletext symbols
|
|
$$include '../meta/macros.ptl'
|
|
|
|
import [mix linreg clamp fallback] from '../support/utils'
|
|
|
|
export : define [apply] : begin
|
|
glyph-module-entry commonShapes overmarks
|
|
if recursive : return nothing
|
|
|
|
define WidthKinds {{'.hwid' WIDTH}}
|
|
if (para.spacing > 0) : WidthKinds.push {'.fwid' FULLWIDTH0}
|
|
|
|
define MosaicTop font.OS_2.sTypoAscender
|
|
define MosaicBottom font.OS_2.sTypoDescender
|
|
|
|
foreach {suffix MosaicWidth} [items-of WidthKinds] : do
|
|
define [MangleUnicode unicode] : if (MosaicWidth == FULLWIDTH) unicode nothing
|
|
define [MangleName name] : name + suffix
|
|
|
|
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)]
|
|
|
|
### Block mosaic
|
|
do "Block Mosaic" : begin
|
|
|
|
define [BMGlyphName unicode] : MangleName ('blockMosaic/' + [unicode.toString 16 :.toUpperCase])
|
|
|
|
define [BlockMosaicTile w h id] : glyph-construction
|
|
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-construction
|
|
if (bits.length > 0) : include : union
|
|
BlockMosaicTile w h bits.0
|
|
BlockMosaicPattern w h : bits.slice 1
|
|
|
|
define [BlockMosaic23 unicode pattern] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include : BlockMosaicPattern 2 3 : [pattern.split ''].map : x => x - 1
|
|
save [BMGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
define [BlockMosaic unicode w h pattern] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include : BlockMosaicPattern w h pattern
|
|
save [BMGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
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 "Smooth Mosaic" : begin
|
|
|
|
|
|
define [SmoothMosaic23 unicode pattern] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
define corners : [pattern.split ''].map : x => [PatternCorner23 (x - 0)]
|
|
include : spiro-outline corners
|
|
save [MangleName ('blockMosaicSmooth23/' + pattern)] [MangleUnicode unicode]
|
|
|
|
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] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
define corners : [pattern.split ''].map : x => [PatternCorner22 (x - 0)]
|
|
include : spiro-outline corners
|
|
save [MangleName ('blockMosaicSmooth22/' + pattern)] [MangleUnicode unicode]
|
|
|
|
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 [BEGlyphName unicode] : MangleName ('be' + [unicode.toString 16 :.toUpperCase])
|
|
|
|
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] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include : FillBlock hStart hEnd vStart vEnd
|
|
save [BEGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
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)
|
|
|
|
define [Shade _steps fill box] : glyph-construction
|
|
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-construction
|
|
foreach j [range (-steps * 4 - 2) (steps * 4 + 2)] : begin
|
|
local y0 : mix top bottom (j / steps)
|
|
local y1 : y0 + sign * skew
|
|
start-from 0 (y0 - sw / 2)
|
|
line-to MosaicWidth (y1 - sw / 2)
|
|
line-to MosaicWidth (y1 + sw / 2)
|
|
line-to 0 (y0 + sw / 2)
|
|
fallback box [FillBlock 0 1 0 1]
|
|
|
|
define FillLight (1 / 8)
|
|
define FillMedium (1 / 4)
|
|
define FillHeavy (1 / 2)
|
|
|
|
sketch # lightShade
|
|
set-width MosaicWidth
|
|
include : Shade 4 FillLight
|
|
save [MangleName 'lightShade'] [MangleUnicode 0x2591]
|
|
|
|
define [MediumShade unicode bits] : sketch
|
|
set-width MosaicWidth
|
|
include : Shade 8 FillMedium : PatternPolygon22 bits
|
|
save [BEGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
define [InverseMediumShade unicode bits coBits] : sketch
|
|
set-width MosaicWidth
|
|
include : Shade (-8) (1 - FillMedium) : PatternPolygon22 bits
|
|
include : difference
|
|
FillBlock 0 1 0 1
|
|
PatternPolygon22 bits
|
|
save [BEGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
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}
|
|
|
|
sketch # heavyShade
|
|
set-width MosaicWidth
|
|
include : Shade 8 FillHeavy
|
|
save [MangleName 'heavyShade'] [MangleUnicode 0x2593]
|
|
|
|
sketch # upperLeftToLowerRightFill
|
|
set-width MosaicWidth
|
|
include : Shade (-4) FillHeavy
|
|
save [MangleName 'upperLeftToLowerRightFill'] [MangleUnicode 0x1FB98]
|
|
|
|
sketch # upperRightToLowerLeftFill
|
|
set-width MosaicWidth
|
|
include : Shade 4 FillHeavy
|
|
save [MangleName 'upperRightToLowerLeftFill'] [MangleUnicode 0x1FB99]
|
|
|
|
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] : sketch
|
|
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 : begin
|
|
start-from l t
|
|
line-to l my
|
|
line-to mx my
|
|
line-to mx t
|
|
if rt : begin
|
|
start-from mx t
|
|
line-to mx my
|
|
line-to r my
|
|
line-to r t
|
|
if lb : begin
|
|
start-from l my
|
|
line-to l b
|
|
line-to mx b
|
|
line-to mx my
|
|
if rb : begin
|
|
start-from mx my
|
|
line-to mx b
|
|
line-to r b
|
|
line-to r my
|
|
save [BEGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
### Box drawing glyphs
|
|
do "Box Drawing"
|
|
define [BdGlyphName unicode] : MangleName ('bd' + [unicode.toString 16 :.toUpperCase])
|
|
local light : adviceBlackness 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] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
local stopH : [Math.max u d] / 2
|
|
local stopV : [Math.max l r] / 2
|
|
if l : include : HBar 0 (midx + stopH) midy l
|
|
if r : include : HBar (midx - stopH) MosaicWidth midy r
|
|
if d : include : VBar midx boty (midy + stopV) d
|
|
if u : include : VBar midx (midy - stopV) topy u
|
|
|
|
save [BdGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
define [dlboxdraw unicode u d l r] : sketch
|
|
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 0 (midx - stopH) (midy + (l - light)) light
|
|
if (l > light) : include : HBar 0 (midx - stopH) (midy - (l - light)) light
|
|
if r : begin
|
|
include : HBar (midx + stopH) MosaicWidth (midy + (r - light)) light
|
|
if (r > light) : include : HBar (midx + stopH) MosaicWidth (midy - (r - light)) light
|
|
if d : begin
|
|
include : VBar (midx + (d - light)) boty (midy - stopV) light
|
|
if (d > light) : include : VBar (midx - (d - light)) boty (midy - stopV) light
|
|
if u : begin
|
|
include : VBar (midx + (u - light)) (midy + stopV) topy light
|
|
if (u > light) : include : VBar (midx - (u - light)) (midy + stopV) topy light
|
|
if (stopH > 0 && [not u]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy + capV) light
|
|
if (stopH > 0 && [not d]) : include : HBar (midx - stopH - light * HVCONTRAST) (midx + stopH + light * HVCONTRAST) (midy - capV) light
|
|
if (stopV > 0 && [not l]) : include : VBar (midx - capH) (midy - stopV - light) (midy + stopV + light) light
|
|
if (stopV > 0 && [not r]) : include : VBar (midx + capH) (midy - stopV - light) (midy + stopV + light) light
|
|
|
|
save [BdGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
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] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
foreach j [range 0 segments] : include : HBar [mix (MosaicWidth * j / segments) (MosaicWidth * (j + 1) / segments) 0.2] [mix (MosaicWidth * j / segments) (MosaicWidth * (j + 1) / segments) 0.8] midy weight
|
|
|
|
save [BdGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
define [vDashed unicode segments weight] : sketch
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
foreach j [range 0 segments] : include : VBar
|
|
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
|
|
|
|
save [BdGlyphName unicode] [MangleUnicode unicode]
|
|
|
|
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)
|
|
sketch # bd256D
|
|
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]
|
|
save [BdGlyphName 0x256D] [MangleUnicode 0x256D]
|
|
|
|
sketch # bd256E
|
|
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]
|
|
save [BdGlyphName 0x256E] [MangleUnicode 0x256E]
|
|
|
|
sketch # bd256F
|
|
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]
|
|
save [BdGlyphName 0x256F] [MangleUnicode 0x256F]
|
|
|
|
sketch # bd2570
|
|
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]
|
|
save [BdGlyphName 0x2570] [MangleUnicode 0x2570]
|
|
|
|
sketch # bd2571
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include : dispiro
|
|
widths.center light
|
|
flat MosaicWidth topy
|
|
curl 0 boty
|
|
save [BdGlyphName 0x2571] [MangleUnicode 0x2571]
|
|
|
|
sketch # bd2572
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include : dispiro
|
|
widths.center light
|
|
flat 0 topy
|
|
curl MosaicWidth boty
|
|
save [BdGlyphName 0x2572] [MangleUnicode 0x2572]
|
|
|
|
sketch # bd2573
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include glyphs.([BdGlyphName 0x2571])
|
|
include glyphs.([BdGlyphName 0x2572])
|
|
save [BdGlyphName 0x2573] [MangleUnicode 0x2573]
|
|
|
|
do "Powerline Mosaics"
|
|
define [MangleUnicode unicode] : if (MosaicWidth == FULLWIDTH3) unicode nothing
|
|
define [MangleName name] : name + suffix
|
|
|
|
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
|
|
|
|
sketch # pwlTriangleRight
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
start-from (pwlNear + O) pwlTop
|
|
line-to pwlNear pwlTop
|
|
line-to pwlFar pwlMid
|
|
line-to pwlNear pwlBot
|
|
line-to (pwlNear + O) pwlBot
|
|
save [MangleName 'pwlTriangleRight'] [MangleUnicode 0xE0B0]
|
|
|
|
sketch # pwlAngleRight
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
local fine : adviceBlackness 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
|
|
save [MangleName 'pwlAngleRight'] [MangleUnicode 0xE0B1]
|
|
|
|
sketch # pwlTriangleLeft
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include glyphs.[MangleName 'pwlTriangleRight']
|
|
include : FlipAround (MosaicWidth / 2) pwlMid
|
|
save [MangleName 'pwlTriangleLeft'] [MangleUnicode 0xE0B2]
|
|
|
|
sketch # pwlAngleLeft
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include glyphs.[MangleName 'pwlAngleRight']
|
|
include : FlipAround (MosaicWidth / 2) pwlMid
|
|
save [MangleName 'pwlAngleLeft'] [MangleUnicode 0xE0B3]
|
|
|
|
sketch # pwlUnderline
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
local fine : adviceBlackness 4
|
|
include : HBarBottom 0 MosaicWidth pwlBot
|
|
save [MangleName 'pwlUnderline'] [MangleUnicode 0xE0AE]
|
|
|
|
sketch # pwlOverline
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
local fine : adviceBlackness 4
|
|
include : HBarTop 0 MosaicWidth pwlTop
|
|
save [MangleName 'pwlOverline'] [MangleUnicode 0xE0AF]
|
|
|
|
sketch # pwlCornerBottomLeft
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
start-from (pwlNear + O) pwlTop
|
|
line-to pwlNear pwlTop
|
|
line-to pwlFar pwlBot
|
|
line-to (pwlNear + O) pwlBot
|
|
save [MangleName 'pwlCornerBottomLeft'] [MangleUnicode 0xE0B8]
|
|
|
|
sketch # pwlSlashBottomLeft
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
local fine : adviceBlackness 4
|
|
include : dispiro
|
|
widths.rhs fine
|
|
flat pwlNear pwlTop
|
|
curl pwlFar pwlBot
|
|
save [MangleName 'pwlSlashBottomLeft'] [MangleUnicode 0xE0B9]
|
|
|
|
sketch # pwlCornerTopLeft
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
start-from (pwlNear + O) pwlTop
|
|
line-to pwlNear pwlTop
|
|
line-to pwlFar pwlTop
|
|
line-to (pwlNear + O) pwlBot
|
|
save [MangleName 'pwlCornerTopLeft'] [MangleUnicode 0xE0BC]
|
|
|
|
sketch # pwlSlashTopLeft
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
local fine : adviceBlackness 4
|
|
include : dispiro
|
|
widths.rhs fine
|
|
flat pwlNear pwlBot
|
|
curl pwlFar pwlTop
|
|
save [MangleName 'pwlSlashTopLeft'] [MangleUnicode 0xE0BD]
|
|
|
|
sketch # pwlCornerBottomRight
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include glyphs.[MangleName 'pwlCornerTopLeft']
|
|
include : FlipAround (MosaicWidth / 2) pwlMid
|
|
save [MangleName 'pwlCornerBottomRight'] [MangleUnicode 0xE0BA]
|
|
|
|
sketch # pwlSlashBottomRight
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include glyphs.[MangleName 'pwlSlashTopLeft']
|
|
include : FlipAround (MosaicWidth / 2) pwlMid
|
|
save [MangleName 'pwlSlashBottomRight'] [MangleUnicode 0xE0BB]
|
|
|
|
sketch # pwlCornerTopRight
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include glyphs.[MangleName 'pwlCornerBottomLeft']
|
|
include : FlipAround (MosaicWidth / 2) pwlMid
|
|
save [MangleName 'pwlCornerTopRight'] [MangleUnicode 0xE0BE]
|
|
|
|
sketch # pwlSlashTopRight
|
|
set-width MosaicWidth
|
|
include : ForceUpright
|
|
include glyphs.[MangleName 'pwlSlashBottomLeft']
|
|
include : FlipAround (MosaicWidth / 2) pwlMid
|
|
save [MangleName 'pwlSlashTopRight'] [MangleUnicode 0xE0BF]
|