mirror of
https://github.com/be5invis/Iosevka.git
synced 2026-10-28 08:28:01 +00:00
81 lines
2.7 KiB
Plaintext
Executable File
81 lines
2.7 KiB
Plaintext
Executable File
###### Braille symbols
|
|
$$include '../meta/macros.ptl'
|
|
|
|
import [mix linreg clamp fallback] from '../support/utils'
|
|
import [designParameters] from '../meta/aesthetics'
|
|
|
|
# Needed for bitwise operators
|
|
import '../support/mask-bit' as maskBit
|
|
|
|
export : define [apply] : begin
|
|
glyph-module-entry commonShapes overmarks
|
|
|
|
if recursive : return nothing
|
|
local left : MIDDLE - (0.25 * WIDTH)
|
|
local right : MIDDLE + (0.25 * WIDTH)
|
|
local offsetY : 0.3 * (symbolMid - operBot)
|
|
local stress : 0.5 * [adviceBlackness 3.375]
|
|
local dotRadius : PERIODRADIUS * [Math.min 1 (stress / HALFSTROKE)]
|
|
|
|
### Blank
|
|
sketch # brailleBlank
|
|
set-width WIDTH
|
|
save 'brailleBlank' 0x2800
|
|
|
|
### Computed Braille Patterns
|
|
###
|
|
### Bit to Dot mapping:
|
|
### 0 3
|
|
### 1 4
|
|
### 2 5
|
|
### 6 7
|
|
###
|
|
foreach [byte : range 1 256] : sketch
|
|
local dots {}
|
|
local [y-coord y] (symbolMid + y * offsetY)
|
|
# Is there a way to directly use (byte & (1 << bit)) here?
|
|
foreach [bit : range 0 8] : if [maskBit byte bit] : begin
|
|
include : match bit
|
|
0 : DotAt left [y-coord (-3)] dotRadius
|
|
1 : DotAt left [y-coord (-1)] dotRadius
|
|
2 : DotAt left [y-coord 1 ] dotRadius
|
|
3 : DotAt right [y-coord (-3)] dotRadius
|
|
4 : DotAt right [y-coord (-1)] dotRadius
|
|
5 : DotAt right [y-coord 1 ] dotRadius
|
|
6 : DotAt left [y-coord 3 ] dotRadius
|
|
7 : DotAt right [y-coord 3 ] dotRadius
|
|
dots.push (bit + 1) # Match numerals in Unicode spec
|
|
set currentGlyph.cmpPriority (-101)
|
|
save ("braille" + [dots.join '']) (0x2800 + byte)
|
|
|
|
set glyphs.braille7.cmpPriority 101
|
|
set glyphs.braille37.cmpPriority 102
|
|
set glyphs.braille3.cmpPriority 101
|
|
set glyphs.braille237.cmpPriority 103
|
|
set glyphs.braille27.cmpPriority 102
|
|
set glyphs.braille23.cmpPriority 102
|
|
set glyphs.braille2.cmpPriority 101
|
|
set glyphs.braille1237.cmpPriority 104
|
|
set glyphs.braille123.cmpPriority 103
|
|
set glyphs.braille127.cmpPriority 103
|
|
set glyphs.braille137.cmpPriority 103
|
|
set glyphs.braille13.cmpPriority 102
|
|
set glyphs.braille12.cmpPriority 102
|
|
set glyphs.braille17.cmpPriority 102
|
|
set glyphs.braille1.cmpPriority 101
|
|
set glyphs.braille7.flatten true
|
|
set glyphs.braille37.flatten true
|
|
set glyphs.braille3.flatten true
|
|
set glyphs.braille237.flatten true
|
|
set glyphs.braille27.flatten true
|
|
set glyphs.braille23.flatten true
|
|
set glyphs.braille2.flatten true
|
|
set glyphs.braille1237.flatten true
|
|
set glyphs.braille123.flatten true
|
|
set glyphs.braille127.flatten true
|
|
set glyphs.braille137.flatten true
|
|
set glyphs.braille13.flatten true
|
|
set glyphs.braille12.flatten true
|
|
set glyphs.braille17.flatten true
|
|
set glyphs.braille1.flatten true
|