Home | History | Annotate | Download | only in wsfont
History log of /src/sys/dev/wsfont/wsfont.c
RevisionDateAuthorComments
 1.83  25-Mar-2025  macallan add bigger Comic Mono font for Paul ;)
 1.82  25-Mar-2025  macallan improve rendering:
- no more cut off glyphs
- remove unused characters at the end
 1.81  25-Mar-2025  macallan yesterday I found out that someone made a monospace version of Comic Sans
so, in honour of a joke I made 13 years ago, here it is
 1.80  19-Feb-2023  mlelstv branches: 1.80.6;
Add missing "latin small letter sharp s" (U+00DF) to ibm437 map.
 1.79  31-Oct-2022  macallan This is X11's 75dpi/term14.bdf, use if you want your console to look like an
xterm. Unlike QVSS this font contains accented characters, umlauts etc.
 1.78  08-Jun-2022  uwe wsfont.c: use __arraycount instead of defining it locally
 1.77  24-Dec-2021  jmcneill wsfb: Prefer wide fonts when EDID data is available.

To give us a better chance of picking a readable font, prefer fonts that
will render at least 3mm wide instead of picking the font that will be
closest to that size.
 1.76  20-Nov-2021  rin Oops, forgot to commit builtin_fonts[] parts for Droid_Sans_Mono_10x20.

Noticed by RVP, thanks!
 1.75  20-Nov-2021  rin Add Droid_Sans_Mono_10x20, generated by ttf2wsfont(1).

Having 10x20 in addition to 9x18 and 12x22 may seem redundant, but
this font enables nice 80x24 and 80x30 terminals on WVGA (800x480)
and SVGA (800x600) displays, respectively :)
 1.74  20-Nov-2021  rin Sort Droid Sans Mono family fonts by size.
 1.73  19-Nov-2021  rin Add support to rotate anti-aliased fonts.

wsfont_rotate_{cw,ccw}_internal() have been cleaned up and unified into
new static function wsfont_rotate_internal().
 1.72  19-Nov-2021  rin wsfont_rotate(): Add missing NULL check for wsfont_find0().
 1.71  23-Nov-2020  rin Sort spleen also in builtin_fonts[].
No functional changes.
 1.70  21-Nov-2020  rin Sort spleen by size, instead of character code.
No functional changes.
 1.69  13-Nov-2020  macallan add a rendering of the Liberation Mono font for console use
 1.68  08-Jul-2020  fcambus branches: 1.68.2;
Add "Spleen 6x12" to wsfont, a font targetted at OLED displays.

It contains all printable ASCII characters (96 glyphes).

The font is 2-Clause BSD licensed and is my original creation.
 1.67  05-Mar-2020  fcambus Remove references to non-existing fonts.

Include files with font data (courier11x18.h and iso8x16.h) were removed
in 1999 due to licensing concerns.
 1.66  07-Apr-2019  jmcneill Add "bold16x32", a pixel doubled version of the "bold8x16" font.
 1.65  17-Mar-2019  rin Define missing HAVE_FONT for newcomers.
 1.64  17-Mar-2019  tnn import the Spleen wscons fonts from OpenBSD

Spleen is a 2-clause BSD licensed font set designed by Frederic Cambus.
The 5x8 font is designed for low resolution displays, but the font
comes in a variety of sizes suitable for larger display too.
 1.63  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.62  04-Nov-2017  maya branches: 1.62.2; 1.62.4;
Don't test for failure of malloc(...,M_WAITOK), it cannot fail
 1.61  20-Nov-2016  macallan shiny new console font, use FONT_GO_MONO12x23
 1.60  20-Nov-2016  macallan add WSFONT_PREFER_ALPHA - for drivers that would rather render anti-aliased
fonts
 1.59  09-May-2015  mlelstv branches: 1.59.2;
When searching for a best font also allow fonts too wide for the
desired display columns but penalize these against all narrower ones.
 1.58  18-Apr-2015  mlelstv add "best match" algorithm to wsfont and use this instead of a private
