Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 4, 2020. It is now read-only.

An xterm.js addon that provides font ligature support

License

NotificationsYou must be signed in to change notification settings

xtermjs/xterm-addon-ligatures

⚠️ This addon has moved to the corextermjs/xterm.js repo⚠️

Add support for programming ligatures toxterm.js when running inenvironments with access toNode.js APIs (such asElectron).

Requirements

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

Usage

Install in your project by running:

npm install xterm-addon-ligatures

Then, modify the location where you initialize the terminal to enable ligaturesupport after opening. If you enable ligatures prior to opening the terminal,they will not function properly.

Your code should look something like this:

import{Terminal}from'xterm';import*asligaturesfrom'xterm-addon-ligatures';Terminal.applyAddon(ligatures);constterminal=newTerminal();terminal.open(document.getElementById('terminal-mount'));terminal.enableLigatures();

Importing in TypeScript

If you use TypeScript, you will need to cast the terminal variable asany whenyou enable ligatures because TypeScript does not know that the addon isavailable on the terminal object. It will look like this:

(terminalasany).enableLigatures()

Alternatively, you can import the addon directly as a function and pass theterminal as an argument:

import{Terminal}from'xterm';import{enableLigatures}from'xterm-addon-ligatures';constterminal=newTerminal();terminal.open(document.getElementById('terminal-mount'));enableLigatures(terminal);

How It Works

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

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

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

Fonts

This package makes use of the following fonts for testing:

About

An xterm.js addon that provides font ligature support

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2026 Movatter.jp