@xterm/addon-ligatures 0.8.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ ## @xterm/addon-ligatures
2
+
3
+ Add support for programming ligatures to [xterm.js] when running in environments with access to [Node.js] APIs (such as [Electron]).
4
+
5
+ ### Requirements
6
+
7
+ * [Node.js] 8.x or higher (present in [Electron] 1.8.3 or higher)
8
+ * [xterm.js] 4.0.0 or higher using the default canvas renderer
9
+
10
+ ### Install
11
+
12
+ ```bash
13
+ npm install --save @xterm/addon-ligatures
14
+ ```
15
+
16
+ ### Usage
17
+
18
+ ```ts
19
+ import { Terminal } from '@xterm/xterm';
20
+ import { LigaturesAddon } from '@xterm/addon-ligatures';
21
+
22
+ const terminal = new Terminal();
23
+ const ligaturesAddon = new LigaturesAddon();
24
+ terminal.open(containerElement);
25
+ terminal.loadAddon(ligaturesAddon);
26
+ ```
27
+
28
+ ### How It Works
29
+
30
+ 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.
31
+
32
+ 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.
33
+
34
+ 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]).
35
+
36
+ ### Fallback Ligatures
37
+
38
+ 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`.
39
+
40
+ ### Fonts
41
+
42
+ This package makes use of the following fonts for testing:
43
+
44
+ * [Fira Code][Fira Code] - [Licensed under the OFL][Fira Code License] by Nikita Prokopov, Mozilla Foundation with reserved names Fira Code, Fira Mono, and Fira Sans
45
+ * [Iosevka] - [Licensed under the OFL][Iosevka License] by Belleve Invis with reserved name Iosevka
46
+
47
+ [xterm.js]: https://github.com/xtermjs/xterm.js
48
+ [Electron]: https://electronjs.org/
49
+ [Node.js]: https://nodejs.org/
50
+ [font-ligatures]: https://github.com/princjef/font-ligatures
51
+ [Fira Code]: https://github.com/tonsky/FiraCode
52
+ [Fira Code License]: https://github.com/tonsky/FiraCode/blob/master/LICENSE
53
+ [Iosevka]: https://github.com/be5invis/Iosevka
54
+ [Iosevka License]: https://github.com/be5invis/Iosevka/blob/master/LICENSE.md
55
+