Skip site navigation (1)Skip section navigation (2)
Date:      5 Feb 1999 23:31:50 +0100
From:      naddy@mips.rhein-neckar.de (Christian Weisgerber)
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Console font format
Message-ID:  <79frgm$4c1$1@mips.rhein-neckar.de>
References:  <199902050741.BAA25655@detlev.UUCP>

next in thread | previous in thread | raw e-mail | index | archive | help
Joel Ray Holveck <joelh@gnu.org> wrote:

> I need to make an ISO-8859-3 font for syscons.  Can somebody tell me
> the format for the font files in /usr/share/syscons/fonts?

Well, it's not that difficult to figure out. These files are uuencoded
versions of the actual font image. vidcontrol(1) will happily load both
uuencoded and raw files.

The format of the raw font image is straightforward:
- Each character is composed of <n> scan lines. There are fonts with 8,
  14, and 16 scan lines.
- Each scan line is simply a byte => all characters are eight pixels
  wide.
- There is no interleaving, i.e. bytes (0..n)*m make up character <m>.
- There are 256 characters total.

Basically you can check out a font with hd(1).

$ uudecode /usr/share/syscons/fonts/iso-8x16.fnt
$ hd iso-8x16 | less

Fonts with 16 scan lines are convenient, because that makes 1 character
== 16 bytes exactly one line in hd(1)'s output. (Of course you can
define your own dump format with hexdump(1).) So the line at 0x210 will
be character 0x21:

00000210 00 00 18 3c 3c 3c 18 18 18 00 18 18 00 00 00 00  |...<<<..........|

Let's draw that in our mind's eye:

00  ........
00  ........
18  ...xx...
3C  ..xxxx..
3C  ..xxxx..
3C  ..xxxx..
18  ...xx...
18  ...xx...
18  ...xx...
00  ........
18  ...xx...
18  ...xx...
00  ........
00  ........
00  ........
00  ........

Hey, that's an exclamation mark! As if we didn't know. ;-)

As I mentioned, each character is eight pixels wide. Now if you check
out the glyph of, say, an 'M' in fonts similar to the default VGA one,
you'll notice that the glyph has set pixels over the full width.
Nevertheless, when you type MMMM, the characters don't run into each
other, there's always an unset pixel in between. That's a feature of the
VGA character generator. "But", you might throw in, "there are line
drawing characters that can be combined without any empty space in
between". Right. This is due to another idiosyncracy of the VGA
character generator. For characters at positions 0xC0 through 0xDF the
eighth column is displayed as the ninth column as well.

For the upper half of an ISO 8859-x font you might want to actually use
positions 0x80..0x9F, 0xE0..0xFF, and use a screen map (/usr/share/
syscons/scrnmaps) to map 0xC0..0xDF -> 0x80..0x9F in order to circumvent
the doubling of the eighth column for alphabetic characters.

Back to font formats, there is a "PSF" format, which may be of some
interest, since xmbdfed(1) (available as a port, requires Motif or
Lesstif) can edit PSF fonts directly. A PSF font is just the same as a
syscons font with a 4-byte header prepended: 0x36 0x04 0x00 <n>, where
<n> is the number of scan lines.

> Has this format the same in 2.2.8 and -current?

The above holds true for CURRENT, but I don't see why this should have
been changed for the last decade. ;-)

-- 
Christian "naddy" Weisgerber                  naddy@mips.rhein-neckar.de
  See another pointless homepage at <URL:http://home.pages.de/~naddy/>.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?79frgm$4c1$1>