Author: wmb Date: 2007-05-04 09:28:03 +0200 (Fri, 04 May 2007) New Revision: 353
Added: ofw/termemu/difont.fth Modified: cpu/x86/basefw.bth cpu/x86/pc/olpc/loaddropins.fth ofw/termemu/font.fth Log: Load the screen font from a dropin module so it's easy to change, and also support .psf font format.
Modified: cpu/x86/basefw.bth =================================================================== --- cpu/x86/basefw.bth 2007-05-04 07:01:20 UTC (rev 352) +++ cpu/x86/basefw.bth 2007-05-04 07:28:03 UTC (rev 353) @@ -59,7 +59,7 @@
fload ${BP}/ofw/termemu/loadfb.fth \ S Frame buffer support \ fload ${BP}/ofw/termemu/cp881-16.fth \ ISO-Latin1 Font -fload ${BP}/ofw/termemu/gallant2.fth \ Sun font, tip o' the hat to Vaughn Pratt +fload ${BP}/ofw/termemu/difont.fth \ Get font from a dropin module
fload ${BP}/ofw/gui/alert.fth \ Basic dialogs and alerts fload ${BP}/dev/stringio.fth \ Output diversion
Modified: cpu/x86/pc/olpc/loaddropins.fth =================================================================== --- cpu/x86/pc/olpc/loaddropins.fth 2007-05-04 07:01:20 UTC (rev 352) +++ cpu/x86/pc/olpc/loaddropins.fth 2007-05-04 07:28:03 UTC (rev 353) @@ -37,3 +37,5 @@ " ${BP}/cpu/x86/pc/olpc/images/usbkey.565" " disk.565" $add-deflated-dropin " ${BP}/cpu/x86/pc/olpc/images/wireless.565" " wireless.565" $add-deflated-dropin " ${BP}/cpu/x86/pc/olpc/images/xo.565" " xo.565" $add-deflated-dropin + + " ${BP}/ofw/termemu/gallant.obf" " font" $add-deflated-dropin
Added: ofw/termemu/difont.fth =================================================================== --- ofw/termemu/difont.fth (rev 0) +++ ofw/termemu/difont.fth 2007-05-04 07:28:03 UTC (rev 353) @@ -0,0 +1,10 @@ +purpose: Incorporate font into dictionary from dropin module + +0 value 'di-font + +: di-font ( -- adr ) + 'di-font ?dup if exit then + " font" find-drop-in if drop to 'di-font 'di-font exit then + 0 +; +' di-font to romfont
Modified: ofw/termemu/font.fth =================================================================== --- ofw/termemu/font.fth 2007-05-04 07:01:20 UTC (rev 352) +++ ofw/termemu/font.fth 2007-05-04 07:28:03 UTC (rev 353) @@ -61,11 +61,28 @@
headerless : decode-font ( hdr-adr -- bits-adr width height advance min-char #glyphs ) - dup d# 24 + swap ( bits-adr hdr-adr ) - d# 24 ( bits-adr hdr-adr hdr-len ) - 4 decode-bytes " font" $= 0= abort" Not a font" ( bits-adr str ) - 5 0 do decode-int -rot loop ( bits-adr width height advance min #gl str ) - 2drop ( bits-adr width height advance min-char #glyphs ) + dup " font" comp 0= if ( hdr-adr ) \ OBF font format + dup d# 24 + swap ( bit-adr hdr-adr ) + 4 + d# 20 ( bit-adr hdr-adr' hdr-len ) + 5 0 do decode-int -rot loop ( bits-adr width height advance min #gl str ) + 2drop ( bits-adr width height advance min-char #glyphs ) + exit + then ( hdr-adr ) + + \ http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html + dup le-l@ h# 864ab572 = if ( hdr-adr ) \ PSF2 format, little endian + >r ( r: hdr-adr ) + r@ r@ 8 + le-l@ + ( bits-adr r: hdr-adr ) + r@ h# 1c + le-l@ ( bits-adr width r: hdr-adr ) + r@ h# 18 + le-l@ negate ( bits-adr width height r: hdr-adr ) + over 7 + 8 / ( bits-adr width height advance r: hdr-adr ) + 0 ( bits-adr width height advance min r: hdr-adr ) + r@ h# 10 + le-l@ ( bits-adr width height advance #glyphs r: hdr-adr ) + r> drop ( bits-adr width height advance #glyphs ) + exit + then ( hdr-adr ) + + true abort" Not a font" ; headers also forth definitions