NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
A rough "HOWTO" for custom kernel-level fonts in NetBSD framebuffer consoles
A Mac G3 pretending to be a DEC VT220 terminal:
https://twitter.com/Chris_J_Baird/status/549845272314916864
Hidden away in the NetBSD sources is the ttf2wsfont utility. This
isn't installed as a routine part of the system, and must be compiled
manually.
$ cc -DXFREE86_FT2 -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include \
-L/usr/X11R7/lib -lXft /usr/src/xsrc/local/programs/ttf2wsfont/main.c \
-o ttf2wsfont
A very nice public domain truetype font for console use is Viacheslav
Svofski's "Glass TTY" DEC VT220 font conversion, available from
http://christfollower.me/misc/glasstty/index.html
To generate the wsfont data:
$ ./ttf2wsfont Glass_TTY_VT220.ttf 22
This generates the file "Glass_TTY_VT220_10x19.h", which for convience
has been renamed to "glass10x19.h".
Finding a height value for the most pleasingly rendered result can be
a bit tedious. An example for brute-forcing it, with the bash shell:
# render all the height variations..
$ for i in myfont.ttf; do for j in `seq 6 28`; \
do ./ttf2wsfont $i $j; done; done
# ..and then to kick out anything that looks poorly antialiased
$ for i in *.h; do grep -q Xo $i && mv $i /tmp/; done
The second step is the incorporate the custom font data into the local
NetBSD sources. A few edits are required in the
/usr/src/sys/dev/wsfont/ directory.
/usr/src/sys/dev/wsfont/files.wsfont:
defflag opt_wsfont.h FONT_BOLD8x16
+ FONT_GLASS10x19
FONT_GALLANT12x22
FONT_QVSS8x15
"FONT_GLASS10x19" is an arbitrary handle.
/usr/src/sys/dev/wsfont/wsfont.c:
#ifdef FONT_DROID_SANS_MONO19x36
#include <dev/wsfont/Droid_Sans_Mono_19x36.h>
#endif
+ #ifdef FONT_GLASS10x19
+ #include </root/glass10x19.h>
+ #endif
Again in wsfont.c:
#ifdef FONT_DROID_SANS_MONO19x36
{ { NULL, NULL }, &Droid_Sans_Mono_19x36, 0, 0, WSFONT_STATIC | WSFONT_BUILTIN },
#endif
+ #ifdef FONT_GLASS10x19
+ { { NULL, NULL }, &Glass_TTY_VT220_10x19, 0, 0, WSFONT_STATIC | WSFONT_BUILTIN },
+ #endif
{ { NULL, NULL }, NULL, 0, 0, 0 },
};
"Glass_TTY_VT220_10x19" is the name of the wsdisplay_font struct
declared in glass10x19.h
The last step is to include the "options FONT_GLASS10x19" to the
system kernel configuration, possibly commenting out all the other
fonts, and then build, and boot, into the new kernel.
glass10x19.h and glass10x25.h (..which gives a very nostalgic 80x24
character display on a 800x600 bitmap console) are available for
download from http://kildall.apana.org.au/~cjb/wsfonts/
--
Chris Baird,, <cjb%brushtail.apana.org.au@localhost>
Home |
Main Index |
Thread Index |
Old Index