@jsvision/core / fallbackGlyph
Function: fallbackGlyph()
fallbackGlyph(
char,caps):string
Defined in: render/glyphs.ts:92
Substitute a glyph for the terminal's capabilities.
Resolution order: ASCII ambiguous-chrome fallback (when ambiguousWide is on, most specific — its keys collide with no other table) → ASCII box fallback (when boxDrawing is off) → # for block/shade glyphs (when halfBlocks is off) → ? for any other code point above U+007F (when utf8 is off) → the glyph unchanged.
Parameters
char
string
A single buffer glyph (a continuation cell's empty string passes straight through).
caps
The resolved terminal capabilities.
Returns
string
The original glyph when supported, else its ASCII fallback.
Example
ts
import { fallbackGlyph, resolveCapabilities } from '@jsvision/core';
const caps = resolveCapabilities().profile;
fallbackGlyph('│', caps); // '│' on a UTF-8 terminal; '|' when box-drawing is unavailable
fallbackGlyph('█', caps); // '█' normally; '#' when half/solid blocks are unavailable