Setfont2

From Qi-Hardware
Jump to: navigation, search

The Linux frame buffer console fbcon supports black and white fonts.


Contents

[edit] Black and white fonts

The standard way to get smaller fonts like the FAQ says is to use loadfont with PCF fonts.

As a curiosity, here is a very simple program to load fonts from .pnm files that can be created by GIMP: setfont.tar.bz2. It includes a 5x10 font for a 64x24 character terminal, although text is challenging to read when rendered with such a small font.

[edit] 32-bit color fonts

There are two problems with small fonts:

  1. The Ben NanoNote LCD is unusual
  2. Small matrices such as a 4x8 pixel glyph matrix do not have enough detail to accurately model glyphs such as "M"

Both problems can be addressed with SubLCD techniques. You can try this on your NanoNote like this:

  1. Set up the toolchain
cd /tmp/
wget http://amadeus.dist.ro/setfont/setfont2.tar.bz2
tar xjf setfont2.tar.bz2
cd setfont2/

The directory now contains:

  • A kernel patch to support 32-bit fonts on the NanoNote
  • A userspace utility to load 32-bit fonts
  • Two sample fonts that compensate for the NanoNote's display, one with 4x8 glyphs and one with 6x10 glyphs

[edit] To patch your kernel

cd $OPENWRT_XBURST
nice -19 make target/linux/compile V=99  # to create "build_dir"
cd build_dir/linux-xburst_qi_lb60/linux-2.6.32.10
patch -p0 < /tmp/setfont2/fbcon-color-fonts.patch
cd -
nice -19 make target/linux/install V=99
scp bin/xburst/openwrt-xburst-qi_lb60-uImage.bin root@172.16.0.3:/boot/uImage

[edit] To build the userspace utility

Edit STAGING_DIR in Makefile to reflect the location your toolchain.

make
scp setfont2 root@172.16.0.3:/usr/sbin

[edit] Finally

  1. Copy the userspace utility and the font to the NanoNote
  2. Boot the NanoNote with its new kernel
setfont2 path-to-font.pnm

Note that only the current virtual console will be affected. Other consoles won't use the font until you run this command on those consoles as well.

[edit] Limitations

  • Colored text is not supported due to the way that individual color components ( red, green and blue) are used based on the physical location on the LCD at which they can lend luminance to part of a glyph. High intensity white and inverse video do work however
  • The glyphs looks terrible if rendered to odd-numbered rows ( 1, 5, 73, etc.). This won't happen with the console but can happen if you use this type of font in your own software
  • Kernel font data can be no larger than 64K. Without changes to support a CLUT, this limits fonts to 6x10
  • The patch only supports 32-bit frame buffers. It works on the NanoNote but is not a totally generic solution yet
  • Cursors other than CUR_UNDERLINE ( such as CUR_BLOCK or CUR_LOWER_HALF cursors) are not yet supported
  • Glyph #0 is unusable because it carries a fingerprint that identifies the font as a 32-bit font

[edit] Screenshots

The old stock 8x16 font. 40x15 terminal
A 5x10 Black and white font. 64x24 terminal
A 6x10 32-bit color font. 53x24 terminal
A 4x8 32-bit color font. 80x30 terminal

The following two shots are by fbgrab so you can see what's really in the NanoNote's frame buffer in order to produce the SubLCD effects.

Un-fuzzy-4x8-font-mc.png Un-fuzzy-4x8-font-openwrt-logo.png

[edit] Others

http://nafe.sourceforge.net/

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export