Compare commits
154 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77b3f4e7f3 | |||
| 141924ba82 | |||
| 7554d7ab76 | |||
| 1babf4977d | |||
| 0d4a55ed1f | |||
| 10dd25fd26 | |||
| 135f6eb156 | |||
| 4499ba4809 | |||
| fff435748f | |||
| eec76d8792 | |||
| 7a86cd065f | |||
| 834a086e09 | |||
| 298723b87e | |||
| 0956c0e569 | |||
| 30ef51ace3 | |||
| 8aa2677ffc | |||
| 5c25311fdf | |||
| a55ef07837 | |||
| 09bbb2bb76 | |||
| 4ff7dbde28 | |||
| 0d7089f840 | |||
| 8a32259fdc | |||
| ee481cc744 | |||
| 196e13856c | |||
| 2029e07965 | |||
| 4955c58098 | |||
| c63a5b0abb | |||
| 8f7db7bc4c | |||
| 3813319b42 | |||
| f2a61c74ad | |||
| 1fce61fe50 | |||
| 1028c96291 | |||
| 043c160546 | |||
| 445828c8bf | |||
| 66fd3f94a1 | |||
| 9bf5f6197c | |||
| bd48389313 | |||
| 30a6c098e7 | |||
| 42e64f84b8 | |||
| 124d893fe5 | |||
| e692fcfbf8 | |||
| 321486d19e | |||
| 6f3d00ae6d | |||
| 420eeefe59 | |||
| a5c360bf30 | |||
| 93d4d03ef5 | |||
| 59435e4ee8 | |||
| cad9759288 | |||
| d3940070ed | |||
| 320fb069f7 | |||
| d6c1df83ed | |||
| 0b29866a3e | |||
| 9a70d50924 | |||
| 68741971f1 | |||
| bfae141c75 | |||
| 844b55f7b2 | |||
| 0c226a60bc | |||
| 2dd2079309 | |||
| 6f14cd709a | |||
| 06b5464fd6 | |||
| dc2d35f1c5 | |||
| 0823ed98af | |||
| 7b6eb72e66 | |||
| 53e9951957 | |||
| 44fc9b5ead | |||
| a86034b38d | |||
| c1bb4a9197 | |||
| 77244583f0 | |||
| f26cecc4bf | |||
| 732a29a79f | |||
| 258531d577 | |||
| 4cf344a435 | |||
| 63002e7901 | |||
| 38eb637717 | |||
| 2dbdb2543c | |||
| 4b908ad07b | |||
| a6dc28a403 | |||
| 84a4863e1f | |||
| 6fe2acd518 | |||
| 25051cfb52 | |||
| f91b91b7df | |||
| 1ed5f8afe4 | |||
| e87797d070 | |||
| 4e50610989 | |||
| 009dac1619 | |||
| 43d7f44527 | |||
| 9abc800918 | |||
| 10027973d8 | |||
| a9b6b1305d | |||
| 85cdb5c0a4 | |||
| 22d1a4d16d | |||
| 59466b8dfa | |||
| 2ed7ab50b3 | |||
| 37caa3ddea | |||
| b70accff53 | |||
| da7425fbe9 | |||
| 2282dd3d5d | |||
| d7e18a4962 | |||
| d71b04356a | |||
| 651edc2b62 | |||
| 02818d15a9 | |||
| 5c9a5d51a8 | |||
| fc180099b8 | |||
| 1f5712ecae | |||
| 2cbf9d84cb | |||
| d1c8620f6d | |||
| 0f10f62920 | |||
| fd4b980b7c | |||
| 286e5f0820 | |||
| 6e66c37704 | |||
| ad3050a731 | |||
| da1abf02c6 | |||
| 3a03d21c90 | |||
| 05bc5eaa4e | |||
| 03114bf88d | |||
| 83f9a6d170 | |||
| f0a883ee62 | |||
| 6e3415763c | |||
| 2bdf134f70 | |||
| edbbc78b82 | |||
| 4edf9bc945 | |||
| 538de4ad67 | |||
| 3550ee0bb1 | |||
| 65b938fdc1 | |||
| c5112089cb | |||
| 22ebd8aab7 | |||
| fe530d1ea9 | |||
| 19727aecc5 | |||
| 7a3be9b579 | |||
| 371be6a082 | |||
| 86b1d66f15 | |||
| 5538ffe2b5 | |||
| 360402a197 | |||
| f7cafe55b3 | |||
| 9cef42b1fb | |||
| 8360f4ad81 | |||
| 73f188856f | |||
| d2c63ad1ca | |||
| 0a7eca61d4 | |||
| fc8827e17c | |||
| 150ed13829 | |||
| 502f445758 | |||
| d3c5604090 | |||
| 61cfbf075d | |||
| 28eb8b58e5 | |||
| 91c4421765 | |||
| 3ed59809de | |||
| 660c719779 | |||
| 610140f1de | |||
| b6f785bfc7 | |||
| bc46df5f1c | |||
| 5f13b9c918 | |||
| 9398884dc6 | |||
| 036e837e0c |
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"projectName": "operator-mono-lig",
|
||||
"projectOwner": "kiliman",
|
||||
"repoType": "github",
|
||||
"repoHost": "https://github.com",
|
||||
"files": ["README.md"],
|
||||
"imageSize": 100,
|
||||
"commit": true,
|
||||
"commitConvention": "none",
|
||||
"contributors": [
|
||||
{
|
||||
"login": "kiliman",
|
||||
"name": "Kiliman",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/47168?v=4",
|
||||
"profile": "https://github.com/kiliman",
|
||||
"contributions": ["code", "doc", "design"]
|
||||
},
|
||||
{
|
||||
"login": "mskelton",
|
||||
"name": "Mark Skelton",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/25914066?v=4",
|
||||
"profile": "https://github.com/mskelton",
|
||||
"contributions": ["design"]
|
||||
},
|
||||
{
|
||||
"login": "drod3763",
|
||||
"name": "Derick Rodriguez",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/7785716?v=4",
|
||||
"profile": "https://github.com/drod3763",
|
||||
"contributions": ["doc"]
|
||||
},
|
||||
{
|
||||
"login": "amitkparekh",
|
||||
"name": "Amit Parekh",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7276308?v=4",
|
||||
"profile": "https://github.com/amitkparekh",
|
||||
"contributions": ["doc", "design"]
|
||||
},
|
||||
{
|
||||
"login": "CandySunPlus",
|
||||
"name": "NikSun",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/502700?v=4",
|
||||
"profile": "https://github.com/CandySunPlus",
|
||||
"contributions": ["design"]
|
||||
},
|
||||
{
|
||||
"login": "Jakob6174",
|
||||
"name": "Jakob Pearson",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/40262817?v=4",
|
||||
"profile": "https://github.com/Jakob6174",
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "Kilua99",
|
||||
"name": "kilua99",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/44760686?v=4",
|
||||
"profile": "https://github.com/Kilua99",
|
||||
"contributions": ["doc"]
|
||||
},
|
||||
{
|
||||
"login": "GlorifiedBicycle",
|
||||
"name": "Reland Boyle",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/71753585?v=4",
|
||||
"profile": "https://github.com/GlorifiedBicycle",
|
||||
"contributions": ["doc"]
|
||||
},
|
||||
{
|
||||
"login": "killua99",
|
||||
"name": "Luigi",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/457822?v=4",
|
||||
"profile": "http://killua.me/",
|
||||
"contributions": ["doc"]
|
||||
},
|
||||
{
|
||||
"login": "tweks",
|
||||
"name": "Tomek Weksej",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/564556?v=4",
|
||||
"profile": "https://github.com/tweks",
|
||||
"contributions": ["code"]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
},
|
||||
extends: ['eslint:recommended', 'prettier'],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
},
|
||||
rules: {
|
||||
'linebreak-style': ['error', 'unix'],
|
||||
'no-console': 'off',
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
root: ./docs
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
name: New ligature
|
||||
about: Use this template for requesting new ligatures.
|
||||
title: "Create `[LIGATURE NAME]` ligature"
|
||||
labels: enhancement
|
||||
---
|
||||
|
||||
<!-- Please only request a single ligature per issue, unless you would like something which has both symmetrical pairs (e.g. {{ and }}) -->
|
||||
|
||||
## Request preferences
|
||||
|
||||
* Weight requested: _State which weight you would like, and whether it is for SSm or not._
|
||||
|
||||
|
||||
## Ligature description
|
||||
|
||||
_Please descirbe the ligature here as best you can. Feel free to use images/screenshots to help us get ideas of how to implement it._
|
||||
|
||||
---
|
||||
|
||||
### Ligature variations
|
||||
|
||||
Due to how development is handled, not all ligatures are created at the same time. However, we will get to them all eventually. If you would like to help us develop ligatures, please reach out to us via email at kiliman@gmail.com
|
||||
|
||||
#### Operator Mono
|
||||
|
||||
- [ ] XLight
|
||||
- [ ] XLight Italic
|
||||
- [ ] Light
|
||||
- [ ] Light Italic
|
||||
- [ ] Book
|
||||
- [ ] Book Italic
|
||||
- [ ] Medium
|
||||
- [ ] Medium Italic
|
||||
- [ ] Bold
|
||||
- [ ] Bold Italic
|
||||
|
||||
#### Operator Mono SSm
|
||||
|
||||
- [ ] SSm Light
|
||||
- [ ] SSm Light Italic
|
||||
- [ ] SSm Book
|
||||
- [ ] SSm Book Italic
|
||||
- [ ] SSm Medium
|
||||
- [ ] SSm Medium Italic
|
||||
- [ ] SSm Bold
|
||||
- [ ] SSm Bold Italic
|
||||
@@ -1,4 +1,6 @@
|
||||
build
|
||||
node_modules
|
||||
.vscode/launch.json
|
||||
.idea
|
||||
.vscode
|
||||
.DS_Store
|
||||
pnpm-lock.yaml
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": true
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"arrowParens": "avoid"
|
||||
}
|
||||
|
||||
@@ -1,12 +1,48 @@
|
||||
# Operator Mono Ligatures
|
||||
|
||||
[](#contributors-)
|
||||
|
||||
<img src="./images/operator-mono-lig.png" />
|
||||
|
||||
This project will generate new OpenType fonts for [Operator Mono](https://www.typography.com/fonts/operator/styles/) that includes ligatures similar to
|
||||
those found in the popular [Fira Code](https://github.com/tonsky/FiraCode) font.
|
||||
|
||||
These ligatures were custom created using [Glyphs](https://glyphsapp.com/).
|
||||
There are even italic versions of the ligatures.
|
||||
These ligatures were custom created using [Glyphs](https://glyphsapp.com/).
|
||||
There are even italic versions of the ligatures.
|
||||
|
||||
## Take the poll
|
||||
## 🎉 What's New in Version 2.5
|
||||
|
||||
<img src="./images/new-ligatures-2.5.png"/>
|
||||
|
||||
## 🎉 What's New in Version 2
|
||||
|
||||
<img src="./images/new-ligatures.png"/>
|
||||
|
||||
All new redesigned ligatures with better hinting. Updated font generation to support advanced OpenType features
|
||||
like those found in Fira Code. For example, the cursor now moves inside the ligature. It also handles repeating
|
||||
characters properly.
|
||||
|
||||
<img src="./images/caret-position.gif" />
|
||||
|
||||
## 👀 <a href="https://htmlpreview.github.io/?https://github.com/kiliman/operator-mono-lig/blob/master/images/preview/normal/index.html">Click here to see preview images of all ligatures</a>
|
||||
|
||||
With the awesome help from [Mark Skelton](https://github.com/mskelton), we now have the full set of ligatures for
|
||||
the following fonts. Thanks Mark, and thanks to all of you who have been patiently waiting for these ligatures to be completed.
|
||||
|
||||
- Operator Mono SSm Light/Light Italic
|
||||
- Operator Mono SSm Book/Book Italic
|
||||
- Operator Mono SSm Medium/Medium Italic
|
||||
- Operator Mono SSm Bold/Bold Italic
|
||||
- Operator Mono Light/Light Italic
|
||||
- Operator Mono Book/Book Italic
|
||||
|
||||
## 🙏 Help Wanted
|
||||
|
||||
As noted above, v2 does not include all weights for Operator Mono. In order to update the other fonts, all the ligatures need to be redone. Unfortunately I just don't have the time to do that at the moment. If you have a Mac and are interested in helping, please let me know. I will even purchase a license to Gylphs Mini for you.
|
||||
|
||||
You can reach me at kiliman@gmail.com.
|
||||
|
||||
## ☑️ Take the poll
|
||||
|
||||
Which font weight of Operator Mono do you use? Also note difference between Screen Smart (SSm) and regular version. This will help prioritize the order of development.
|
||||
|
||||
@@ -17,101 +53,134 @@ Which font weight of Operator Mono do you use? Also note difference between Scre
|
||||
[](https://api.gh-polls.com/poll/01C6T4C3FBG21KVS7FAW7Z09B2/Operator%20Mono%20Medium/vote)
|
||||
[](https://api.gh-polls.com/poll/01C6T4C3FBG21KVS7FAW7Z09B2/Operator%20Mono%20Light/vote)
|
||||
|
||||
I have updated the following fonts:
|
||||
|
||||
## ScreenSmart versions
|
||||
* Operator Mono SSm Book
|
||||
* Operator Mono SSm Book Italic
|
||||
* Operator Mono SSm Medium
|
||||
* Operator Mono SSm Medium Italic
|
||||
* Operator Mono SSm Light
|
||||
* Operator Mono SSm Light Italic (**coming soon**)
|
||||
|
||||
## Regular versions
|
||||
* Operator Mono Book
|
||||
* Operator Mono Book Italic
|
||||
* Operator Mono Medium
|
||||
* Operator Mono Medium Italic
|
||||
|
||||
**Operator Mono SSm Book**
|
||||
|
||||
<img src="./images/operator-mono-ssm-book.png" />
|
||||
|
||||
**Operator Mono SSm Medium**
|
||||
|
||||
<img src="./images/operator-mono-ssm-medium.png" />
|
||||
|
||||
**Creating ligatures using Glyphs**
|
||||
|
||||
<img src="./images/glyphs-screenshot.png" />
|
||||
|
||||
**YouTube video (click to view)**
|
||||
|
||||
[](https://youtu.be/ttI3W5Dh54E)
|
||||
|
||||
>NOTE: Because *Operator Mono* is not a free font, you must have the original font files. This utility
|
||||
will merge the ligature definitions into a copy of the original font. The new font family is named *Operator Mono Lig* so you can install it side-by-side with the original font.
|
||||
> NOTE: Because _Operator Mono_ is not a free font, you must have the original font files. This utility
|
||||
> will merge the ligature definitions into a copy of the original font. The new font family is named _Operator Mono Lig_ so you can install it side-by-side with the original font.
|
||||
|
||||
## Prerequisites
|
||||
* The original *Operator Mono* font... of course.
|
||||
* Install *fonttools* from https://github.com/fonttools/fonttools
|
||||
* Install Python
|
||||
* Run: `pip install fonttools` (for Mac users it's better run `pip3 install fonttools` - [info](https://stackoverflow.com/a/33416270/3191011))
|
||||
* Node.js (**version 7.6+ for async/await support**)
|
||||
|
||||
## How to Install
|
||||
- The original _Operator Mono_ font... of course.
|
||||
- Python (v2.7+)
|
||||
- **NOTE**: For Mac, the default system Python v2.7 doesn't work. Make sure you install Python 3.
|
||||
- Node.js
|
||||
- Install _fonttools_ from https://github.com/fonttools/fonttools
|
||||
- Windows/Linux: `pip install fonttools`
|
||||
- **NOTE**: For Windows you should use a console with administrative permissions if your Python sit under `C:\PythonX`
|
||||
- **NOTE**: For Linux in WSL/WSL2, ensure that _fonttools_ is added to PATH after install. Alternatively, consider installing via `sudo apt install fonttools`.
|
||||
- Mac: `pip3 install fonttools` (from Python 3)
|
||||
|
||||
1. Once all the prerequisites have been installed, clone this repo.
|
||||
## Installation
|
||||
|
||||
2. From the command line, run:
|
||||
Once all the prerequisites have been installed, clone this repo or download latest release from [Releases](https://github.com/kiliman/operator-mono-lig/releases) and unzip.
|
||||
|
||||
```
|
||||
Next, copy your _Operator Mono_ OpenType files into the `original` folder. **NOTE**: Filenames must not include spaces. It should look like:
|
||||
|
||||
- OperatorMonoSSm-Book.otf
|
||||
- OperatorMonoSSm-BookItalic.otf
|
||||
- OperatorMono-Light.otf
|
||||
- OperatorMono-LightItalic.otf
|
||||
- etc.
|
||||
|
||||
Finally, run the following commands to install npm dependencies and build the font files. The new font files will be placed in the `build` folder. You can now install these fonts on your system.
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
3. Copy your *Operator Mono* OpenType files into the `original` folder.
|
||||
- **NOTE**: File names must strictly be of the form `OperatorMono-[Book/BookItalic/Medium/MediumItalic].otf`.
|
||||
|
||||
4. From the command line, run:
|
||||
|
||||
### Windows
|
||||
|
||||
```
|
||||
# Windows
|
||||
build
|
||||
```
|
||||
|
||||
### Linux/Mac
|
||||
|
||||
```
|
||||
# Linux/Mac
|
||||
./build.sh
|
||||
```
|
||||
|
||||
This will generate the new font files in the `build` folder. You can now install these fonts on your system.
|
||||
### Docker
|
||||
|
||||
---
|
||||
If you use Docker, you can also use the executable Docker image [here](https://github.com/drod3763/kiliman-operator-mono-lig-docker). It handles all the prerequisite installation for you, you just need to:
|
||||
|
||||
<img src="./images/OperatorMonoAllTheThings.png" />
|
||||
1. Clone the repo [located here](https://github.com/drod3763/kiliman-operator-mono-lig-docker).
|
||||
1. Copy your _Operator Mono_ OpenType files into the `input` folder.
|
||||
1. From the command line run:
|
||||
```sh
|
||||
docker-compose run --rm operator-mono-lig
|
||||
```
|
||||
|
||||
## GitHub
|
||||
Add *Operator Mono* to GitHub code blocks using the [Stylus Extension](https://chrome.google.com/webstore/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne).
|
||||
The image will build and execute the conversion. The new font files will be generated into the `build` folder.
|
||||
|
||||
Create a style and enter the following:
|
||||
## Configure Your Code Editor
|
||||
|
||||
```css
|
||||
.blob-code-inner, .blob-num, .highlight pre { font-family: "Operator Mono Lig" !important; font-size: 16px !important; }
|
||||
.pl-c, .pl-e { font-style: italic; }
|
||||
.pl-c { color: #4CAF50; }
|
||||
You can now select the newly generated font in your code editor. Make sure you enable font ligatures and set the desired font weight if using Windows. The code block below shows what this might look like if using VS Code.
|
||||
|
||||
```json
|
||||
"editor.fontFamily": "OperatorMonoSSmLig-Book",
|
||||
"editor.fontLigatures": true,
|
||||
// for Windows
|
||||
"editor.fontFamily": "Operator Mono SSm Lig",
|
||||
"editor.fontLigatures": true,
|
||||
"editor.fontWeight": "500", // adjust for desired weight
|
||||
```
|
||||
<img src="./images/github-operatormono.png" />
|
||||
|
||||
## Visual Studio
|
||||
## 🔧 Customize the generated font
|
||||
|
||||
You can have Visual Studio display the nice *Operator Mono* italic font for comments, using the [CommentsPlus Extension](https://marketplace.visualstudio.com/items?itemName=mhoumann.CommentsPlus).
|
||||
By default, all available ligatures will be added to the generated font. However, if you don't like a particular
|
||||
ligature, or would prefer to use an alternate glyph, you can create a `profiles.ini` file in the `./original` folder
|
||||
to configure how the font should be built.
|
||||
|
||||
<img src="./images/vsoperatormono.png" />
|
||||
You can create one or more profiles. Each profile will have a set of directives. You can specify alternate glyphs for
|
||||
a given ligature. You can also prevent a ligature from being added.
|
||||
|
||||
## Hyper shell
|
||||
Each profile will be listed with `[profile name]` (the first profile should be named default). The generated font will
|
||||
include the profile name. For example `[Go]` would generate the font: _Operator Mono Lig Go_. This way you can configure
|
||||
a different set of ligatures for each language in your favorite code editor.
|
||||
|
||||
Add *Operator Mono* to [Hyper](https://hyper.is/) a JS/CSS/HTML Terminal.
|
||||
```ini
|
||||
# name of profile (one or more sections, first should be name default)
|
||||
[default]
|
||||
# glyph=altglyph
|
||||
greater_equal.liga=greater_equal.2.liga
|
||||
|
||||
<img src="./images/hyper terminal.png" />
|
||||
# do not include glyph (add ! prefix)
|
||||
!equal_equal.liga
|
||||
|
||||
# another optional section (will create a font named Operator Mono Lig Go)
|
||||
[Go]
|
||||
... add custom directives for this font ...
|
||||
```
|
||||
|
||||
## 😍 Thank You
|
||||
|
||||
Thanks to Hoefler&Co for making such an amazing font. It makes writing code truly pleasurable.
|
||||
|
||||
Thanks also to all of you for your kinds words of encouragement and feedback. I really
|
||||
appreciate it.
|
||||
|
||||
## ✨ Contributors
|
||||
|
||||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kiliman"><img src="https://avatars3.githubusercontent.com/u/47168?v=4?s=100" width="100px;" alt="Kiliman"/><br /><sub><b>Kiliman</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=kiliman" title="Code">💻</a> <a href="https://github.com/kiliman/operator-mono-lig/commits?author=kiliman" title="Documentation">📖</a> <a href="#design-kiliman" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mskelton"><img src="https://avatars3.githubusercontent.com/u/25914066?v=4?s=100" width="100px;" alt="Mark Skelton"/><br /><sub><b>Mark Skelton</b></sub></a><br /><a href="#design-mskelton" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/drod3763"><img src="https://avatars2.githubusercontent.com/u/7785716?v=4?s=100" width="100px;" alt="Derick Rodriguez"/><br /><sub><b>Derick Rodriguez</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=drod3763" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/amitkparekh"><img src="https://avatars3.githubusercontent.com/u/7276308?v=4?s=100" width="100px;" alt="Amit Parekh"/><br /><sub><b>Amit Parekh</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=amitkparekh" title="Documentation">📖</a> <a href="#design-amitkparekh" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/CandySunPlus"><img src="https://avatars0.githubusercontent.com/u/502700?v=4?s=100" width="100px;" alt="NikSun"/><br /><sub><b>NikSun</b></sub></a><br /><a href="#design-CandySunPlus" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Jakob6174"><img src="https://avatars3.githubusercontent.com/u/40262817?v=4?s=100" width="100px;" alt="Jakob Pearson"/><br /><sub><b>Jakob Pearson</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=Jakob6174" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Kilua99"><img src="https://avatars.githubusercontent.com/u/44760686?v=4?s=100" width="100px;" alt="kilua99"/><br /><sub><b>kilua99</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=Kilua99" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/GlorifiedBicycle"><img src="https://avatars.githubusercontent.com/u/71753585?v=4?s=100" width="100px;" alt="Reland Boyle"/><br /><sub><b>Reland Boyle</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=GlorifiedBicycle" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="http://killua.me/"><img src="https://avatars.githubusercontent.com/u/457822?v=4?s=100" width="100px;" alt="Luigi"/><br /><sub><b>Luigi</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=killua99" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tweks"><img src="https://avatars.githubusercontent.com/u/564556?v=4?s=100" width="100px;" alt="Tomek Weksej"/><br /><sub><b>Tomek Weksej</b></sub></a><br /><a href="https://github.com/kiliman/operator-mono-lig/commits?author=tweks" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
||||
@@ -3,26 +3,41 @@ setlocal
|
||||
|
||||
if not exist .\build\* mkdir build
|
||||
|
||||
set flags=
|
||||
if "%1"=="--italics-hack-off" (
|
||||
set flags=%1
|
||||
shift
|
||||
)
|
||||
rem only build passed in font
|
||||
if not "%1%"=="" (
|
||||
call :build_font %1
|
||||
if not "%1"=="" (
|
||||
call :build_font %1 %flags%
|
||||
exit /b
|
||||
)
|
||||
|
||||
rem build all fonts
|
||||
for /d %%d in (.\ligature\*) do call :build_font %%~nd
|
||||
for /d %%d in (.\ligature\*) do call :build_font %%~nd %flags%
|
||||
exit /b
|
||||
|
||||
|
||||
:build_font
|
||||
set lig=%1
|
||||
set flags=%2
|
||||
set otf=%lig:Lig-=-%
|
||||
|
||||
if not exist .\original\%otf%.otf exit /b
|
||||
if not exist .\ligature\%lig%\charstrings.xml exit /b
|
||||
if not exist .\ligature\%lig%\glyphs\* exit /b
|
||||
|
||||
@echo Building %lig%
|
||||
ttx -f .\original\%otf%.otf
|
||||
node index.js %otf%
|
||||
node index.js %otf% %flags%
|
||||
ttx -f .\build\%lig%.ttx
|
||||
rem check if "SSm" is in name since the features are slightly different
|
||||
@echo.%lig% | findstr /C:"SSm" 1>nul
|
||||
if errorlevel 1 (
|
||||
set fea=".\features\default.fea"
|
||||
) else (
|
||||
set fea=".\features\defaultSSm.fea"
|
||||
)
|
||||
fonttools feaLib -v -o ".\build\%lig%.otf" %fea% ".\build\%lig%.otf"
|
||||
|
||||
exit /b
|
||||
|
||||
@@ -4,30 +4,44 @@ mkdir -p build
|
||||
|
||||
build_font() {
|
||||
lig="$1"
|
||||
flags="$2"
|
||||
otf=${lig/Lig-/-}
|
||||
|
||||
if [ ! -e "./original/$otf.otf" ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
if [ ! -e "./ligature/$lig/charstrings.xml" ]
|
||||
if [ ! -e "./ligature/$lig/glyphs" ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
echo Building $1
|
||||
echo Building "$1"
|
||||
ttx -f "./original/$otf.otf"
|
||||
node index.js $otf
|
||||
ttx -f ./build/$1.ttx
|
||||
node index.js "$otf" "$flags"
|
||||
|
||||
ttx -f "./build/$1.ttx"
|
||||
if [[ $lig == *"SSm"* ]]; then
|
||||
fea="./features/defaultSSm.fea"
|
||||
else
|
||||
fea="./features/default.fea"
|
||||
fi
|
||||
fonttools feaLib -v -o "./build/$1.otf" $fea "./build/$1.otf"
|
||||
}
|
||||
|
||||
flags=
|
||||
if [ "$1" = "--italics-hack-off" ]
|
||||
then
|
||||
flags=$1
|
||||
shift
|
||||
fi
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
# build specified font
|
||||
build_font $1
|
||||
build_font "$1" "$flags"
|
||||
else
|
||||
# build all available fonts
|
||||
for d in ./ligature/*/ ; do
|
||||
build_font $(basename $d)
|
||||
build_font "$(basename "$d")" "$flags"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
const fs = require('fs')
|
||||
|
||||
const rules = [
|
||||
'',
|
||||
`
|
||||
lookup 1 {
|
||||
sub 1 by glyph;
|
||||
} 1;`,
|
||||
`
|
||||
lookup 1_2 {
|
||||
ignore sub 1 1' 2;
|
||||
ignore sub 1' 2 2;
|
||||
sub 1.spacer 2' by glyph;
|
||||
sub 1' 2 by 1.spacer;
|
||||
} 1_2;`,
|
||||
`
|
||||
lookup 1_2_3 {
|
||||
ignore sub 1 1' 2 3;
|
||||
ignore sub 1' 2 3 3;
|
||||
sub 1.spacer 2.spacer 3' by glyph;
|
||||
sub 1.spacer 2' 3 by 2.spacer;
|
||||
sub 1' 2 3 by 1.spacer;
|
||||
} 1_2_3;`,
|
||||
`
|
||||
lookup 1_2_3_4 {
|
||||
ignore sub 1 1' 2 3 4;
|
||||
ignore sub 1' 2 3 4 4;
|
||||
sub 1.spacer 2.spacer 3.spacer 4' by glyph;
|
||||
sub 1.spacer 2.spacer 3' 4 by 3.spacer;
|
||||
sub 1.spacer 2' 3 4 by 2.spacer;
|
||||
sub 1' 2 3 4 by 1.spacer;
|
||||
} 1_2_3_4;`,
|
||||
]
|
||||
|
||||
const gencalt = ligatures => {
|
||||
let calt = 'feature calt {\n'
|
||||
const ligs = {}
|
||||
|
||||
ligatures
|
||||
.filter(l => !!l.name.match(/\.liga$/) || l.name !== l.glyph)
|
||||
.map(l => l.glyph)
|
||||
.sort((a, b) => {
|
||||
const length = b.split('_').length - a.split('_').length
|
||||
if (length !== 0) return length
|
||||
return a < b ? -1 : 1
|
||||
})
|
||||
.forEach(g => {
|
||||
g.split('.')
|
||||
.slice(0, 1)
|
||||
.forEach(l => {
|
||||
if (ligs[l]) return
|
||||
ligs[l] = true
|
||||
const c = l.split('_')
|
||||
let rule = rules[c.length]
|
||||
rule = rule
|
||||
.replace(/\d/g, m => c[parseInt(m) - 1])
|
||||
.replace(/glyph/g, g)
|
||||
calt += rule + '\n'
|
||||
})
|
||||
})
|
||||
|
||||
return calt + '\n} calt;\n'
|
||||
}
|
||||
|
||||
exports.gencalt = gencalt
|
||||
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 273 KiB |
|
After Width: | Height: | Size: 321 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 329 KiB |
|
After Width: | Height: | Size: 378 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 203 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 33 KiB |
@@ -0,0 +1,4 @@
|
||||
# Introduction
|
||||
|
||||
Testing
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Table of contents
|
||||
|
||||
* [Introduction](README.md)
|
||||
* [Installation instructions](installation-instructions.md)
|
||||
* [Changelog](changelog.md)
|
||||
|
||||
## Developing ligatures
|
||||
|
||||
* [Setting up your development environment](developing-ligatures/setting-up-your-development-environment.md)
|
||||
* [Designing your first ligature](developing-ligatures/designing-your-first-ligature.md)
|
||||
* [Committing your Glyphs file](developing-ligatures/committing-your-glyphs-file.md)
|
||||
* [Ensuring ligatures work at small sizes](developing-ligatures/ensuring-ligatures-work-at-small-sizes.md)
|
||||
|
||||
## Ligature Recipes
|
||||
|
||||
* [www](ligature-recipes/www.md)
|
||||
* [Double-braces](ligature-recipes/double-braces/README.md)
|
||||
* [Roman variant](ligature-recipes/double-braces/roman-variant.md)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
description: See what has changed each release.
|
||||
---
|
||||
|
||||
# Changelog
|
||||
|
||||
###
|
||||
|
||||
## 15.0.0 - 2042-12-0
|
||||
|
||||
### Fixed
|
||||
|
||||
* Removed humans, they weren't doing fine with animals.
|
||||
|
||||
### Changed
|
||||
|
||||
* Animals are now super cute, all of them.
|
||||
|
||||
## 14.0.0 - 2042-10-06
|
||||
|
||||
### Added
|
||||
|
||||
* Introduced animals into the world, we believe they're going to be a neat addition.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# Committing your Glyphs file
|
||||
|
||||
The Glyphs file is very difficult to merge, so standard tools like `git rebase` don't work well. I have created some tools that will allow you to update your existing Glyphs file on top of the current.
|
||||
|
||||
{% hint style="warning" %}
|
||||
Make sure you have created a separate branch for your changes and you've committed all your changes to the branch.
|
||||
{% endhint %}
|
||||
|
||||
1. When you're ready to issue a PR for your changes, you need to run the `./tools/glyphysrebase.sh` tool.
|
||||
2. You can now create your PR, or continue making changes and running the rebase tool periodically to keep up-to-date with master.
|
||||
|
||||
## How the tool works
|
||||
|
||||
1. Checks out a clean copy of `master` in a temporary folder.
|
||||
2. Copies your current working copy to a backup folder.
|
||||
3. Copies the master copy into your working copy \(basically resetting everything back before your changes\).
|
||||
4. Runs the `./tools/copyallglyphs.sh` script to copy ligatures from your backup folder to the current master in your working copy.
|
||||
5. At this point, you now have a glyphs file that includes your custom ligatures on top of the current master.
|
||||
6. The "rebased" files are then committed.
|
||||
7. You can now issue a PR. This should easily merge into master.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Designing your first ligature
|
||||
|
||||
## Getting Super Powers
|
||||
|
||||
Becoming a super hero is a fairly straight forward process:
|
||||
|
||||
```
|
||||
$ give me super-powers
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
Super-powers are granted randomly so please submit an issue if you're not happy with yours.
|
||||
{% endhint %}
|
||||
|
||||
Once you're strong enough, save the world:
|
||||
|
||||
```
|
||||
// Ain't no code for that yet, sorry
|
||||
echo 'You got to trust me on this, I saved the world'
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Ensuring ligatures work at small sizes
|
||||
|
||||
After creating each ligature, you going to need to make sure it works at very small sizes. Ensure the brace works at very small sizes by looking at it when its very small, by dragging up from the bottom of the editor. This need to be done because as [ScreenSmart fonts are guaranteed to work at a minimum of 9px](https://www.typography.com/fonts/operator/how-to-use#setting_text_and_headlines):
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
description: Things you will need to create additional ligatures.
|
||||
---
|
||||
|
||||
# Setting up your development environment
|
||||
|
||||
## Getting Super Powers
|
||||
|
||||
Becoming a super hero is a fairly straight forward process:
|
||||
|
||||
```
|
||||
$ give me super-powers
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
Super-powers are granted randomly so please submit an issue if you're not happy with yours.
|
||||
{% endhint %}
|
||||
|
||||
Once you're strong enough, save the world:
|
||||
|
||||
```
|
||||
// Ain't no code for that yet, sorry
|
||||
echo 'You got to trust me on this, I saved the world'
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description: How to install the ligatures
|
||||
---
|
||||
|
||||
# Installation instructions
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
description: Recipe for the double-brace ligature
|
||||
---
|
||||
|
||||
# Double-braces
|
||||
|
||||
## Creating the ligature \(Roman\)
|
||||
|
||||
1.
|
||||

|
||||
|
||||
For whichever brace is the "inner-brace", change the dimensions as so, changing only the size \(the `%` in the middle column\) and the rotation \(the right most setting\):
|
||||
|
||||

|
||||
|
||||
Move the left-most brace to the left and the right-most brace to the left so the top/bottom parts cross the middle guide and the numbers are like so:
|
||||
|
||||

|
||||
|
||||
Create a new guide and move the guide so it intersects the pointy inner-corner of the larger brace
|
||||
|
||||

|
||||
|
||||
Move the smaller brace vertically \(up/down\) so the two pointy inner-corner bits cross like so:
|
||||
|
||||

|
||||
|
||||
## Creating the italic ligature
|
||||
|
||||
Repeat all the steps as above ligature above **BUT set the middle guide** **to**:
|
||||
|
||||

|
||||
|
||||
## Final ligatures
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
description: How to create the Roman variant of the double-brace ligature
|
||||
---
|
||||
|
||||
# Roman variant
|
||||
|
||||
{% hint style="info" %}
|
||||
|
||||
{% endhint %}
|
||||
|
||||
1. Add the `braceleft` component twice, or `braceright` component twice.
|
||||
2. Create a guide \(Right-click -> Add Guide\)
|
||||
3. Set the settings on the guide as so:
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# www
|
||||
|
||||
@@ -1,38 +1,64 @@
|
||||
const Promise = require('bluebird');
|
||||
const fs = Promise.promisifyAll(require('fs'));
|
||||
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
if (!os.EOL) {
|
||||
os.EOL = process.platform === 'win32' ? '\r\n' : '\n';
|
||||
}
|
||||
const xpath = require('xpath');
|
||||
const { DOMParser, XMLSerializer } = require('xmldom');
|
||||
const format = require('xml-formatter');
|
||||
const hash = require('hash.js');
|
||||
|
||||
let fontName;
|
||||
|
||||
const regEx = /\.liga$/;
|
||||
const regExBlankLines = /^(?=\n)$|^\s*/gm;
|
||||
const regExWhitespace = /^\s+$/;
|
||||
const NodeType = {};
|
||||
NodeType.TEXT_NODE = 3;
|
||||
|
||||
async function main() {
|
||||
function main() {
|
||||
fontName = process.argv[2];
|
||||
|
||||
const glyphsRegEx = getGlyphsRegEx('./ligature_source/glyphs');
|
||||
const srcFileName = `./ligature_source/${fontName}.ttx`;
|
||||
|
||||
const folder = `./ligature/${fontName}`;
|
||||
const fileName = `./${folder}/names.json`;
|
||||
if (!fs.existsSync(fileName)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
console.log(`Reading file ${srcFileName}`);
|
||||
const xml = await fs.readFileAsync(srcFileName, 'utf-8');
|
||||
const xml = fs.readFileSync(srcFileName, 'utf-8');
|
||||
const dom = new DOMParser().parseFromString(xml);
|
||||
|
||||
await extractAndWrite('charstrings', extractCharStrings, dom);
|
||||
await extractAndWrite('config', extractConfig, dom);
|
||||
await extractAndWrite('gpos', extractGpos, dom);
|
||||
await extractAndWrite('gsub', extractGsub, dom);
|
||||
await extractAndWrite('hmtx', extractHmtx, dom);
|
||||
await extractAndWrite('subrs', extractSubrs, dom);
|
||||
await extractAndWrite('gsubrs', extractGlobalSubrs, dom);
|
||||
extractAndWrite('config', extractConfig, dom);
|
||||
|
||||
extractCharStrings(dom, glyphsRegEx);
|
||||
|
||||
extractAndWrite('subrs', extractSubrs, dom);
|
||||
extractAndWrite('gsubrs', extractGlobalSubrs, dom);
|
||||
|
||||
console.log('Done');
|
||||
}
|
||||
|
||||
async function extractAndWrite(name, func, dom) {
|
||||
function getGlyphsRegEx(path) {
|
||||
const glyphs = fs.readFileSync(path, 'utf-8');
|
||||
const patterns = ['LIG'];
|
||||
|
||||
glyphs
|
||||
.split(os.EOL)
|
||||
.filter(line => line.length > 0)
|
||||
.forEach(line => {
|
||||
const pattern = line
|
||||
.replace(/\s*#.*/, '')
|
||||
.replace(/[.]/g, '\\.')
|
||||
.replace(/[*]/g, '.*');
|
||||
if (pattern.length) {
|
||||
patterns.push(pattern);
|
||||
}
|
||||
});
|
||||
return new RegExp(`^(${patterns.join('|')})$`);
|
||||
}
|
||||
|
||||
function extractAndWrite(name, func, dom) {
|
||||
const newDom = func(dom);
|
||||
console.log('Finished extracting ' + name);
|
||||
|
||||
@@ -41,30 +67,23 @@ async function extractAndWrite(name, func, dom) {
|
||||
if (!fs.existsSync(folder)) {
|
||||
fs.mkdirSync(folder);
|
||||
}
|
||||
await fs.writeFileAsync(fileName, format(serialize(newDom)));
|
||||
fs.writeFileSync(fileName, format(serialize(newDom)));
|
||||
console.log('Finished writing ' + name);
|
||||
}
|
||||
|
||||
const serialize = dom =>
|
||||
new XMLSerializer().serializeToString(dom, false, node => {
|
||||
if (node.nodeType === NodeType.TEXT_NODE) {
|
||||
if (regExWhitespace.test(node.data)) return null;
|
||||
const data = node.data
|
||||
.split('\r\n')
|
||||
.filter(s => /\S+/.test(s))
|
||||
.map(s => s.replace(/^\s+/g, ''))
|
||||
.join('\n');
|
||||
|
||||
return node.ownerDocument.createTextNode(data);
|
||||
}
|
||||
return node;
|
||||
});
|
||||
//const dump = dom => console.log(serialize(dom));
|
||||
const serialize = dom => new XMLSerializer().serializeToString(dom);
|
||||
|
||||
const extractConfig = dom => {
|
||||
const newDom = new DOMParser().parseFromString('<ttFont/>');
|
||||
const head = xpath.select('/ttFont/head', dom, true);
|
||||
const hhea = xpath.select('/ttFont/hhea', dom, true);
|
||||
|
||||
// remove elements that change after each save
|
||||
// but we don't care about
|
||||
head.removeChild(xpath.select('checkSumAdjustment', head, true));
|
||||
head.removeChild(xpath.select('created', head, true));
|
||||
head.removeChild(xpath.select('modified', head, true));
|
||||
|
||||
const bbox = extractFromPath('/ttFont/CFF/CFFFont/FontBBox', dom);
|
||||
const widthX = extractFromPath(
|
||||
'/ttFont/CFF/CFFFont/Private/nominalWidthX',
|
||||
@@ -92,39 +111,136 @@ const extractFromPath = (path, dom) => {
|
||||
return newDom.documentElement;
|
||||
};
|
||||
|
||||
const extractGpos = dom => {
|
||||
const gpos = xpath.select('/ttFont/GPOS', dom, true);
|
||||
return gpos;
|
||||
};
|
||||
|
||||
const extractGsub = dom => {
|
||||
const gsub = xpath.select('/ttFont/GSUB', dom, true);
|
||||
return gsub;
|
||||
};
|
||||
|
||||
const extractHmtx = dom => {
|
||||
const newDom = new DOMParser().parseFromString('<hmtx/>');
|
||||
const mtx = xpath.select('/ttFont/hmtx/mtx', dom);
|
||||
|
||||
mtx
|
||||
.filter(node => regEx.test(node.getAttribute('name')))
|
||||
.forEach(node => newDom.documentElement.appendChild(node));
|
||||
|
||||
return newDom;
|
||||
};
|
||||
|
||||
const extractCharStrings = dom => {
|
||||
const newDom = new DOMParser().parseFromString('<CharStrings/>');
|
||||
const extractCharStrings = (dom, glyphsRegEx) => {
|
||||
const charStrings = xpath.select(
|
||||
'/ttFont/CFF/CFFFont/CharStrings/CharString',
|
||||
dom
|
||||
);
|
||||
|
||||
charStrings
|
||||
.filter(node => regEx.test(node.getAttribute('name')))
|
||||
.forEach(node => newDom.documentElement.appendChild(node));
|
||||
.filter(node => glyphsRegEx.test(node.getAttribute('name')))
|
||||
.forEach(node => writeGlyphData(dom, node));
|
||||
console.log('Finished writing charstrings');
|
||||
};
|
||||
|
||||
return newDom;
|
||||
const writeGlyphData = (dom, node) => {
|
||||
const newDom = new DOMParser().parseFromString('<Glyph/>').documentElement;
|
||||
const name = node.getAttribute('name');
|
||||
newDom.setAttribute('name', name);
|
||||
|
||||
// get map and set code
|
||||
const map = xpath.select(
|
||||
`/ttFont/cmap/cmap_format_4/map[@name="${name}"]`,
|
||||
dom,
|
||||
true
|
||||
);
|
||||
if (map) {
|
||||
newDom.setAttribute('code', map.getAttribute('code'));
|
||||
}
|
||||
|
||||
// get mtx
|
||||
const mtx = xpath.select(`/ttFont/hmtx/mtx[@name="${name}"]`, dom, true);
|
||||
newDom.setAttribute('lsb', mtx.getAttribute('lsb'));
|
||||
newDom.setAttribute('width', mtx.getAttribute('width'));
|
||||
|
||||
const charStringDom = dom.createElement('CharString');
|
||||
|
||||
const subrsDom = dom.createElement('Subrs');
|
||||
const gsubrsDom = dom.createElement('GlobalSubrs');
|
||||
newDom.appendChild(charStringDom);
|
||||
newDom.appendChild(subrsDom);
|
||||
newDom.appendChild(gsubrsDom);
|
||||
|
||||
const subrs = {
|
||||
map: [],
|
||||
fingerprints: [],
|
||||
sourcePath: '/ttFont/CFF/CFFFont/Private/Subrs',
|
||||
target: subrsDom
|
||||
};
|
||||
const gsubrs = {
|
||||
map: [],
|
||||
fingerprints: [],
|
||||
sourcePath: '/ttFont/CFF/GlobalSubrs',
|
||||
target: gsubrsDom
|
||||
};
|
||||
|
||||
extractCharStringSubrs(dom, node, subrs, gsubrs, 8);
|
||||
|
||||
const outline = indentTextContent(node.childNodes[0].textContent, 8);
|
||||
charStringDom.appendChild(dom.createTextNode(outline));
|
||||
|
||||
const folder = `./ligature/${fontName}/glyphs`;
|
||||
const fileName = `./${folder}/${name}.xml`;
|
||||
if (!fs.existsSync(folder)) {
|
||||
fs.mkdirSync(folder);
|
||||
}
|
||||
fs.writeFileSync(fileName, format(serialize(newDom)));
|
||||
console.log('* ' + name);
|
||||
};
|
||||
|
||||
const extractCharStringSubrs = (dom, node, subrs, gsubrs, indent) => {
|
||||
// check for callsubr/callgsubr
|
||||
|
||||
const lines = node.childNodes[0].textContent.split(os.EOL);
|
||||
const newLines = [];
|
||||
let fingerprint = '';
|
||||
|
||||
lines.forEach(line => {
|
||||
if (line.trim().length === 0) return;
|
||||
const matches = line.match(/(.*?)(-?\d+) (callsubr|callgsubr)$/);
|
||||
if (matches != null) {
|
||||
const { map, fingerprints, sourcePath, target } =
|
||||
matches[3] === 'callsubr' ? subrs : gsubrs;
|
||||
const index = matches[2];
|
||||
const srcIndex = parseInt(index) + 107;
|
||||
let newIndex = map[srcIndex];
|
||||
|
||||
if (!newIndex) {
|
||||
// find subr in source dom and copy to target dom
|
||||
const srcSubr = xpath.select(
|
||||
`/${sourcePath}/CharString[@index="${srcIndex}"]`,
|
||||
dom,
|
||||
true
|
||||
);
|
||||
|
||||
// append subr to target dom and get new index
|
||||
newIndex = xpath.select('count(CharString)', target, true);
|
||||
map[srcIndex] = newIndex;
|
||||
|
||||
const clone = srcSubr.cloneNode(true);
|
||||
clone.setAttribute('index', newIndex);
|
||||
target.appendChild(clone);
|
||||
|
||||
// patch up source in case it also has any callsubrs
|
||||
fingerprint = extractCharStringSubrs(dom, clone, subrs, gsubrs, 12);
|
||||
fingerprints[newIndex] = fingerprint;
|
||||
} else {
|
||||
fingerprint = fingerprints[newIndex];
|
||||
}
|
||||
|
||||
// rewrite line with fingerprint
|
||||
line = `${matches[1]}{${fingerprint}} ${matches[3]}`;
|
||||
}
|
||||
newLines.push(line.trim());
|
||||
});
|
||||
const content = newLines.join('\n');
|
||||
fingerprint = hash
|
||||
.sha256()
|
||||
.update(content)
|
||||
.digest('hex')
|
||||
.substr(0, 8);
|
||||
node.setAttribute('fingerprint', fingerprint);
|
||||
|
||||
node.childNodes[0].textContent = indentTextContent(content, indent);
|
||||
return fingerprint;
|
||||
};
|
||||
|
||||
const indentTextContent = (text, indent) => {
|
||||
return text
|
||||
.split('\n')
|
||||
.map(line => ' '.repeat(indent) + line.trim())
|
||||
.join('\n')
|
||||
.trim();
|
||||
};
|
||||
|
||||
const extractSubrs = dom => {
|
||||
|
||||
@@ -15,6 +15,6 @@ then
|
||||
else
|
||||
# build all available fonts
|
||||
for f in ./ligature_source/*.otf ; do
|
||||
extract_font $(basename $f)
|
||||
extract_font `basename "${f%.*}"`
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
calt.fea
|
||||
@@ -0,0 +1,234 @@
|
||||
##############################
|
||||
# Languagesystem definitions #
|
||||
##############################
|
||||
languagesystem DFLT dflt; # Default default
|
||||
languagesystem latn dflt; # Latin default
|
||||
languagesystem latn CAT ; # Latin Catalan
|
||||
##########
|
||||
# Prefix #
|
||||
##########
|
||||
@HexDigit = [a b c d e f A B C D E F];
|
||||
@Digit = [zero one two three four five six seven eight nine];
|
||||
@DigitAll = [zero one two three four five six seven eight nine zero.num one.num two.num three.num four.num five.num six.num seven.num eight.num nine.num zero.den one.den two.den three.den four.den five.den six.den seven.den eight.den nine.den];
|
||||
@DigitSmall = [zero.small one.small two.small three.small four.small five.small six.small seven.small eight.small nine.small];
|
||||
@DigitNumerator = [zero.num one.num two.num three four.num five.num six.num seven.num eight.num nine.num];
|
||||
@DigitDenominator = [zero.den one.den two.den three.den four.den five.den six.den seven.den eight.den nine.den];
|
||||
@DigitSuperior = [zero.sup one.sup two.sup three.sup four.sup five.sup six.sup seven.sup eight.sup nine.sup];
|
||||
@DigitInferior = [zero.inf one.inf two.inf three.inf four.inf five.inf six.inf seven.inf eight.inf nine.inf];
|
||||
#######################
|
||||
# Feature definitions #
|
||||
#######################
|
||||
feature locl {
|
||||
# GSUB feature: Localized Forms
|
||||
script latn; # Latin
|
||||
language CAT; # Catalan
|
||||
sub l' periodcentered' by ldot;
|
||||
sub L' periodcentered' by Ldot;
|
||||
} locl;
|
||||
|
||||
feature aalt useExtension {
|
||||
# GSUB feature: Access All Alternates
|
||||
feature case;
|
||||
feature dnom;
|
||||
feature numr;
|
||||
feature salt;
|
||||
feature sinf;
|
||||
feature ss01;
|
||||
feature ss03;
|
||||
feature ss04;
|
||||
feature ss05;
|
||||
feature ss07;
|
||||
feature ss08;
|
||||
feature ss09;
|
||||
feature ss10;
|
||||
feature subs;
|
||||
feature sups;
|
||||
feature smcp;
|
||||
feature c2sc;
|
||||
} aalt;
|
||||
|
||||
feature frac {
|
||||
# GSUB feature: Fractions
|
||||
lookup frac0 {
|
||||
sub @Digit slash' @Digit by fraction;
|
||||
} frac0;
|
||||
|
||||
lookup frac1 {
|
||||
ignore sub @DigitAll @DigitAll fraction';
|
||||
ignore sub fraction' @DigitAll @DigitAll;
|
||||
sub @DigitAll fraction' @DigitAll by fraction.afrc;
|
||||
} frac1;
|
||||
|
||||
lookup frac2 {
|
||||
sub @Digit' fraction.afrc by @DigitNumerator;
|
||||
sub fraction.afrc @Digit' by @DigitDenominator;
|
||||
} frac2;
|
||||
|
||||
lookup frac3 {
|
||||
sub one.num fraction.afrc two.den by onehalf;
|
||||
sub one.num fraction.afrc three.den by onethird;
|
||||
sub one.num fraction.afrc four.den by onequarter;
|
||||
sub one.num fraction.afrc five.den by onefifth;
|
||||
sub one.num fraction.afrc six.den by onesixth;
|
||||
sub one.num fraction.afrc eight.den by oneeighth;
|
||||
sub two.num fraction.afrc three.den by twothirds;
|
||||
sub two.num fraction.afrc five.den by twofifths;
|
||||
sub three.num fraction.afrc four.den by threequarters;
|
||||
sub three.num fraction.afrc five.den by threefifths;
|
||||
sub three.num fraction.afrc eight.den by threeeighths;
|
||||
sub four.num fraction.afrc five.den by fourfifths;
|
||||
sub five.num fraction.afrc six.den by fivesixths;
|
||||
sub five.num fraction.afrc eight.den by fiveeighths;
|
||||
sub seven.num fraction.afrc eight.den by seveneighths;
|
||||
} frac3;
|
||||
} frac;
|
||||
|
||||
feature numr {
|
||||
# GSUB feature: Numerators
|
||||
sub @Digit by @DigitNumerator;
|
||||
} numr;
|
||||
|
||||
feature dnom {
|
||||
# GSUB feature: Denominators
|
||||
sub @Digit by @DigitDenominator;
|
||||
} dnom;
|
||||
|
||||
feature sups {
|
||||
# GSUB feature: Superscript
|
||||
sub @Digit by @DigitSuperior;
|
||||
} sups;
|
||||
|
||||
feature subs {
|
||||
# GSUB feature: Subscript
|
||||
sub @Digit by @DigitInferior;
|
||||
} subs;
|
||||
|
||||
feature sinf {
|
||||
# GSUB feature: Scientific Inferiors
|
||||
sub @Digit by @DigitInferior;
|
||||
} sinf;
|
||||
|
||||
feature ordn {
|
||||
# Ordinals
|
||||
sub @Digit [A a]' by ordfeminine;
|
||||
sub @Digit [O o]' by ordmasculine;
|
||||
sub N o period by numero;
|
||||
} ordn;
|
||||
|
||||
feature smcp {
|
||||
# Small Caps
|
||||
sub @Digit by @DigitSmall;
|
||||
} smcp;
|
||||
|
||||
feature c2sc {
|
||||
# Capitals to Small Caps
|
||||
sub @Digit by @DigitSmall;
|
||||
} c2sc;
|
||||
|
||||
feature case {
|
||||
# GSUB feature: Case-Sensitive Forms
|
||||
sub guillemotleft by guillemotleft.cap;
|
||||
sub guillemotright by guillemotright.cap;
|
||||
sub guilsinglleft by guilsinglleft.cap;
|
||||
sub guilsinglright by guilsinglright.cap;
|
||||
sub parenleft by parenleft.cap;
|
||||
sub parenright by parenright.cap;
|
||||
sub bracketleft by bracketleft.cap;
|
||||
sub bracketright by bracketright.cap;
|
||||
sub braceleft by braceleft.cap;
|
||||
sub braceright by braceright.cap;
|
||||
} case;
|
||||
|
||||
|
||||
|
||||
include(calt.fea);
|
||||
|
||||
|
||||
|
||||
feature salt {
|
||||
# GSUB feature: Stylistic Alternates
|
||||
sub registered by registered.alt;
|
||||
sub colon by colon.alt;
|
||||
sub bullet by bullet.alt;
|
||||
sub asterisk by asterisk.alt;
|
||||
sub zero by zero.alt;
|
||||
sub underscore by underscore.alt;
|
||||
lookup salt {
|
||||
# GSUB lookup 20, type 16 (Chaining Context)
|
||||
sub @DigitAll slash' @DigitAll by fraction;
|
||||
} salt;
|
||||
} salt;
|
||||
|
||||
feature ss01 {
|
||||
featureNames {
|
||||
name "Large Registered Symbol";
|
||||
};
|
||||
sub registered by registered.alt;
|
||||
} ss01;
|
||||
|
||||
feature ss03 {
|
||||
featureNames {
|
||||
name "Raised Colon";
|
||||
};
|
||||
sub colon by colon.alt;
|
||||
} ss03;
|
||||
|
||||
feature ss04 {
|
||||
featureNames {
|
||||
name "Square Bullet";
|
||||
};
|
||||
sub bullet by bullet.alt;
|
||||
} ss04;
|
||||
|
||||
feature ss05 {
|
||||
featureNames {
|
||||
name "Six-Pointed Asterisk";
|
||||
};
|
||||
sub asterisk by asterisk.alt;
|
||||
} ss05;
|
||||
|
||||
feature ss07 {
|
||||
featureNames {
|
||||
name "Unslashed Zero";
|
||||
};
|
||||
sub zero by zero.alt;
|
||||
} ss07;
|
||||
|
||||
feature ss08 {
|
||||
featureNames {
|
||||
name "Connected Underscore";
|
||||
};
|
||||
sub underscore by underscore.alt;
|
||||
} ss08;
|
||||
|
||||
feature ss09 {
|
||||
featureNames {
|
||||
name "Fraction Bar";
|
||||
};
|
||||
sub @DigitAll slash' @DigitAll by fraction;
|
||||
} ss09;
|
||||
|
||||
feature ss10 {
|
||||
featureNames {
|
||||
name "Hexidecimal Multiply Sign";
|
||||
};
|
||||
### 0xFF
|
||||
sub [zero zero.alt] x' [@Digit @HexDigit] by multiply;
|
||||
### 800x600
|
||||
sub [@Digit zero.alt] x' [@Digit zero.alt] by multiply;
|
||||
} ss10;
|
||||
|
||||
feature rupa {
|
||||
sub R p by R_p;
|
||||
} rupa;
|
||||
|
||||
feature kern {
|
||||
# GPOS feature: Kerning
|
||||
lookup kern {
|
||||
# GPOS lookup 1, type 2 (Pair adjustment)
|
||||
pos fraction.afrc @DigitDenominator -550;
|
||||
pos @DigitNumerator fraction.afrc -550;
|
||||
} kern;
|
||||
} kern;
|
||||
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
##############################
|
||||
# Languagesystem definitions #
|
||||
##############################
|
||||
languagesystem DFLT dflt; # Default default
|
||||
languagesystem latn dflt; # Latin default
|
||||
languagesystem latn CAT ; # Latin Catalan
|
||||
##########
|
||||
# Prefix #
|
||||
##########
|
||||
@HexDigit = [a b c d e f A B C D E F];
|
||||
@Digit = [zero one two three four five six seven eight nine];
|
||||
@DigitAll = [zero one two three four five six seven eight nine zero.num one.num two.num three.num four.num five.num six.num seven.num eight.num nine.num zero.den one.den two.den three.den four.den five.den six.den seven.den eight.den nine.den];
|
||||
@DigitSmall = [zero.small one.small two.small three.small four.small five.small six.small seven.small eight.small nine.small];
|
||||
@DigitNumerator = [zero.num one.num two.num three four.num five.num six.num seven.num eight.num nine.num];
|
||||
@DigitDenominator = [zero.den one.den two.den three.den four.den five.den six.den seven.den eight.den nine.den];
|
||||
@DigitSuperior = [zero.sup one.sup two.sup three.sup four.sup five.sup six.sup seven.sup eight.sup nine.sup];
|
||||
@DigitInferior = [zero.inf one.inf two.inf three.inf four.inf five.inf six.inf seven.inf eight.inf nine.inf];
|
||||
#######################
|
||||
# Feature definitions #
|
||||
#######################
|
||||
feature locl {
|
||||
# GSUB feature: Localized Forms
|
||||
script latn; # Latin
|
||||
language CAT; # Catalan
|
||||
sub l' periodcentered' by ldot;
|
||||
sub L' periodcentered' by Ldot;
|
||||
} locl;
|
||||
|
||||
feature aalt useExtension {
|
||||
# GSUB feature: Access All Alternates
|
||||
feature case;
|
||||
feature dnom;
|
||||
feature numr;
|
||||
feature salt;
|
||||
feature sinf;
|
||||
feature ss01;
|
||||
feature ss03;
|
||||
feature ss04;
|
||||
feature ss05;
|
||||
feature ss07;
|
||||
feature ss08;
|
||||
feature ss09;
|
||||
feature ss10;
|
||||
feature ss11;
|
||||
feature ss12;
|
||||
feature subs;
|
||||
feature sups;
|
||||
feature smcp;
|
||||
feature c2sc;
|
||||
} aalt;
|
||||
|
||||
feature frac {
|
||||
# GSUB feature: Fractions
|
||||
lookup frac0 {
|
||||
sub @Digit slash' @Digit by fraction;
|
||||
} frac0;
|
||||
|
||||
lookup frac1 {
|
||||
ignore sub @DigitAll @DigitAll fraction';
|
||||
ignore sub fraction' @DigitAll @DigitAll;
|
||||
sub @DigitAll fraction' @DigitAll by fraction.afrc;
|
||||
} frac1;
|
||||
|
||||
lookup frac2 {
|
||||
sub @Digit' fraction.afrc by @DigitNumerator;
|
||||
sub fraction.afrc @Digit' by @DigitDenominator;
|
||||
} frac2;
|
||||
|
||||
lookup frac3 {
|
||||
sub one.num fraction.afrc two.den by onehalf;
|
||||
sub one.num fraction.afrc three.den by onethird;
|
||||
sub one.num fraction.afrc four.den by onequarter;
|
||||
sub one.num fraction.afrc five.den by onefifth;
|
||||
sub one.num fraction.afrc six.den by onesixth;
|
||||
sub one.num fraction.afrc eight.den by oneeighth;
|
||||
sub two.num fraction.afrc three.den by twothirds;
|
||||
sub two.num fraction.afrc five.den by twofifths;
|
||||
sub three.num fraction.afrc four.den by threequarters;
|
||||
sub three.num fraction.afrc five.den by threefifths;
|
||||
sub three.num fraction.afrc eight.den by threeeighths;
|
||||
sub four.num fraction.afrc five.den by fourfifths;
|
||||
sub five.num fraction.afrc six.den by fivesixths;
|
||||
sub five.num fraction.afrc eight.den by fiveeighths;
|
||||
sub seven.num fraction.afrc eight.den by seveneighths;
|
||||
} frac3;
|
||||
} frac;
|
||||
|
||||
feature numr {
|
||||
# GSUB feature: Numerators
|
||||
sub @Digit by @DigitNumerator;
|
||||
} numr;
|
||||
|
||||
feature dnom {
|
||||
# GSUB feature: Denominators
|
||||
sub @Digit by @DigitDenominator;
|
||||
} dnom;
|
||||
|
||||
feature sups {
|
||||
# GSUB feature: Superscript
|
||||
sub @Digit by @DigitSuperior;
|
||||
} sups;
|
||||
|
||||
feature subs {
|
||||
# GSUB feature: Subscript
|
||||
sub @Digit by @DigitInferior;
|
||||
} subs;
|
||||
|
||||
feature sinf {
|
||||
# GSUB feature: Scientific Inferiors
|
||||
sub @Digit by @DigitInferior;
|
||||
} sinf;
|
||||
|
||||
feature ordn {
|
||||
# Ordinals
|
||||
sub @Digit [A a]' by ordfeminine;
|
||||
sub @Digit [O o]' by ordmasculine;
|
||||
sub N o period by numero;
|
||||
} ordn;
|
||||
|
||||
feature smcp {
|
||||
# Small Caps
|
||||
sub @Digit by @DigitSmall;
|
||||
} smcp;
|
||||
|
||||
feature c2sc {
|
||||
# Capitals to Small Caps
|
||||
sub @Digit by @DigitSmall;
|
||||
} c2sc;
|
||||
|
||||
feature case {
|
||||
# GSUB feature: Case-Sensitive Forms
|
||||
sub guillemotleft by guillemotleft.cap;
|
||||
sub guillemotright by guillemotright.cap;
|
||||
sub guilsinglleft by guilsinglleft.cap;
|
||||
sub guilsinglright by guilsinglright.cap;
|
||||
sub parenleft by parenleft.cap;
|
||||
sub parenright by parenright.cap;
|
||||
sub bracketleft by bracketleft.cap;
|
||||
sub bracketright by bracketright.cap;
|
||||
sub braceleft by braceleft.cap;
|
||||
sub braceright by braceright.cap;
|
||||
} case;
|
||||
|
||||
|
||||
|
||||
include(calt.fea);
|
||||
|
||||
|
||||
|
||||
feature salt {
|
||||
# GSUB feature: Stylistic Alternates
|
||||
sub registered by registered.alt;
|
||||
sub colon by colon.alt;
|
||||
sub bullet by bullet.alt;
|
||||
sub asterisk by asterisk.alt;
|
||||
sub zero by zero.alt;
|
||||
sub underscore by underscore.alt;
|
||||
lookup salt {
|
||||
# GSUB lookup 20, type 16 (Chaining Context)
|
||||
sub @DigitAll slash' @DigitAll by fraction;
|
||||
} salt;
|
||||
} salt;
|
||||
|
||||
feature ss01 {
|
||||
featureNames {
|
||||
name "Large Registered Symbol";
|
||||
};
|
||||
sub registered by registered.alt;
|
||||
} ss01;
|
||||
|
||||
feature ss03 {
|
||||
featureNames {
|
||||
name "Raised Colon";
|
||||
};
|
||||
sub colon by colon.alt;
|
||||
} ss03;
|
||||
|
||||
feature ss04 {
|
||||
featureNames {
|
||||
name "Square Bullet";
|
||||
};
|
||||
sub bullet by bullet.alt;
|
||||
} ss04;
|
||||
|
||||
feature ss05 {
|
||||
featureNames {
|
||||
name "Six-Pointed Asterisk";
|
||||
};
|
||||
sub asterisk by asterisk.alt;
|
||||
} ss05;
|
||||
|
||||
feature ss07 {
|
||||
featureNames {
|
||||
name "Unslashed Zero";
|
||||
};
|
||||
sub zero by zero.alt;
|
||||
} ss07;
|
||||
|
||||
feature ss08 {
|
||||
featureNames {
|
||||
name "Connected Underscore";
|
||||
};
|
||||
sub underscore by underscore.alt;
|
||||
} ss08;
|
||||
|
||||
feature ss09 {
|
||||
featureNames {
|
||||
name "Fraction Bar";
|
||||
};
|
||||
sub @DigitAll slash' @DigitAll by fraction;
|
||||
} ss09;
|
||||
|
||||
feature ss10 {
|
||||
featureNames {
|
||||
name "Hexidecimal Multiply Sign";
|
||||
};
|
||||
### 0xFF
|
||||
sub [zero zero.alt] x' [@Digit @HexDigit] by multiply;
|
||||
### 800x600
|
||||
sub [@Digit zero.alt] x' [@Digit zero.alt] by multiply;
|
||||
} ss10;
|
||||
|
||||
feature ss11 {
|
||||
featureNames {
|
||||
name "Equality Spaces";
|
||||
};
|
||||
sub equal_equal.liga by equal_equal.liga.ss11;
|
||||
sub equal_equal_equal.liga by equal_equal_equal.liga.ss11;
|
||||
} ss11;
|
||||
|
||||
feature ss12 {
|
||||
featureNames {
|
||||
name "Less-than/Greater-than Horizontal Bar";
|
||||
};
|
||||
sub less_equal.liga by less_equal.liga.ss12;
|
||||
sub greater_equal.liga by greater_equal.liga.ss12;
|
||||
} ss12;
|
||||
|
||||
feature rupa {
|
||||
sub R p by R_p;
|
||||
} rupa;
|
||||
|
||||
feature kern {
|
||||
# GPOS feature: Kerning
|
||||
lookup kern {
|
||||
# GPOS lookup 1, type 2 (Pair adjustment)
|
||||
pos fraction.afrc @DigitDenominator -625;
|
||||
pos @DigitNumerator fraction.afrc -625;
|
||||
} kern;
|
||||
} kern;
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
const fs = require('fs')
|
||||
const { createCanvas } = require('canvas')
|
||||
|
||||
const width = 64
|
||||
const height = 48
|
||||
const weight = 300
|
||||
|
||||
const map = {
|
||||
ampersand: '&',
|
||||
bar: '|',
|
||||
colon: ':',
|
||||
equal: '=',
|
||||
exclam: '!',
|
||||
greater: '>',
|
||||
hyphen: '-',
|
||||
less: '<',
|
||||
plus: '+',
|
||||
question: '?',
|
||||
slash: '/',
|
||||
underscore: '_',
|
||||
w: 'w',
|
||||
}
|
||||
|
||||
function generateLigaturePreview(style, filename) {
|
||||
const ligature = filename.split('.').slice(0, 1)[0]
|
||||
const chars = ligature.split('_')
|
||||
|
||||
const text = chars.reduce((t, c) => t + map[c], '')
|
||||
|
||||
const canvas = createCanvas(width, height)
|
||||
const context = canvas.getContext('2d')
|
||||
|
||||
context.fillStyle = '#000'
|
||||
context.fillRect(0, 0, width, height)
|
||||
|
||||
context.font = `${weight} ${style} 18pt "Operator Mono SSm Lig"`
|
||||
context.textAlign = 'center'
|
||||
context.fillStyle = '#fff'
|
||||
context.text = text
|
||||
context.fillText(text, 32, 32)
|
||||
|
||||
const buffer = canvas.toBuffer('image/png')
|
||||
console.log(ligature)
|
||||
fs.writeFileSync(`./images/preview/${style}/${ligature}.png`, buffer)
|
||||
|
||||
return { text, ligature, filename: `${ligature}.png` }
|
||||
}
|
||||
|
||||
function generate(style, filenames) {
|
||||
let html = `<html><head>
|
||||
<style>
|
||||
body { background-color: #000; color: #fff; font-family: sans-serif; margin: 16px;}
|
||||
a { color: #fff; text-decoration: none; padding: 4px;}
|
||||
a.active {color: #000; background-color: #fff;}
|
||||
.container { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
|
||||
.ligature { display: flex; flex-direction: column; align-items: center; margin: 8px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Operator Mono Ligatures</h1>
|
||||
<a href="https://htmlpreview.github.io/?https://github.com/kiliman/operator-mono-lig/blob/master/images/preview/normal/index.html" class="${
|
||||
style === 'normal' ? 'active' : ''
|
||||
}">Normal</a> |
|
||||
<a href="https://htmlpreview.github.io/?https://github.com/kiliman/operator-mono-lig/blob/master/images/preview/italic/index.html" class="${
|
||||
style === 'italic' ? 'active' : ''
|
||||
}">Italic</a>
|
||||
<div class="container">
|
||||
`
|
||||
|
||||
filenames.forEach(f => {
|
||||
const { ligature, filename } = generateLigaturePreview(style, f)
|
||||
html += `<div class="ligature"><img src="${filename}"/><div>${ligature}</div></div>`
|
||||
})
|
||||
|
||||
html += `</div></body></html>`
|
||||
|
||||
fs.writeFileSync(`./images/preview/${style}/index.html`, html)
|
||||
}
|
||||
|
||||
const filenames = fs
|
||||
.readdirSync('./ligature/OperatorMonoSSmLig-Book/glyphs')
|
||||
.filter(f => !!f.match(/[^\d]\.liga\.xml$/))
|
||||
|
||||
generate('normal', filenames)
|
||||
generate('italic', filenames)
|
||||
@@ -0,0 +1,36 @@
|
||||
const fs = require('fs');
|
||||
const lig = `<Glyph name="LIG" lsb="0" width="625">
|
||||
<CharString>
|
||||
endchar
|
||||
</CharString>
|
||||
<Subrs/>
|
||||
<GlobalSubrs/>
|
||||
</Glyph>`;
|
||||
|
||||
fs.readdirSync('./ligature')
|
||||
.filter((f) => !!f.match(/^OperatorMono/))
|
||||
.forEach((f) => {
|
||||
console.log(f);
|
||||
fs.readdirSync(`./ligature/${f}/glyphs`)
|
||||
.filter((g) => !!g.match(/\.liga\.xml$/))
|
||||
.forEach((g) => {
|
||||
console.log(g);
|
||||
g.split('.')
|
||||
.slice(0, 1)
|
||||
.forEach((l) => {
|
||||
l.split('_').forEach((c) => {
|
||||
const path = `./ligature/${f}/glyphs/${c}.spacer.xml`;
|
||||
const exists = fs.existsSync(path);
|
||||
console.log(path, exists);
|
||||
if (exists) return;
|
||||
|
||||
const width = !!f.match(/SSm/) ? 625 : 600;
|
||||
const spacer = lig
|
||||
.replace('LIG', `${c}.spacer`)
|
||||
.replace('625', width);
|
||||
console.log(f, c, width);
|
||||
fs.writeFileSync(path, spacer);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 612 B |
|
After Width: | Height: | Size: 805 B |
|
After Width: | Height: | Size: 423 B |
|
After Width: | Height: | Size: 439 B |
|
After Width: | Height: | Size: 293 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 566 B |
|
After Width: | Height: | Size: 564 B |
|
After Width: | Height: | Size: 828 B |
|
After Width: | Height: | Size: 677 B |
|
After Width: | Height: | Size: 731 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 691 B |
|
After Width: | Height: | Size: 740 B |
|
After Width: | Height: | Size: 849 B |
|
After Width: | Height: | Size: 327 B |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 290 B |
|
After Width: | Height: | Size: 521 B |
@@ -0,0 +1,15 @@
|
||||
<html><head>
|
||||
<style>
|
||||
body { background-color: #000; color: #fff; font-family: sans-serif; margin: 16px;}
|
||||
a { color: #fff; text-decoration: none; padding: 4px;}
|
||||
a.active {color: #000; background-color: #fff;}
|
||||
.container { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
|
||||
.ligature { display: flex; flex-direction: column; align-items: center; margin: 8px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Operator Mono Ligatures</h1>
|
||||
<a href="https://htmlpreview.github.io/?https://github.com/kiliman/operator-mono-lig/blob/master/images/preview/normal/index.html" class="">Normal</a> |
|
||||
<a href="https://htmlpreview.github.io/?https://github.com/kiliman/operator-mono-lig/blob/master/images/preview/italic/index.html" class="active">Italic</a>
|
||||
<div class="container">
|
||||
<div class="ligature"><img src="ampersand_ampersand.png"/><div>ampersand_ampersand</div></div><div class="ligature"><img src="asterisk_equal.png"/><div>asterisk_equal</div></div><div class="ligature"><img src="bar_bar.png"/><div>bar_bar</div></div><div class="ligature"><img src="bar_greater.png"/><div>bar_greater</div></div><div class="ligature"><img src="colon_colon.png"/><div>colon_colon</div></div><div class="ligature"><img src="colon_equal.png"/><div>colon_equal</div></div><div class="ligature"><img src="equal_equal.png"/><div>equal_equal</div></div><div class="ligature"><img src="equal_equal_equal.png"/><div>equal_equal_equal</div></div><div class="ligature"><img src="equal_equal_greater.png"/><div>equal_equal_greater</div></div><div class="ligature"><img src="equal_greater.png"/><div>equal_greater</div></div><div class="ligature"><img src="equal_less_less.png"/><div>equal_less_less</div></div><div class="ligature"><img src="exclam_equal.png"/><div>exclam_equal</div></div><div class="ligature"><img src="exclam_equal_equal.png"/><div>exclam_equal_equal</div></div><div class="ligature"><img src="exclam_exclam.png"/><div>exclam_exclam</div></div><div class="ligature"><img src="greater_equal.png"/><div>greater_equal</div></div><div class="ligature"><img src="greater_equal_greater.png"/><div>greater_equal_greater</div></div><div class="ligature"><img src="greater_greater.png"/><div>greater_greater</div></div><div class="ligature"><img src="greater_greater_equal.png"/><div>greater_greater_equal</div></div><div class="ligature"><img src="hyphen_equal.png"/><div>hyphen_equal</div></div><div class="ligature"><img src="hyphen_greater.png"/><div>hyphen_greater</div></div><div class="ligature"><img src="hyphen_hyphen.png"/><div>hyphen_hyphen</div></div><div class="ligature"><img src="hyphen_hyphen_greater.png"/><div>hyphen_hyphen_greater</div></div><div class="ligature"><img src="less_bar.png"/><div>less_bar</div></div><div class="ligature"><img src="less_equal.png"/><div>less_equal</div></div><div class="ligature"><img src="less_equal_equal.png"/><div>less_equal_equal</div></div><div class="ligature"><img src="less_equal_greater.png"/><div>less_equal_greater</div></div><div class="ligature"><img src="less_equal_less.png"/><div>less_equal_less</div></div><div class="ligature"><img src="less_exclam_hyphen_hyphen.png"/><div>less_exclam_hyphen_hyphen</div></div><div class="ligature"><img src="less_hyphen.png"/><div>less_hyphen</div></div><div class="ligature"><img src="less_hyphen_greater.png"/><div>less_hyphen_greater</div></div><div class="ligature"><img src="less_hyphen_hyphen.png"/><div>less_hyphen_hyphen</div></div><div class="ligature"><img src="less_less.png"/><div>less_less</div></div><div class="ligature"><img src="less_less_equal.png"/><div>less_less_equal</div></div><div class="ligature"><img src="less_slash.png"/><div>less_slash</div></div><div class="ligature"><img src="less_slash_greater.png"/><div>less_slash_greater</div></div><div class="ligature"><img src="plus_equal.png"/><div>plus_equal</div></div><div class="ligature"><img src="plus_plus.png"/><div>plus_plus</div></div><div class="ligature"><img src="question_question.png"/><div>question_question</div></div><div class="ligature"><img src="quotedbl_quotedbl_quotedbl.png"/><div>quotedbl_quotedbl_quotedbl</div></div><div class="ligature"><img src="quotesingle_quotesingle_quotesingle.png"/><div>quotesingle_quotesingle_quotesingle</div></div><div class="ligature"><img src="semicolon_semicolon.png"/><div>semicolon_semicolon</div></div><div class="ligature"><img src="slash_equal.png"/><div>slash_equal</div></div><div class="ligature"><img src="slash_greater.png"/><div>slash_greater</div></div><div class="ligature"><img src="underscore_underscore.png"/><div>underscore_underscore</div></div><div class="ligature"><img src="w_w_w.png"/><div>w_w_w</div></div></div></body></html>
|
||||
|
After Width: | Height: | Size: 799 B |
|
After Width: | Height: | Size: 775 B |
|
After Width: | Height: | Size: 571 B |
|
After Width: | Height: | Size: 798 B |
|
After Width: | Height: | Size: 692 B |
|
After Width: | Height: | Size: 737 B |
|
After Width: | Height: | Size: 529 B |
|
After Width: | Height: | Size: 754 B |
|
After Width: | Height: | Size: 527 B |
|
After Width: | Height: | Size: 714 B |
|
After Width: | Height: | Size: 861 B |
|
After Width: | Height: | Size: 795 B |
|
After Width: | Height: | Size: 998 B |
|
After Width: | Height: | Size: 484 B |
|
After Width: | Height: | Size: 497 B |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 633 B |
|
After Width: | Height: | Size: 791 B |
|
After Width: | Height: | Size: 245 B |
|
After Width: | Height: | Size: 678 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 283 B |
|
After Width: | Height: | Size: 646 B |
|
After Width: | Height: | Size: 408 B |