You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
5 years ago | |
---|---|---|
.gitignore | 5 years ago | |
LICENSE | 5 years ago | |
README | 5 years ago | |
build | 5 years ago |
README
iconsolata A Bash script to download and patch Inconsolata with Nerd Font glyphs OVERVIEW I really appreciate Inconsolata as a terminal font. It's subtly idiosyncratic yet incredibly legible. It reads like a printed book so well I sometimes find myself skeptical I am looking at a monospace font. Of course, I prefer a looptail 'g' and slashed '0', but Inconsolata's 't' and 'v' glyphs, as well as pretty much any character with a distinct hook, like 'y' and '9', are underappreciated works of functional art. Thank Raph Levien. However great Inconsolata is, I also like to use Powerline symbols and other Nerd Font glyphs for my Vim statusline and whatnot. I periodically tried out Inconsolata Nerd Font patches but always ended up reverting to alternatives because the patch for Inconsolata just wasn't right. After one particular retry, I decided it was worth it to figure out what was going wrong and if I could somehow manage to make it work. This script is a manifestation of that frustration. My primary issue with the Inconsolata Nerd Font patches, which this script attempts to resolve, is that either Powerline glyphs were misaligned and too tall, or in cases where they were aligned, the line height was ridiculously tall. After some sleuthing and elementary typography education, I found my observations were an unfortunate byproduct of the way the Nerd Font patcher handles discrepencies between the OS/2 Windows and HHea values for ascent and descent. In the case of misalignment, the Nerd Font patcher was using the Windows values to insert Nerd Font glyphs, wheareas my terminal was using the HHea to render the font. In the case of ridiculously tall line height, the Nerd Font patcher was simply doing the same after overwriting the HHea with the Windows values. In short, the problem seemed to be an effect of the Nerd Font patcher using the OS/2 Windows accent and descent to determine line height. Because Microsoft Typography discourages this practice in its documentation, I'm guessing the blame lies with the Nerd Font patcher, but I'm not even remotely familar with the intricacies of typography, so I'm very hesistant to confidently assert this as fact. What I can definitively say is that the OS/2 Windows values for ascent and descent were much larger than the HHea values and that this seemed to be directly related to the issues I was having. To remedy, I basically chose a descent somewhere in between that looked right. Using that descent, this script then calculates the ascent which vertically centers the 'A' glyph in the line and applies this ascent and descent for both OS/2 and HHea. It then lets the Nerd Font patcher do its thing. When using a descent which maintains a reasonable line height, the ascent and descent values ended up being much closer to the original HHea values than the Windows. In addition to all of this, I find that if I'm being particularly particular, I prefer the semi-expanded width of Inconsolata. In a terminal setting, I also have a preference for an unmistakable distinction between regular and bold weights. Thusly, this script generates the patched fonts as a new family, appropriately named Iconsolata, using the semi-expanded width and the extra-bold weight as bold. USAGE Download patched fonts from https://pub.files.alt-tek.com/iconsolata or ensure the below depencencies are installed and run './build' from a terminal DEPENDENCIES I used macOS and MacPorts packages to initially develop this script but I imagine it could work on other Unix-like systems if you have the following: - Bash, obviously - GNU Coreutils (or equivalent). Nothing too fancy is required, mostly just basic shell utilities. The most eccentric necessity is probably base64, which is used to generate the fonts as a CSS file. - cURL to download the source repositories - Python 3.6 or greater - FontForge and its Python 3.x bindings. If the bindings work without the full FontForge application, that is probably enough. The MacPorts fontforge package seemed to provide everything needed, I imagine something like python3-fontforge might get you there for Debian.