# Small fonts file suitable for boot console use with vt?



## Stilez (Jan 11, 2019)

My current system uses the smallest-displayed font file I've got, and switches to it during boot:

```
allscreens_flags="-f vgarom-thin-8x16"
```

It works fine, but it's still too large/wide for comfort. Unfortunately most threads mentioning fonts seem to focus on desktop environments, where quite a few fonts are pre-loaded, and there is GUI software to view others before installing.

The ports/packages repos lists many font pkgs, but it's a complete guess from hundreds of arbitrary files (from this perspective) - and many won't have small variants, or perhaps not compatible for boot console use. I'm already at maximum resolution for the display.

Ideally I'd like a choice of a couple or so already-existing vt-compatible monospace fonts, covering the full character set (I'm in the UK) in case some output needs full unicode/whatever-else charset. Other than that, I'm aiming for maybe 65% - 80% of the size of my vgarom thin 8x16 font.  If none exist but they're easy to create myself from some definition file, that could be a possible fallback.

Thanks for help with suggestions!


----------



## k.jacker (Jan 11, 2019)

The font size alone, does not make the characters appear small on the screen.
The screen resolution makes the beat here.
You could either load a kms graphics driver, or boot in UEFI mode (if available) to make use of higher resolutions.


----------



## Stilez (Jan 11, 2019)

Its only a small console monitor, 1280 x 1024. so I probably do need to load a small bitmap font.  With character sizes around 6x10 - 6x12 pixels, and without X or any desktop/GUI pkgs installed, it's probably tricky to render a font clearly that size.  Perhaps it's better to use a bitmap that's designed small? But I lack experience, what do you think?


----------



## k.jacker (Jan 12, 2019)

To get tiny fonts on the console, you have to load a driver that can provide that or boot in UEFI mode.

Let me explain: (I may be slightly wrong at some points, it's some time since I looked into that topic)
Drivers providing high resolution (and thus small fonts) for console and Xorg:

vesa(4) - the raster text mode driver for the old syscons console sc(4). Provides provides high resolution text console with tiny fonts. Was very good at it's time, but I wouldn't recommend it anymore. vt(4) became the default console driver at some point in FreeBSD 10.x-RELEASE if I recall correctly. Forget this one
drm(7) a kms graphics driver. Available for almost every graphics hardware today, legacy and modern from Intel, Nvidia and AMD. Loading a such driver, will usually switch the text console to the highest resolution possible with your graphics-adapter/monitor combination.
uefi(8) booting will also provide high resolution text console, and is IMO the top choice on server hardware with e.g. ASMedia 2000 series vga adapter where no other options are available. At the loader prompt, one can use the `gop list` and `gop set` commands to find the desired mode and then add a line like _kern.vt.fb.default_mode="your wanted resolution"_ to /boot/loader.conf
If case you are booting in BIOS mode (or call it legacy/CSM) you will be stuck with a legacy 80x25 chracter console if you don't load a driver. Loading fonts won't get you anywhere.

The question you have to ask yourself: can you make use of a kms driver (Intel, Nvidia, AMD) , and if not (ASMedia and friends) can you alternatively boot in UEFI mode...


----------



## Stilez (Jan 12, 2019)

I forgot to say - yes, it's booted in UEFI mode (Suoermicro X10 series board), and using the vt driver. I'm clearly not in standard 80x25 legacy, and I can select different fonts in /usr/local/share/vt and see them (and their different font faces/sizes) on my console. But I can't specify a larger resolution than 1280x1024, or its being ignored if I do, and the smallest font installed is vgarom thin 8x16.


----------



## k.jacker (Jan 12, 2019)

I'm a bit confused what you actually wnt to archive.

Do you want the characters themselves look bigger or do you want to get more characters per line?


----------



## Stilez (Jan 12, 2019)

I want the characters to look smaller on the console display. Meaning, there would be slightly more chars per line and slightly more lines per screen. On a comparatively small resolution display like this, it really needs bitmap fonts to do that - meaning downloading a font of the appropriate pixel size, rather than changing resolution or scaling within the system and rendering a small version of an existing installed font.

My system doesn't have such a font installed, but I'm sure they do exist


----------



## k.jacker (Jan 12, 2019)

You're right. There are no fonts with a 6-pixel width and I am not sure if vt supports them.
In the early days of vt, before the vga-thin fonts where available, I converted my on font from a .bdf file I found somewhere on the web.
Though it was a regular 8x16 font.
The tool to convert fonts from other formats is vtfontcvt(8)


----------



## T-Daemon (Jan 12, 2019)

Download terminus-font-4.47.tar.gz , extract,
`# vtfontcvt -w 6 -h 12 ter-u12n.bdf /usr/share/vt/fonts/terminus-u12n.fnt`
`# vidcontrol -f terminus-u12n.fnt` ,

set in /etc/rc.conf

Info: vtfontcvt(8), Newcons wiki, chapter Font Support


----------



## Stilez (Jan 13, 2019)

T-Daemon said:


> Download terminus-font-4.47.tar.gz , extract,


That font only unpacks to .pcf, and it looks like vtfontcvt needs bdf or hex. 

I tried pcf2bdf as an intermediate step, which worked, but then vtfontcvt doesn't convert BDF fonts with widths that aren't 8 or >=14, either ("Unsupported width" error)


----------



## T-Daemon (Jan 13, 2019)

Stilez said:


> That font only unpacks to .pcf, and it looks like vtfontcvt needs bdf or hex.


 I don’t understand what you mean, I’m using ter-u12b.fnt (6x12 pixel) (ter-u12b.bdf) font right now. Are you sure you have downloaded the right package?
`# ls -1 terminus-font-4.47 |grep .bdf`

```
ter-u12b.bdf
ter-u12n.bdf
ter-u14b.bdf
ter-u14n.bdf
ter-u14v.bdf
ter-u16b.bdf
ter-u16n.bdf
ter-u16v.bdf
ter-u18b.bdf
ter-u18n.bdf
ter-u20b.bdf
ter-u20n.bdf
ter-u22b.bdf
ter-u22n.bdf
ter-u24b.bdf
ter-u24n.bdf
ter-u28b.bdf
ter-u28n.bdf
ter-u32b.bdf
ter-u32n.bdf
```


----------



## Stilez (Jan 13, 2019)

I think I might know why. I used pkg install, which showed terminus 4.47.tar.gz, which unpacked and installed the font as pcf files. Probably if I'd manually downloaded from your link off sourceforge, I'd have got bdf directly. But I got the bdf file anyway, by using pcf2bdf. And now it works - thank you!!

It's a really nice font and size - smaller but not too small, and clear and legible.


----------



## Stilez (Jan 13, 2019)

One question though.  That font is now configured to be loaded in the loader. Unlike rc, if a loader command fails, it can kill system boot. What happens if it tried to load that font, and for some reason the file didn't exist there (eg, I accidentally forgot to copy it over when mirroring the system, or something). 

Is there a way to mitigate any potential issue, or will it just note the missing font file and failurew of vidcontreol -f, and treat it as a NO-OP, and continue happily with the rest of thew boot sequence, using vgarom or 80x25 or whatever it was using before that line failed?


----------



## jb_fvwm2 (Jan 13, 2019)

T-Daemon said:


> Download terminus-font-4.47.tar.gz , extract,
> `# vtfontcvt -w 6 -h 12 ter-u12n.bdf /usr/share/vt/fonts/terminus-u12n.fnt`
> `# vidcontrol -f terminus-u12n.fnt` ,
> 
> ...



That was fun!


----------