function in rasops.
 1.57  25-Jan-2015  christos add glass tty fonts as described in:
http://mail-index.netbsd.org/netbsd-users/2015/01/19/msg015669.html
 1.56  05-Nov-2014  macallan branches: 1.56.2;
add FONT_DROID_SANS_MONO19x36, so we have something readable on
200+dpi displays
 1.55  05-Apr-2012  macallan branches: 1.55.2;
remove the FreeMono font for licensing reasons
 1.54  13-Jan-2012  macallan branches: 1.54.2;
make this compile again with rotation enabled
 1.53  11-Jan-2012  macallan make rasops_init()'s font selection code a bit less boneheaded by:
- actually trying to pick a font which gets as close as possible to the
requested terminal size
- accepting 0,0 as 'use system default' which can be changed by
options RASOPS_DEFAULT_WIDTH=100
options RASOPS_DEFAULT_HEIGHT=30
default is 80x25
- putting alpha and bitmap fonts in the same list and making wsfont_find()
aware of wether we support alpha fonts or not
- if supported, prefer alpha fonts over otherwise equally suitable bitmap
fonts
 1.52  28-Dec-2011  macallan add a somewhat smaller Droid font
this was generated with a newer version of ttf2wsfont so diacritics are no
longer cut off
 1.51  22-Dec-2011  macallan add some pre-rendered anti-aliased fonts from pkgsrc:
- DejaVu Sans Mono from fonts/dejavu-ttf
- Droid Sans Mono from fonts/droid-ttf
- Free Mono from fonts/freefonts-ttf
 1.50  22-Jul-2010  tsutsui branches: 1.50.8; 1.50.12;
In wsfont_rotate_cw_internal() and wsfont_rotate_ccw_internal(),
give a new name to rotated fonts so that 8x8 (and other X==Y) fonts
can be used properly on CW and CCW screens.
 1.49  22-Jul-2010  tsutsui Umm, revert unintended changes.
 1.48  22-Jul-2010  tsutsui Add VT220 8x8 font with ISO-8859-1 chars which is converted from
sys/arch/atari/dev/font_8x8.c.
 1.47  04-May-2010  macallan add translation tables for ISO fonts in order to map unicode box drawing
characters to something else than whitespaces
 1.46  17-Apr-2010  nonaka Added Sharp W-ZERO3 series support.
 1.45  28-Apr-2008  martin branches: 1.45.20; 1.45.22;
Remove clause 3 and 4 from TNF licenses
 1.44  02-Feb-2007  ober branches: 1.44.40; 1.44.42; 1.44.44;
Updates to allow Zaurus screen to rotate 90 degrees to a usable state with the keyboard. Patch from peter@ copied from OpenBSD. Feedback and OK from matt@
 1.43  28-Aug-2006  christos branches: 1.43.2;
fix incomplete initializers
 1.42  16-Jul-2006  rillig Reordered the declaration-specifiers so that "inline" comes before
"int", which fixes a gcc warning.
 1.41  17-Mar-2006  chris Fix range to check to avoid a static buffer overrun, when
font->encoding == 4, which would cause access past the end of the encodings
array.

Fixes Coverity CID 1446.

Note that perhaps we should actually have an encoding line for
WSDISPLAY_FONTENC_ISO2 which is encoding 4.
 1.40  24-Dec-2005  perry branches: 1.40.4; 1.40.6; 1.40.8; 1.40.10; 1.40.12;
__inline__ -> inline
 1.39  11-Dec-2005  christos merge ktrace-lwp.
 1.38  29-May-2005  christos branches: 1.38.2;
- add const
- avoid variable shadowing.
 1.37  27-Feb-2005  perry nuke trailing whitespace
 1.36  23-Apr-2004  itojun branches: 1.36.4; 1.36.6;
