OpenBSD Journal

b2k13 hackathon report: Miod Vallat (miod@) on UTF-8 wscons

Contributed by pitrh on from the UTF-8 means Use The Force dept.

Our third b2k13 hackathon report comes from Miod Vallat (miod@), who writes:
I was intending to spend b2k13 working on the glass console subsystem, wsdisplay(4), and especially two areas: UTF-8 support on console, and loadable font support for raster displays (i.e. every display but text-mode vga).

I had started to work on UTF-8 support on console some years ago, during another hackathon. That work had never been completed, because of issues when using 8-bit characters while running in non-UTF-8 mode (which is still the default). So my first task was to sit down and fix these issues, which allowed the UTF-8 support code to be committed... and immediately afterwards, exposing bugs in it, mostly in the line editing behaviour when in UTF-8 mode. I'll hopefully be able to address them in the near future.

UTF-8 is however useless if you limit yourself to 256 characters only, which is what the default kernel font on raster displays provides. The next step towards making UTF-8 useful in console, is to allow the user to load more fonts, to be able to display as many Unicode characters as possible. The wscons(4) framework already had a rough tool to load fonts (wsfontload(8)), but it was designed with the text-mode VGA display in mind (which can store multiple fonts in its device memory). So I have started to add font loading support to the raster displays as well, whenever possible. As a bonus, the default font, provided by the kernel, will now appear in the font list reported by the 'wsfontload -l' command.

The final step was to allow for the newly loaded font to be used for display. I have added a `display.font' item to wsconsctl(8), which allows the current font to be selected by name.

There is still a lot of steps missing until we can enjoy UTF-8 console and multiple fonts, and these will hopefully be completed in the near future.

These include:

  • Creating tools allowing users to create their own console fonts from a Truetype font or an X11 bdf font.
  • Allowing multiple fonts of similar metrics to be used simultaneously, with a priority scheme, so that one could for example stick to the kernel font and load a new font only for the Unicode glyphs not available in the default font.
  • Adding support for sparse font files. Right now (due to its text-mode VGA roots), font support expects fonts to span a contiguous range of Unicode symbols. This will obviously not scale.

Expect some of this to happen in the near future!

Thank you, Miod for the report and all the good work! We look forward to seeing truly international support in our consoles soon!

(Comments are closed)


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]