A collection of bitmap .FNT fonts created from various programming fonts, and to be used by FreeBSD's vt(-ng) console terminal.
At present, only IBMPlexMono-Light and IBMPlexMono-Medium each in pixel height ranges of 12–16 have been converted.
These were generated using FontForge under FreeBSD with 160dpi setting on output to best match FHD (1920x1080) on a 14" diagonal screen size.
The relevant lines in vtfontcvt-ng are 300-348 at vtfontcvt-ng.c which relate to parsing the section commented as:
Step 1: Parse FONT logical font descriptor and FONTBOUNDINGBOX bounding box
Here, in any case, is my recipe:
- Use FontForge to load up .OTF file (in the weight of choice).
- Force encoding through
Encoding > Force Encoding > ISO 8859-1
- Generate bitmaps through
Element > Bitmap Strikes Available
- Generate font through
File > Generate Fonts...
after selecting BDF output
(Don't worry too much about the other options, as a hand-edit in Part II will take care of things.)
Part II—Fix generated BDF files BDF font format
Now the BDF will have a couple of things that will trip up vtfontcvt-ng:
- The dreaded
font spacing "C" (character cell) required
error. bitmap with unsupported DWIDTH
.- Even after you fix this you might/will get
PIO_FONT: Invalid argument
.
A couple of edits in the BDF will solve this:
FONTBOUNDINGBOX <fbbw>
has to match all theDWIDTH <dwidth>
lines below (or x2 according to source, but we'll put that aside). This will require some hand-tuning because if you change fbbw to match dwidth the characters will be scrunched; and if you change dwidth to match fbbw, then your characters will be spaced too far apart. Anyway the important thing is that they match.- The other edit was to delete all characters after 255. The
STARTCHAR
might be descriptive or not (IBMPlexMono has it as ydieresis), but just delete all of the remaining chars while leaving the finalENDFONT
line in place. In the case of IBMPlexMono, I simply searched forENCODING 256
; selected from the previousSTARTCHAR
line to the penultimate line; and then deleted that selected block, leaving theENDFONT
line intact. - In
FONT
line ensure thatSPACING
as per X- logical font description is 'C' for Character Cell (See: X logical font description). And also ensure that the line that explicitly statesSPACING
matches with a corresponding 'C'.
With these changes go ahead and run the usual commands to install:
$ vtfontcvt-ng IBMPlexMono/IBMPlexMono-Light-14.bdf fnt/IBMPlexMono-Light-14.fnt
$ sudo cp fnt/*.fnt /usr/share/vt/fonts
$ sudo vidcontrol -f /usr/share/vt/fonts/IBMPlexMono-Light-14.fnt # While in vt, and not in X-
That should give you a path to a font of choice. Of course, this doesn't ensure that the generated font will be at all aesthetically pleasing, and certainly won't be as nice as a handcrafted bitmap font. But it did allow me to get a decent approximation of IBMPlexMono under vt.
Regards.