JSPM

@daiyam/xterm-tab-addon-ligatures

0.10.0-beta.118.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q83159F
  • License MIT

Add support for programming ligatures to xterm.js

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@daiyam/xterm-tab-addon-ligatures) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @xterm/addon-ligatures

    Add support for programming ligatures to xterm.js when running in environments with access to Node.js APIs (such as Electron).

    Requirements

    • Node.js 8.x or higher (present in Electron 1.8.3 or higher)
    • xterm.js 4.0.0 or higher using the default canvas renderer

    Install

    npm install --save @xterm/addon-ligatures

    Usage

    import { Terminal } from '@daiyam/xterm-tab';
    import { LigaturesAddon } from 'xterm-addon-ligatures';
    
    const terminal = new Terminal();
    const ligaturesAddon = new LigaturesAddon();
    terminal.open(containerElement);
    terminal.loadAddon(ligaturesAddon);

    How It Works

    In a browser environment, font ligature information is read directly by the web browser and used to render text correctly without any intervention from the developer. As of version 3, xterm.js uses the canvas to render characters individually, resulting in a significant performance boost. However, this means that it can no longer lean on the browser to determine when to draw font ligatures.

    This package locates the font file on disk for the font currently in use by the terminal and parses the ligature information out of it (via the font-ligatures package). As text is rendered in xterm.js, this package annotates it with the locations of ligatures, allowing xterm.js to render it correctly.

    Since this package depends on being able to find and resolve a system font from disk, it has to have system access that isn't available in the web browser. As a result, this package is mainly useful in environments that combine browser and Node.js runtimes (such as Electron).

    Fallback Ligatures

    When ligatures cannot be fetched from the environment, a set of "fallback" ligatures is used to get the most common ligatures working. These fallback ligatures can be customized with options passed to LigatureAddon.constructor.

    Fonts

    This package makes use of the following fonts for testing: