Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petermikitsh/ligatures
Get ligatures for fonts
https://github.com/petermikitsh/ligatures
fontkit ligatures
Last synced: 3 months ago
JSON representation
Get ligatures for fonts
- Host: GitHub
- URL: https://github.com/petermikitsh/ligatures
- Owner: petermikitsh
- Created: 2020-05-15T05:58:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-28T20:53:53.000Z (about 4 years ago)
- Last Synced: 2024-10-05T13:07:57.949Z (3 months ago)
- Topics: fontkit, ligatures
- Language: TypeScript
- Homepage: https://petermikitsh.github.io/ligatures
- Size: 2.46 MB
- Stars: 9
- Watchers: 4
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ligatures
Uses [fontkit] to get an array of ligatures for a font. Useful for icon fonts. [Demo Site].
```
npm i ligatures
```
## Example
```js
const { getLigaturesFromPath } = require("ligatures");(async () => {
const ligatures = await getLigaturesFromPath("matIconFont.woff");
console.log(ligatures);
// [3d_rotation, 360, desktop_access_disabled, domain_verification, ...]
})();
```## API
```ts
export declare const getLigaturesFromPath: (
fontFilePath: string
) => Promise;export declare const getLigaturesFromBuffer: (
fontFileBuffer: Buffer
) => string[];
```## Why?
If you're creating design systems, you may have a component specifically for rendering icons, and that component may depend on a font file that uses ligatures to display icons.
You may want to create a TypeScript interface of the union of all possible ligatures for your font, providing intelliense and a generally superior developer experience to the consumers of your design system.
[demo site]: https://petermikitsh.github.io/ligatures
[fontkit]: https://github.com/foliojs/fontkit