BDF2PSF(1)

✨ BDF2PSF(1) ✨

okay bestie, sit down, hydrate, because we're about to talk about the console-setup User's Manual page for bdf2psf and it's actually so good πŸ’–


🌸 NAME 🌸

bdf2psf β€” the lil icon that converts a BDF font into PSF format for the Linux console πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

bdf2psf [--fb] [--log logfile] bdf{+bdf} equivalence{+equivalence}
symbols{+[:]symbols} size psf [sfm]

πŸ’… DESCRIPTION πŸ’…

so bdf2psf translates BDF fonts into PSF format, periodt. it's not picky either β€” it accepts fonts with an arbitrary size of the font matrix, which is giving flexible queen energy πŸ‘‘

and here's the little glow-up moment: if the width of the glyph matrix of the source font is 7 or 9 pixels, it generates fonts with a width of 8 pixels. math! slay! ✨


πŸŽ€ OPTIONS πŸŽ€

  • --fb β€” generate the font for framebuffer. and bestie, there are two important differences between the framebuffer and text mode, so listen up:
    1. every font in text mode has to have a matrix 8 pixels wide, and they also have to have either 256 or 512 glyphs.
    2. in most text modes the hardware does some little magic trick to use 8 pixel width fonts as if they were 9 pixels width. to pull this off, the video hardware copies the 8th column into the 9th column of the glyphs with codes from 0xC0 to 0xDF and from 0x1C0 to 0x1DF. and because bdf2psf is very careful when deciding where to place a particular glyph, the encoding of the generated font ends up being more or less arbitrary πŸ™ˆ
  • --log logfile β€” record any problems during the conversion in the file logfile. it's the receipts file, fr fr πŸ“
  • bdf{+bdf} β€” the +-separated list of the source BDF font(s). when a particular symbol is defined in more than one of the specified fonts, the fonts listed first take precedence πŸ‘‘ (first come, first served, no cap)
  • equivalence{+equivalence} β€” a +-separated list of files defining an equivalence relation between the glyphs. go read the EQUIVALENCE FILES section below, it's right there πŸ’–
  • symbols{+[:]symbols} β€” a +-separated list of files describing character sets. the generated font will support all specified character sets. when there's no space in the PSF font for all symbols, the character sets listed first take precedence. and when you put a colon before a character set, no warnings will be issued for symbols that could not be placed in the font. (colon = quiet mode, iykyk). see the CHARACTER SETS section below 🌈
  • size β€” the size of the PSF font. usually 256 or 512 glyphs.
  • psf β€” the name of the generated font. and heads up: if a file with this name already exists, it will be overwritten πŸ’€ so double-check before you commit, bestie
  • sfm β€” save the SFM of the generated font in the file sfm. this parameter is optional 🫢

🧚 CHARACTER SETS 🧚

the encodings of the traditional console fonts are similar to the standard encodings of the different languages. for example there are fonts for all variants of ISO 8859. and honestly? it's redundant. like, ISO 8859-1, ISO 8859-9 and ISO 8859-15 differ only by a few characters and can be easily covered by only one font. the way that they overlap... it's giving minimal effort, maximum coverage ✨

so to determine the minimal set of character sets, a clustering algorithm was used. the source code of fontconfig contains lists of the characters that most languages require β€” one list per language. they started with one character set per language and used the clustering algorithm to join the character sets into bigger ones. the character sets described in files installed in the directory fontsets were the result of the algorithm. these files list the unicodes of the symbols of the character set, one per line. comments starting with a sharp sign are also allowed πŸ‘‘

the files ascii.set, linux.set, freebsd.set and useful.set contain four special character sets. the first lists the ASCII symbols, and the second and third list the symbols from the so called alternate character set (see section "Line Graphics" of terminfo(5)) β€” one for Linux and one for FreeBSD. notice that in order to limit itself to the cp437 character set, the Linux console driver does some approximations of the symbols from the alternate character set. for example it prints U+256A (BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE) instead of the not-equal sign. the file linux.set lists the symbols used by the Linux console driver (i.e. U+256A instead of the not-equal sign). the symbols from freebsd.set are not fixed by the FreeBSD kernel, but there too there are some approximations. approximations everywhere, we love a workaround πŸ’€

in most cases there's more available space in the fonts than necessary. the spare codes can be filled with the symbols from the useful.set special character set. and it's convenient to use a colon before the name of useful.set on the command line of bdf2psf, so no warnings are issued when there's no space in the font for some of these symbols πŸŽ€ (that colon again, iconic behaviour)


πŸ¦‹ EQUIVALENCE FILES πŸ¦‹

the equivalence files define an equivalence relation between unicodes. the sharp sign is used for comments, and the empty lines are ignored. all other lines should list two or more unicodes. only one glyph will be allocated in the PSF font for these unicodes. so basically: "these ones look the same, one glyph is enough" πŸ’…

example:

U+2126 U+03A9
# U+2126:   OHM SIGN
# U+03A9:   GREEK CAPITAL LETTER OMEGA
U+041D U+0048
# U+041D:   CYRILLIC CAPITAL LETTER EN
# U+0048:   LATIN CAPITAL LETTER H

this equivalence file says that U+2126 (the Ohm sign) and U+03A9 (Omega) have the same look so only one glyph is enough for them. and also U+041D (Cyrillic En) and U+0048 (Latin H) look the same. twins! 🫢

two equivalence files are provided β€” standard.equivalents and arabic.equivalents. the first one can be used for all fonts. the purpose of the second is to reduce the number of the necessary glyphs for the Arabic letters at the cost of the font quality. it should be used only for fonts that have to support Arabic but there is not enough space in the PSF font for all Arabic characters. and btw the Uni1 character set is a character set that requires arabic.equivalents. noted πŸ“Œ


🌈 FILES 🌈

all mentioned files and directories are usually installed in /usr/share/bdf2psf or /usr/local/share/bdf2psf πŸ“


πŸ’œ AUTHOR πŸ’œ

Anton Zinoviev <anton@lml.bas.bg> β€” thank you for your service, king πŸ‘‘


and that's the whole page bestie!! this came from console-setup, dated 2006-01-16 🌸 go forth and convert your fonts, you've got this πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from