- C++ 52.6%
- C 42.9%
- Python 1.9%
- Roff 1.5%
- Makefile 0.9%
- Other 0.1%
gpft
GPU-rendering Proportional-Font Terminal
"gpft" is a terminal program that supports (and defaults to using) proportional rather than monospace fonts, and does its rendering on the GPU. It's essentially spft ported on top of nanovgXC. It also adds support for fallback fonts, Ctrl-Shift-C and Ctrl-Shift-V for copy and paste to/from the clipboard, and the ability to build for Wayland.
Thanks to nanovg and nanovgXC for doing the hard parts.
GPU "acceleration"
Because gpft uses the GPU to render everything, it ought to be faster than rendering on the CPU, right? But in my tests, Cairo (which uses the CPU) can render about 50% faster. And Freetype/Xft is almost twice as fast as the GPU. Any of them can draw much faster than a typical monitor refresh rate (on my unexceptional hardware).
Building
Just type make. By default, a version for X11 (using XCB) is built. To
build the Wayland version, create a file called "Makefile.local" and add
WINDOW_BACKEND := wayland to it. (If you've already built, make sure to do
make clean after changing that before rebuilding.) When built for Wayland,
the name of the binary is "gpft-wayland". WINDOW_BACKEND can also be set to
"xlib".
There is also an "xlib-cairo" backend. This actually runs faster on my hardware, and, in my opinion, the text looks better. When built like this, the name of the binary is "cpft". (There is also an "xlib-freetype" backend, which runs the fastest of all, but this should be considered experimental.)
Take a peek at the appropriate "shell*.nix" file to see what the dependencies are for the backend you're building for.
Elastic Tabs
Like its predecessor spft, gpft supports elastic tabs.
Elastic tabs are enabled by a couple of special escape sequences. "\x1B[?5001h" starts a group of elastic-tabbed lines with the line that the cursor is on. "\x1B[?5001l" ends that group; the line containing the cursor is not part of it. There are also expanded versions of these: "\x1B[?5002;Nh", where N is the number of columns that will be right-justified; and "\x1B?5002;1l" which ends the group, but includes the line with the cursor (useful if you're right-justifying columns in a single line).
An "els" script is included in the "utils" directory; it wraps "ls" so the output is appropriate for elastic tabs. You might want to put something like this in your .bashrc:
if [ -n "$SPFT" ]; then
alias ls='els --color=always'
fi
There is also an "end-tabs" script that is useful when piping "els" or some other elastic-tabbed program through "head". It ensures that the group of elastic-tabbed lines is terminated.