Patch your own glyphs to your terminal fonts (e.g., extra powerline separators).
Enjoy your original statusline in the terminal!
- Your own SVG files (
.svg
) can be used to generate glyphs.- Preset glyphs below are also pure SVG files.
- Generated glyphs are always half-width.
- It is less likely to cause problems related with ambiguous-width characters.
- The position of separator glyphs can be finely adjusted.
git clone https://github.com/s417-lama/terminal-glyph-patcher.git
python-fontforge
package is required. Install instruction: Installing FontForge
cd terminal-glyph-patcher
fontforge -script terminal-glyph-patcher.py /path/to/your/font.ttf
Then install the patched font to your system, and apply it to your terminal.
./statusline_test.sh
Then statuslines like the top image should be shown.
For now you should modify terminal-glyph-patcher.py
directly.
What you should modify is symbols
list in the source code.
This list looks like the below.
{'unicode': 0xe0b0, 'align': 'l', 'stretch': 'xy', 'overlap': 0.05, 'path': 'svg/arrow_right.svg' },
{'unicode': 0xe0b1, 'align': 'l', 'stretch': 'xy', 'overlap': 0.05, 'path': 'svg/arrow_right_thin.svg'},
{'unicode': 0xe0b2, 'align': 'r', 'stretch': 'xy', 'overlap': 0.01, 'path': 'svg/arrow_left.svg' },
{'unicode': 0xe0b3, 'align': 'r', 'stretch': 'xy', 'overlap': 0.01, 'path': 'svg/arrow_left_thin.svg' },
Unicode number to be register. If a glyph already exists in the font, it will be overwritten.
If l
is set, the glyph is aligned to the left edge. If r
, it is aligned to the right.
If c
is set, the glyph is aligned in the center.
If x
is set, the glyph is expanded to fill up the entire horizontal space. y
is for the vertical space.
Sometimes there exists a gap between glyphs. To fill it up, overlap
parameter is used.
The output glyph width will be Glyph width * (1 + overlap)
, which means the glyph will be a bit leaked from the normal bounding box.
If align
parameter is l
, the overflow goes to the left side. If r
, it goes to the right side.
Path to your SVG file.
For example, U+E0B0
glyph should align to the left (align='l'
), and it should fill up the entire glyph space (stretch='xy'
).
To fill up the left gap, overlap
parameter is set to some value (this parameter is decided in an ad-hoc way).
The glyphs below are included in svg/
directory by default.
These glyphs are pure SVG files.
Basically it follows the layout convention of Powerline Extra Symbols (not exactly same, though).
U+E0B0 | U+E0B1 | U+E0B2 | U+E0B3 | U+E0B4 | U+E0B5 | U+E0B6 | U+E0B7 |
U+E0B8 | U+E0B9 | U+E0BA | U+E0BB | U+E0BC | U+E0BD | U+E0BE | U+E0BF |
U+E0C0 | U+E0C1 | U+E0C2 | U+E0C3 | U+E0C4 | U+E0C5 | ||
Sometimes powerline separators are misaligned because of the mismatch between fonts and terminal emulators. It depends on terminal emulators you use, the font size, the resolution of displays, and so on. So it is hard to create powerline fonts that will work well on every environment.
You can adjust some parameters (overlap
in symbols
list, y_scale
and y_offset
in terminal-glyph-patcher.py
) to make it fit in your environment.
If there is a horizontal gap between glyphs, try to increase overlap
parameter of each glyph.
If glyphs are smaller than the line height, try to increase y_scale
parameter.
If glyphs are vertically misaligned, try to change y_offset
parameter.
- Powerline Extra Symbols
- Part of Nerd Fonts. This project (terminal-glyph-patcher) was inspired by it.
- vim-powerline
- Terminal-glyph-patcher is based on
vim-powerline
's patcher script.
- Terminal-glyph-patcher is based on
- powerline/fontpatcher
- The original font patcher of Powerline.