use bounded string ops
 1.35  15-Dec-2003  tsutsui Use aprint_debug() instead of aprint_normal() for debug info.
 1.34  14-Jul-2003  uwe Add vt220 8x10 koi8-r/koi8-u fonts so that I can read mail using
Jornada 680 console.

XXX: The fonts are marked WSDISPLAY_FONTENC_ISO, which is wrong, but
at least makes the alphabet available. Line-drawing is all broken.
 1.33  10-Feb-2003  jdolecek branches: 1.33.2;
undo constification of 'data' for wsdisplay font - unfortunately we need
to be able to adjust the font to display adapter needs very soon (in consinit()),
so it's not possible to do font copy
 1.32  09-Feb-2003  jdolecek wsfont_lock(): if bitorder/byteorder doesn't match, copy the font to new font
also if the font is static (and thus it's 'data' point to const/text location) -
later call to wsfont_rev{bit,byte}() needs to change the font data in-place
print info about the font copy when it's made

problem pointed out by Matthias Drochner
 1.31  09-Feb-2003  jdolecek make 'name' and 'data' of struct wsdisplay_font const, mark data arrays
in font sources const
 1.30  12-Jan-2003  tsutsui Add entries for vt220l8x16 and vt220iso8x16.
 1.29  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.28  21-Mar-2002  enami - Allocate enough space to hold an object.
- No need to request to zero clear when we overwrite soon.
 1.27  20-Mar-2002  ad Add missing structure member copies in wsfont_add0().
 1.26  18-Mar-2002  uch include sys/queue.h.
 1.25  13-Mar-2002  ad Reorganise the wsfont stuff slightly so that multiple display adapters
with different bit/byte order requirements can co-exist happily.
 1.24  13-Mar-2002  ad Clean up.
 1.23  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.22  13-Oct-2001  augustss ANSIfy.
 1.21  03-Sep-2001  drochner make dynamic font addition usable,
export font matching function for common use
 1.20  12-Jun-2001  uwe branches: 1.20.2;
In wsfont_map_unichar: when checking that 'lo' is within 'map2' range,
compare 'lo', not 'hi' (only partially edited cut-n-paste it seems).
 1.19  31-Mar-2001  enami WSDISPLAY_FONTENC_SONY is gone.
 1.18  24-Feb-2001  cgd branches: 1.18.2;
Avoid sequence point issues.
 1.17  07-Feb-2001  ad Fix duplicate cookie.
 1.16  02-Feb-2001  marcus Added a function to remap Unicode character to font glyph index.
 1.15  24-Nov-2000  tsutsui Add another font from 4.4BSD-Lite2/luna68k.
 1.14  21-Nov-2000  tsutsui Add a couple of fonts used on Sony NEWS.
Generated from (recently removed) sys/arch/newsmips/dev/fnt{,24}.c.
 1.13  13-Jun-2000  ad Use my proper name.
 1.12  07-Jan-2000  enami branches: 1.12.2;
Restore the system priority level on error return.
 1.11  05-Jan-2000  ad Add two new members to 'struct wsdisplay_font': 'bitorder' and 'byteorder'.
 1.10  14-Dec-1999  ad - Squash a few stylish nits.
- Move font flags to wsfont.h. There is a point to this. I'll remember soon.
 1.9  04-Dec-1999  ad - Stylistic cleanup.
- Make ifndef'ed out bits look less like a statement of intent.
 1.8  02-Nov-1999  takemura Add new font sets - VT220 8x8 and 8x10.
I brought them from arch/i386/isa/pcvt/Util/fonts.
You can specify FONT_VT220L8x8 or FONT_VT220L8x10 in a configuration file.
 1.7  18-May-1999  ad branches: 1.7.2; 1.7.4; 1.7.6; 1.7.8;
Assign ownership & copyright to TNF. There is probably a procedure for this
that I am unaware of. Also some KNF.
 1.6  26-Apr-1999  ad Bump WSFONT_L2R/R2L by +1 so 0 can mean no specific order is required.
Change entry for QVSS to match bitorder.
 1.5  26-Apr-1999  ad Change WSFONT_LITTLE/WSFONT_BIG to WSFONT_L2R/WSFONT_R2L to reduce possible
confusion.
 1.4  14-Apr-1999  ad Replace qvss8x15 with version from NetBSD/vax, which contains the full ISO
character set.
 1.3  14-Apr-1999  ad Remove courier11x18 due to licensing concerns. Fixup license on lucida16x29.
 1.2  13-Apr-1999  ad Fixed licensing due to a foobar on my behalf.
 1.1  13-Apr-1999  ad Initial import of wsfont, an in-kernel font table for wscons/rcons.
 1.7.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.6.1  15-Nov-1999  fvdl Sync with -current
 1.7.4.6  21-Apr-2001  bouyer Sync with HEAD
 1.7.4.5  12-Mar-2001  bouyer Sync with HEAD.
 1.7.4.4  11-Feb-2001  bouyer Sync with HEAD.
 1.7.4.3  08-Dec-2000  bouyer Sync with HEAD.
 1.7.4.2  22-Nov-2000  bouyer Sync with HEAD.
 1.7.4.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.18.2.8  15-Jan-2003  thorpej Sync with HEAD.
 1.18.2.7  18-Oct-2002  nathanw Catch up to -current.
 1.18.2.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.18.2.5  08-Jan-2002  nathanw Catch up to -current.
 1.18.2.4  22-Oct-2001  nathanw Catch up to -current.
 1.18.2.3  21-Sep-2001  nathanw Catch up to -current.
 1.18.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.18.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.20.2.5  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.20.2.4  16-Jun-2002  jdolecek catch up with -current
 1.20.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.20.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.33.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.33.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.33.2.1  03-Aug-2004  skrll Sync with HEAD
 1.36.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.36.4.1  29-Apr-2005  kent sync with -current
 1.38.2.3  26-Feb-2007  yamt sync with head.
 1.38.2.2  30-Dec-2006  yamt sync with head.
 1.38.2.1  21-Jun-2006  yamt sync with head.
 1.40.12.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.40.10.1  19-Apr-2006  elad sync with head.
 1.40.8.3  03-Sep-2006  yamt sync with head.
 1.40.8.2  11-Aug-2006  yamt sync with head
 1.40.8.1  01-Apr-2006  yamt sync with head.
 1.40.6.1  22-Apr-2006  simonb Sync with head.
 1.40.4.1  09-Sep-2006  rpaulo sync with head
 1.43.2.1  09-Feb-2007  ad Sync with HEAD.
 1.44.44.2  11-Aug-2010  yamt sync with head.
 1.44.44.1  16-May-2008  yamt sync with head.
 1.44.42.1  18-May-2008  yamt sync with head.
 1.44.40.1  02-Jun-2008  mjf Sync with HEAD.
 1.45.22.2  05-Mar-2011  rmind sync with head
 1.45.22.1  30-May-2010  rmind sync with head
 1.45.20.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.45.20.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.50.12.2  05-Apr-2012  mrg sync to latest -current.
 1.50.12.1  18-Feb-2012  mrg merge to -current.
 1.50.8.1  17-Apr-2012  yamt sync with head
 1.54.2.1  09-Apr-2012  riz Pull up following revision(s) (requested by macallan in ticket #169):
sys/dev/wsfont/FreeMono_12x22.h: file removal
sys/dev/wsfont/wsfont.c: revision 1.55
sys/dev/wsfont/files.wsfont: revision 1.19
remove the FreeMono font for licensing reasons
 1.55.2.1  03-Dec-2017  jdolecek update from HEAD
 1.56.2.3  05-Dec-2016  skrll Sync with HEAD
 1.56.2.2  06-Jun-2015  skrll Sync with HEAD
 1.56.2.1  06-Apr-2015  skrll Sync with HEAD
 1.59.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.62.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.62.4.1  10-Jun-2019  christos Sync with HEAD
 1.62.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.68.2.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.80.6.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed