Support path without function

This commit is contained in:
Daniel Imms
2025-12-22 11:46:53 -08:00
parent 3d9e976cb3
commit efd6a52033
3 changed files with 67 additions and 71 deletions
@@ -9,6 +9,7 @@ import { CustomGlyphDefinitionType, CustomGlyphVectorType, type CustomGlyphChara
export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefinition | undefined } = {
// #region Block elements (2580-259F)
// https://www.unicode.org/charts/PDF/U2580.pdf
// Block elements (2580-2590)
@@ -62,15 +63,11 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi
// #endregion
// #region Symbols for Legacy Computing
// #region Symbols for Legacy Computing (1FB00-1FB3B)
// https://www.unicode.org/charts/PDF/U1FB00.pdf
// Block sextants (0x1FB00-0x1FB3B)
// Each sextant is a 2x3 grid of cells in an 8x8 block
// Cell positions: bit 0=top-left, bit 1=top-right, bit 2=middle-left, bit 3=middle-right,
// bit 4=bottom-left, bit 5=bottom-right
// Patterns 0 (empty), 21 (left half), 42 (right half), 63 (full) are excluded as they exist
// elsewhere
// Block sextants (1FB00-1FB3B)
'\u{1FB00}': sextant(0b000001), // BLOCK SEXTANT-1
'\u{1FB01}': sextant(0b000010), // BLOCK SEXTANT-2
'\u{1FB02}': sextant(0b000011), // BLOCK SEXTANT-12 (upper one third block)
@@ -91,7 +88,6 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi
'\u{1FB11}': sextant(0b010010), // BLOCK SEXTANT-25
'\u{1FB12}': sextant(0b010011), // BLOCK SEXTANT-125
'\u{1FB13}': sextant(0b010100), // BLOCK SEXTANT-35
// Pattern 21 (0x15 = 0b010101) = left half block, skipped (exists as U+258C)
'\u{1FB14}': sextant(0b010110), // BLOCK SEXTANT-235
'\u{1FB15}': sextant(0b010111), // BLOCK SEXTANT-1235
'\u{1FB16}': sextant(0b011000), // BLOCK SEXTANT-45
@@ -112,7 +108,6 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi
'\u{1FB25}': sextant(0b100111), // BLOCK SEXTANT-1236
'\u{1FB26}': sextant(0b101000), // BLOCK SEXTANT-46
'\u{1FB27}': sextant(0b101001), // BLOCK SEXTANT-146
// Pattern 42 (0x2A = 0b101010) = right half block, skipped (exists as U+2590)
'\u{1FB28}': sextant(0b101011), // BLOCK SEXTANT-1246
'\u{1FB29}': sextant(0b101100), // BLOCK SEXTANT-346
'\u{1FB2A}': sextant(0b101101), // BLOCK SEXTANT-1346
@@ -133,81 +128,79 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi
'\u{1FB39}': sextant(0b111100), // BLOCK SEXTANT-3456 (lower two thirds block)
'\u{1FB3A}': sextant(0b111101), // BLOCK SEXTANT-13456
'\u{1FB3B}': sextant(0b111110), // BLOCK SEXTANT-23456
// Pattern 63 (0x3F = 0b111111) = full block, skipped (exists as U+2588)
// Smooth mosaic terminal graphic characters (0x1FB3C-0x1FB6F)
// Smooth mosaic terminal graphic characters (1FB3C-1FB6F)
// These are triangular/diagonal shapes. "X BLOCK DIAGONAL A TO B" means the X region is filled,
// with a diagonal edge from point A to point B.
// Reference points: upper/lower = y (0/1), left/right = x (0/1), centre = x=0.5
// Vertical uses sextant grid: upper-middle = y=1/3, lower-middle = y=2/3
// TODO: These don't need to be functions, also inline fractions
// LOWER LEFT BLOCK variants (1FB3C-1FB40) - filled region in lower-left
'\u{1FB3C}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L0,1 L0.5,1 Z` }, // LOWER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB3D}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L0,1 L1,1 Z` }, // LOWER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB3E}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L0,1 L0.5,1 Z` }, // LOWER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB3F}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L0,1 L1,1 Z` }, // LOWER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB40}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L0,1 L0.5,1 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER LEFT TO LOWER CENTRE
'\u{1FB3C}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L0,1 L0.5,1 Z' }, // LOWER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB3D}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L0,1 L1,1 Z' }, // LOWER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB3E}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L0,1 L0.5,1 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB3F}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L0,1 L1,1 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB40}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L0,1 L0.5,1 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER LEFT TO LOWER CENTRE
// LOWER RIGHT BLOCK variants (1FB41-1FB4B) - filled region in lower-right
'\u{1FB41}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L0.5,0 L1,0 L1,1 L0,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB42}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L1,0 L1,1 L0,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB43}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L0.5,0 L1,0 L1,1 L0,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB44}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L1,0 L1,1 L0,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB45}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,1 L0.5,0 L1,0 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER LEFT TO UPPER CENTRE
'\u{1FB46}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L1,${1/3} L1,1 L0,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER MIDDLE RIGHT
'\u{1FB47}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,1 L1,${2/3} L1,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL LOWER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB48}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,1 L1,${2/3} L1,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL LOWER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB49}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,1 L1,${1/3} L1,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL LOWER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB4A}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,1 L1,${1/3} L1,1 Z` }, // LOWER RIGHT BLOCK DIAGONAL LOWER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB4B}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0.5,1 L1,0 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER CENTRE TO UPPER RIGHT
'\u{1FB41}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L0.5,0 L1,0 L1,1 L0,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB42}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L1,0 L1,1 L0,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB43}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L0.5,0 L1,0 L1,1 L0,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB44}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L1,0 L1,1 L0,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB45}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,1 L0.5,0 L1,0 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER LEFT TO UPPER CENTRE
'\u{1FB46}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L1,0.3333 L1,1 L0,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER MIDDLE RIGHT
'\u{1FB47}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,1 L1,0.6667 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB48}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,1 L1,0.6667 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB49}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,1 L1,0.3333 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB4A}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,1 L1,0.3333 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB4B}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,1 L1,0 L1,1 Z' }, // LOWER RIGHT BLOCK DIAGONAL LOWER CENTRE TO UPPER RIGHT
// LOWER LEFT BLOCK variants continued (1FB4C-1FB51) - large fills with upper-right cut
'\u{1FB4C}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,0 L0,0 L0,1 L1,1 L1,${1/3} Z` }, // LOWER LEFT BLOCK DIAGONAL UPPER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB4D}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,0 L0,1 L1,1 L1,${1/3} Z` }, // LOWER LEFT BLOCK DIAGONAL UPPER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB4E}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,0 L0,0 L0,1 L1,1 L1,${2/3} Z` }, // LOWER LEFT BLOCK DIAGONAL UPPER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB4F}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,0 L0,1 L1,1 L1,${2/3} Z` }, // LOWER LEFT BLOCK DIAGONAL UPPER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB50}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0.5,0 L0,0 L0,1 L1,1 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER CENTRE TO LOWER RIGHT
'\u{1FB51}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L0,1 L1,1 L1,${2/3} Z` }, // LOWER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER MIDDLE RIGHT
'\u{1FB4C}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,0 L0,0 L0,1 L1,1 L1,0.3333 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB4D}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L0,1 L1,1 L1,0.3333 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB4E}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,0 L0,0 L0,1 L1,1 L1,0.6667 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB4F}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L0,1 L1,1 L1,0.6667 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB50}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,0 L0,0 L0,1 L1,1 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER CENTRE TO LOWER RIGHT
'\u{1FB51}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L0,1 L1,1 L1,0.6667 Z' }, // LOWER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER MIDDLE RIGHT
// UPPER RIGHT BLOCK variants (1FB52-1FB56) - large fills with lower-left cut
'\u{1FB52}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L0.5,1 L1,1 L1,0 L0,0 Z` }, // UPPER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB53}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L1,1 L1,0 L0,0 Z` }, // UPPER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB54}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L0.5,1 L1,1 L1,0 L0,0 Z` }, // UPPER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB55}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L1,1 L1,0 L0,0 Z` }, // UPPER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB56}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L0.5,1 L1,1 L1,0 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER LEFT TO LOWER CENTRE
'\u{1FB52}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L0.5,1 L1,1 L1,0 L0,0 Z' }, // UPPER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB53}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L1,1 L1,0 L0,0 Z' }, // UPPER RIGHT BLOCK DIAGONAL LOWER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB54}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L0.5,1 L1,1 L1,0 L0,0 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER CENTRE
'\u{1FB55}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L1,1 L1,0 L0,0 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER RIGHT
'\u{1FB56}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L0.5,1 L1,1 L1,0 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER LEFT TO LOWER CENTRE
// UPPER LEFT BLOCK variants (1FB57-1FB61) - small to large fills in upper-left
'\u{1FB57}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L0,0 L0.5,0 Z` }, // UPPER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB58}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L0,0 L1,0 Z` }, // UPPER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB59}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L0,0 L0.5,0 Z` }, // UPPER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB5A}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L0,0 L1,0 Z` }, // UPPER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB5B}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,1 L0,0 L0.5,0 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER LEFT TO UPPER CENTRE
'\u{1FB5C}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${2/3} L0,0 L1,0 L1,${1/3} Z` }, // UPPER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER MIDDLE RIGHT
'\u{1FB5D}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,1 L0,1 L0,0 L1,0 L1,${2/3} Z` }, // UPPER LEFT BLOCK DIAGONAL LOWER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB5E}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,1 L0,0 L1,0 L1,${2/3} Z` }, // UPPER LEFT BLOCK DIAGONAL LOWER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB5F}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,1 L0,1 L0,0 L1,0 L1,${1/3} Z` }, // UPPER LEFT BLOCK DIAGONAL LOWER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB60}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,1 L0,0 L1,0 L1,${1/3} Z` }, // UPPER LEFT BLOCK DIAGONAL LOWER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB61}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0.5,1 L0,1 L0,0 L1,0 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER CENTRE TO UPPER RIGHT
'\u{1FB57}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L0,0 L0.5,0 Z' }, // UPPER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB58}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L0,0 L1,0 Z' }, // UPPER LEFT BLOCK DIAGONAL UPPER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB59}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L0,0 L0.5,0 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER CENTRE
'\u{1FB5A}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L0,0 L1,0 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER RIGHT
'\u{1FB5B}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,1 L0,0 L0.5,0 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER LEFT TO UPPER CENTRE
'\u{1FB5C}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.6667 L0,0 L1,0 L1,0.3333 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER MIDDLE LEFT TO UPPER MIDDLE RIGHT
'\u{1FB5D}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,1 L0,1 L0,0 L1,0 L1,0.6667 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB5E}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,1 L0,0 L1,0 L1,0.6667 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB5F}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,1 L0,1 L0,0 L1,0 L1,0.3333 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB60}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,1 L0,0 L1,0 L1,0.3333 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB61}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,1 L0,1 L0,0 L1,0 Z' }, // UPPER LEFT BLOCK DIAGONAL LOWER CENTRE TO UPPER RIGHT
// UPPER RIGHT BLOCK variants continued (1FB62-1FB67) - small to medium fills in upper-right
'\u{1FB62}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,0 L1,0 L1,${1/3} Z` }, // UPPER RIGHT BLOCK DIAGONAL UPPER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB63}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,0 L1,0 L1,${1/3} Z` }, // UPPER RIGHT BLOCK DIAGONAL UPPER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB64}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0.5,0 L1,0 L1,${2/3} Z` }, // UPPER RIGHT BLOCK DIAGONAL UPPER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB65}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,0 L1,0 L1,${2/3} Z` }, // UPPER RIGHT BLOCK DIAGONAL UPPER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB66}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0.5,0 L1,0 L1,1 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER CENTRE TO LOWER RIGHT
'\u{1FB67}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => `M0,${1/3} L1,${2/3} L1,0 L0,0 Z` }, // UPPER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER MIDDLE RIGHT
'\u{1FB62}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,0 L1,0 L1,0.3333 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER CENTRE TO UPPER MIDDLE RIGHT
'\u{1FB63}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L1,0 L1,0.3333 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER LEFT TO UPPER MIDDLE RIGHT
'\u{1FB64}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,0 L1,0 L1,0.6667 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER CENTRE TO LOWER MIDDLE RIGHT
'\u{1FB65}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L1,0 L1,0.6667 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER LEFT TO LOWER MIDDLE RIGHT
'\u{1FB66}': { type: CustomGlyphDefinitionType.PATH, data: 'M0.5,0 L1,0 L1,1 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER CENTRE TO LOWER RIGHT
'\u{1FB67}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0.3333 L1,0.6667 L1,0 L0,0 Z' }, // UPPER RIGHT BLOCK DIAGONAL UPPER MIDDLE LEFT TO LOWER MIDDLE RIGHT
// Triangular blocks (1FB68-1FB6F)
// Three-quarter blocks: full block minus one triangular quarter pointing to center
'\u{1FB68}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L1,0 L1,1 L0,1 L0.5,0.5 Z' }, // UPPER AND RIGHT AND LOWER TRIANGULAR THREE QUARTERS BLOCK (missing left)
'\u{1FB69}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L0.5,0.5 L1,0 L1,1 L0,1 Z' }, // LEFT AND LOWER AND RIGHT TRIANGULAR THREE QUARTERS BLOCK (missing upper)
'\u{1FB6A}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L1,0 L0.5,0.5 L1,1 L0,1 Z' }, // UPPER AND LEFT AND LOWER TRIANGULAR THREE QUARTERS BLOCK (missing right)
'\u{1FB6B}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L1,0 L1,1 L0.5,0.5 L0,1 Z' }, // LEFT AND UPPER AND RIGHT TRIANGULAR THREE QUARTERS BLOCK (missing lower)
'\u{1FB6C}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L0.5,0.5 L0,1 Z' }, // LEFT TRIANGULAR ONE QUARTER BLOCK
'\u{1FB6D}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,0 L1,0 L0.5,0.5 Z' }, // UPPER TRIANGULAR ONE QUARTER BLOCK
'\u{1FB6E}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M1,0 L1,1 L0.5,0.5 Z' }, // RIGHT TRIANGULAR ONE QUARTER BLOCK
'\u{1FB6F}': { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: () => 'M0,1 L1,1 L0.5,0.5 Z' }, // LOWER TRIANGULAR ONE QUARTER BLOCK
'\u{1FB68}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L1,0 L1,1 L0,1 L0.5,0.5 Z' }, // UPPER AND RIGHT AND LOWER TRIANGULAR THREE QUARTERS BLOCK (missing left)
'\u{1FB69}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L0.5,0.5 L1,0 L1,1 L0,1 Z' }, // LEFT AND LOWER AND RIGHT TRIANGULAR THREE QUARTERS BLOCK (missing upper)
'\u{1FB6A}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L1,0 L0.5,0.5 L1,1 L0,1 Z' }, // UPPER AND LEFT AND LOWER TRIANGULAR THREE QUARTERS BLOCK (missing right)
'\u{1FB6B}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L1,0 L1,1 L0.5,0.5 L0,1 Z' }, // LEFT AND UPPER AND RIGHT TRIANGULAR THREE QUARTERS BLOCK (missing lower)
'\u{1FB6C}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L0.5,0.5 L0,1 Z' }, // LEFT TRIANGULAR ONE QUARTER BLOCK
'\u{1FB6D}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,0 L1,0 L0.5,0.5 Z' }, // UPPER TRIANGULAR ONE QUARTER BLOCK
'\u{1FB6E}': { type: CustomGlyphDefinitionType.PATH, data: 'M1,0 L1,1 L0.5,0.5 Z' }, // RIGHT TRIANGULAR ONE QUARTER BLOCK
'\u{1FB6F}': { type: CustomGlyphDefinitionType.PATH, data: 'M0,1 L1,1 L0.5,0.5 Z' }, // LOWER TRIANGULAR ONE QUARTER BLOCK
// #endregion
};
@@ -288,9 +281,9 @@ export const blockElementDefinitions: { [index: string]: ICustomGlyphSolidOctant
* @param pattern A 6-bit pattern where bit 0 = top-left, bit 1 = top-right, bit 2 = middle-left,
* bit 3 = middle-right, bit 4 = bottom-left, bit 5 = bottom-right
*/
function sextant(pattern: number): { type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: CustomGlyphPathDrawFunctionDefinition } {
function sextant(pattern: number): { type: CustomGlyphDefinitionType.PATH_FUNCTION, data: CustomGlyphPathDrawFunctionDefinition } {
return {
type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION,
type: CustomGlyphDefinitionType.PATH_FUNCTION,
data: () => {
// Sextant grid: 2 columns, 3 rows
// Row heights in 8ths: top=3, middle=2, bottom=3
@@ -30,7 +30,8 @@ export function tryDrawCustomGlyph(
case CustomGlyphDefinitionType.BLOCK_PATTERN:
drawPatternChar(ctx, unifiedCharDefinition.data, xOffset, yOffset, deviceCellWidth, deviceCellHeight);
return true;
case CustomGlyphDefinitionType.PATH_DRAW_FUNCTION:
case CustomGlyphDefinitionType.PATH_FUNCTION:
case CustomGlyphDefinitionType.PATH:
drawPathDefinitionCharacter(ctx, unifiedCharDefinition.data, xOffset, yOffset, deviceCellWidth, deviceCellHeight);
return true;
}
@@ -92,13 +93,13 @@ function drawBlockVectorChar(
function drawPathDefinitionCharacter(
ctx: CanvasRenderingContext2D,
charDefinition: CustomGlyphPathDrawFunctionDefinition,
charDefinition: CustomGlyphPathDrawFunctionDefinition | string,
xOffset: number,
yOffset: number,
deviceCellWidth: number,
deviceCellHeight: number
): void {
const instructions = charDefinition(0, 0);
const instructions = typeof charDefinition === 'string' ? charDefinition : charDefinition(0, 0);
ctx.beginPath();
for (const instruction of instructions.split(' ')) {
const type = instruction[0];
+4 -2
View File
@@ -33,11 +33,13 @@ export type CustomGlyphPatternDefinition = number[][];
export const enum CustomGlyphDefinitionType {
SOLID_OCTANT_BLOCK_VECTOR,
BLOCK_PATTERN,
PATH_DRAW_FUNCTION,
PATH_FUNCTION,
PATH,
}
export type CustomGlyphCharacterDefinition = (
{ type: CustomGlyphDefinitionType.SOLID_OCTANT_BLOCK_VECTOR, data: ICustomGlyphSolidOctantBlockVector[] } |
{ type: CustomGlyphDefinitionType.BLOCK_PATTERN, data: CustomGlyphPatternDefinition } |
{ type: CustomGlyphDefinitionType.PATH_DRAW_FUNCTION, data: CustomGlyphPathDrawFunctionDefinition }
{ type: CustomGlyphDefinitionType.PATH_FUNCTION, data: CustomGlyphPathDrawFunctionDefinition } |
{ type: CustomGlyphDefinitionType.PATH, data: string }
);