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

From: Ed Schouten <ed_at_80386.nl>
Date: Wed, 15 Jul 2009 09:28:09 +0200
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/_at_md=d&c=WOQ_at_//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/

Received on Wed Jul 15 2009 - 05:28:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:51 UTC