UTF-8 on 8.0-CURRENT: Yes We Can!

Ed Schouten ed at 80386.nl
Wed Jul 15 07:28:11 UTC 2009


Hi Mel,

* Mel Flynn <mel.flynn+fbsd.current at mailing.thruhere.net> wrote:
> Would there be a screen font yet for Unicode? share/syscons/fonts
> doesn't show me one. Or do you plan to retain mapping multibyte to
> 8-bit positions?

Right now my console driver already understands the notion of fonts, but
unfortunately there is no ioctl/API to load them into the kernel.

I've written a tool called fontcvt (in my Perforce branch) which
converts .bdf files to a C file with some array initialisations.
Eventually I'll modify this tool to emit binary data. I've looked at
the Linux PSF2 format, but it has some restrictions...

Some details about vt(4)'s handling of fonts:

vt(4) allows you to use different glyphs for bold characters. To
preserve space, fontcvt makes sure we never store two glyphs that are
exactly the same. This means that if the bold character is the same as
the normal one, it will only store one of them. All the different types
of spaces (ASCII space, NBSP) are also stored as one glyph.

The file format also has two remapping tables from Unicode code points
to font indices; one for normal characters, one for bold characters.
These tables have to be ordered, because the kernel will just do some
binary searching. Each entry is also includes a length of the mapping,
so right now mapping ASCII to its glyphs only takes one entry in the
table.

fontcvt also discards entries from the bold table if there is an equal
one in the normal table. The kernel will display normal characters if
there is no bold one. When there is no entry in any of the tables, it
will always use glyph 0. fontcvt makes sure it stores the glyph for
U+FFFD at location 0.

Here's how I store the default in-kernel font:

	http://p4web.freebsd.org/@md=d&c=WOQ@//depot/user/ed/newcons/sys/dev/vt/font/font_default.c

When I've finished the font loader, I'll just strip it down to ASCII, so
we'll load the complete font through rc(8).

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20090715/6b660ef2/attachment.pgp


More information about the freebsd-current mailing list