diff --git a/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts b/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts index 0ce82e09..1468aea9 100644 --- a/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts +++ b/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts @@ -63,7 +63,7 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi // #endregion - // #region Powerline symbols (E0A0-E0BF) + // #region Powerline Symbols (E0A0-E0BF) // This contains the definitions of the primarily used box drawing characters as vector shapes. // The reason these characters are defined specially is to avoid common problems if a user's font @@ -89,6 +89,9 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi '\u{E0B2}': { type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: { d: 'M1,0 L0,.5 L1,1', type: CustomGlyphVectorType.FILL, leftPadding: 2 } }, // Left triangle line '\u{E0B3}': { type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: { d: 'M2,-.5 L0,.5 L2,1.5', type: CustomGlyphVectorType.STROKE, leftPadding: 1, rightPadding: 1 } }, + + // Powerline Extra Symbols + // Right semi-circle solid '\u{E0B4}': { type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: { d: 'M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0', type: CustomGlyphVectorType.FILL, rightPadding: 1 } }, // Right semi-circle line diff --git a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts index b59da1db..4d8e9f9c 100644 --- a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts +++ b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts @@ -4,7 +4,7 @@ */ import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils'; -import { blockElementDefinitions, boxDrawingDefinitions, powerlineDefinitions, unifiedCharDefinitions } from 'customGlyphs/CustomGlyphDefinitions'; +import { blockElementDefinitions, boxDrawingDefinitions, unifiedCharDefinitions } from 'customGlyphs/CustomGlyphDefinitions'; import { CustomGlyphDefinitionType, CustomGlyphVectorType, type CustomGlyphPathDrawFunctionDefinition, type CustomGlyphPatternDefinition, type CustomGlyphRegionDefinition, type ICustomGlyphSolidOctantBlockVector, type ICustomGlyphVectorShape } from 'customGlyphs/Types'; /** diff --git a/demo/client.ts b/demo/client.ts index 4bb27fed..245d13aa 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -849,6 +849,13 @@ function customGlyphRangesHandler(): void { ['Block elements', 0x2594, 0x2595], ['Terminal graphic characters', 0x2596, 0x259F], ]); + // Powerline Symbols + // Range: E0A0–E0BF + // https://github.com/ryanoasis/nerd-fonts + writeUnicodeTable(term, 'Powerline Symbols', 0xE0A0, 0xE0BF, [ + ['Powerline Symbols', 0xE0A0, 0xE0B3], + ['Powerline Extra Symbols', 0xE0B4, 0xE0BF], + ]); // Symbols for Legacy Computing // Range: 1FB00–1FBFF // https://www.unicode.org/charts/PDF/U1FB00.pdf diff --git a/demo/unicodeTable.ts b/demo/unicodeTable.ts index 0fe6a566..23b2a9fa 100644 --- a/demo/unicodeTable.ts +++ b/demo/unicodeTable.ts @@ -71,7 +71,8 @@ export function writeUnicodeTable(term: Terminal, name: string, start: number, e // If labels exist and don't start at column 0, first output chars before first label if (rowLabels.length > 0 && rowLabels[0].col > 0) { const rowHex = row.toString(16).toUpperCase(); - term.write(bold('U+' + rowHex + 'x ')); + const rowPrefix = `U+${rowHex}x`.padEnd(8, ' '); + term.write(bold(rowPrefix)); for (let col = 0; col < rowLabels[0].col; col++) { const codePoint = row * 16 + col; term.write(' '); @@ -93,7 +94,7 @@ export function writeUnicodeTable(term: Terminal, name: string, start: number, e if (rowLabels.length > 0) { // Render label lines from top to bottom (first label on top, last label closest to row) for (let i = 0; i < rowLabels.length; i++) { - const prefix = ' '; // Same width as "U+1FB0x " + const prefix = ' '.repeat(8); // Same width as "U+1FB0x " let line = ''; let visualLen = 0; // Track visual length separately from string length (escape codes don't count) for (let col = 0; col < 16; col++) { @@ -117,7 +118,7 @@ export function writeUnicodeTable(term: Terminal, name: string, start: number, e // Row prefix (e.g., "U+1FB0x ") const rowHex = row.toString(16).toUpperCase(); - const rowPrefix = 'U+' + rowHex + 'x '; + const rowPrefix = `U+${rowHex}x`.padEnd(8, ' '); const isSecondPrint = rowLabels.length > 0 && rowLabels[0].col > 0; term.write(isSecondPrint ? ' '.repeat(rowPrefix.length) : bold(rowPrefix));