use alternate font if available ( for autogenerated box drawing characters )

This commit is contained in:
macallan 2010-05-04 05:00:33 +00:00
parent 15a269471f
commit 9fae8e4448
5 changed files with 54 additions and 46 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: chipsfb.c,v 1.20 2009/08/20 02:40:57 macallan Exp $ */
/* $NetBSD: chipsfb.c,v 1.21 2010/05/04 05:00:33 macallan Exp $ */
/*
* Copyright (c) 2006 Michael Lorenz
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.20 2009/08/20 02:40:57 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.21 2010/05/04 05:00:33 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -682,6 +682,7 @@ static void
chipsfb_putchar(void *cookie, int row, int col, u_int c, long attr)
{
struct rasops_info *ri = cookie;
struct wsdisplay_font *font = PICK_FONT(ri, c);
struct vcons_screen *scr = ri->ri_hw;
struct chipsfb_softc *sc = scr->scr_cookie;
@ -694,10 +695,10 @@ chipsfb_putchar(void *cookie, int row, int col, u_int c, long attr)
int fg, bg, uc;
int x, y, wi, he;
wi = ri->ri_font->fontwidth;
he = ri->ri_font->fontheight;
wi = font->fontwidth;
he = font->fontheight;
if (!CHAR_IN_FONT(c, ri->ri_font))
if (!CHAR_IN_FONT(c, font))
return;
bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
@ -706,11 +707,11 @@ chipsfb_putchar(void *cookie, int row, int col, u_int c, long attr)
if (c == 0x20) {
chipsfb_rectfill(sc, x, y, wi, he, bg);
} else {
uc = c-ri->ri_font->firstchar;
data = (uint8_t *)ri->ri_font->data + uc *
uc = c - font->firstchar;
data = (uint8_t *)font->data + uc *
ri->ri_fontscale;
chipsfb_setup_mono(sc, x, y, wi, he, fg, bg);
chipsfb_feed(sc, ri->ri_font->stride * he, data);
chipsfb_feed(sc, font->stride * he, data);
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pm2fb.c,v 1.3 2010/03/16 21:27:02 macallan Exp $ */
/* $NetBSD: pm2fb.c,v 1.4 2010/05/04 05:00:33 macallan Exp $ */
/*
* Copyright (c) 2009 Michael Lorenz
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.3 2010/03/16 21:27:02 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.4 2010/05/04 05:00:33 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -676,6 +676,7 @@ static void
pm2fb_putchar(void *cookie, int row, int col, u_int c, long attr)
{
struct rasops_info *ri = cookie;
struct wsdisplay_font *font = PICK_FONT(ri, c);
struct vcons_screen *scr = ri->ri_hw;
struct pm2fb_softc *sc = scr->scr_cookie;
uint32_t mode;
@ -686,10 +687,10 @@ pm2fb_putchar(void *cookie, int row, int col, u_int c, long attr)
int uc, i;
int x, y, wi, he;
wi = ri->ri_font->fontwidth;
he = ri->ri_font->fontheight;
wi = font->fontwidth;
he = font->fontheight;
if (!CHAR_IN_FONT(c, ri->ri_font))
if (!CHAR_IN_FONT(c, font))
return;
bg = ri->ri_devcmap[(attr >> 16) & 0xf];
fg = ri->ri_devcmap[(attr >> 24) & 0xf];
@ -698,9 +699,8 @@ pm2fb_putchar(void *cookie, int row, int col, u_int c, long attr)
if (c == 0x20) {
pm2fb_rectfill(sc, x, y, wi, he, bg);
} else {
uc = c - ri->ri_font->firstchar;
data = (uint8_t *)ri->ri_font->data + uc *
ri->ri_fontscale;
uc = c - font->firstchar;
data = (uint8_t *)font->data + uc * ri->ri_fontscale;
mode = PM2RM_MASK_MIRROR;
switch (ri->ri_font->stride) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: radeonfb.c,v 1.34 2009/07/23 07:21:45 macallan Exp $ */
/* $NetBSD: radeonfb.c,v 1.35 2010/05/04 05:00:33 macallan Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.34 2009/07/23 07:21:45 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.35 2010/05/04 05:00:33 macallan Exp $");
#define RADEONFB_DEFAULT_DEPTH 32
@ -220,7 +220,7 @@ static struct wsscreen_descr radeonfb_stdscreen = {
0, 0, /* ncols, nrows */
NULL, /* textops */
8, 16, /* fontwidth, fontheight */
WSSCREEN_WSCOLORS, /* capabilities */
WSSCREEN_WSCOLORS | WSSCREEN_REVERSE, /* capabilities */
0, /* modecookie */
};
@ -2169,7 +2169,7 @@ radeonfb_init_screen(void *cookie, struct vcons_screen *scr, int existing,
* XXX: font selection should be based on properties, with some
* normal/reasonable default.
*/
ri->ri_caps = WSSCREEN_WSCOLORS;
ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
/* initialize and look for an initial font */
rasops_init(ri, dp->rd_virty/8, dp->rd_virtx/8);
@ -2348,21 +2348,28 @@ radeonfb_putchar(void *cookie, int row, int col, u_int c, long attr)
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
struct radeonfb_display *dp = scr->scr_cookie;
struct wsdisplay_font *font = PICK_FONT(ri, c);
uint32_t x, y, w, h;
uint32_t bg, fg;
uint32_t bg, fg, flg;
uint8_t *data;
if (dp->rd_wsmode != WSDISPLAYIO_MODE_EMUL)
return;
if (!CHAR_IN_FONT(c, ri->ri_font))
if (!CHAR_IN_FONT(c, font))
return;
w = ri->ri_font->fontwidth;
h = ri->ri_font->fontheight;
w = font->fontwidth;
h = font->fontheight;
flg = attr & 0xff;
if (flg & WSATTR_REVERSE) {
fg = ri->ri_devcmap[(attr >> 16) & 0xf];
bg = ri->ri_devcmap[(attr >> 24) & 0xf];
} else {
bg = ri->ri_devcmap[(attr >> 16) & 0xf];
fg = ri->ri_devcmap[(attr >> 24) & 0xf];
}
x = ri->ri_xorigin + col * w;
y = ri->ri_yorigin + row * h;
@ -2370,8 +2377,8 @@ radeonfb_putchar(void *cookie, int row, int col, u_int c, long attr)
if (c == 0x20) {
radeonfb_rectfill(dp, x, y, w, h, bg);
} else {
data = (uint8_t *)ri->ri_font->data +
(c - ri->ri_font->firstchar) * ri->ri_fontscale;
data = (uint8_t *)font->data +
(c - font->firstchar) * ri->ri_fontscale;
radeonfb_setup_mono(dp, x, y, w, h, fg, bg);
radeonfb_feed_bytes(dp, ri->ri_fontscale, data);

View File

@ -1,4 +1,4 @@
/* $NetBSD: voodoofb.c,v 1.21 2009/11/26 15:17:10 njoly Exp $ */
/* $NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $ */
/*
* Copyright (c) 2005, 2006 Michael Lorenz
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.21 2009/11/26 15:17:10 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -670,6 +670,7 @@ static void
voodoofb_putchar(void *cookie, int row, int col, u_int c, long attr)
{
struct rasops_info *ri = cookie;
struct wsdisplay_font *font = PICK_FONT(ri, c);
struct vcons_screen *scr = ri->ri_hw;
struct voodoofb_softc *sc = scr->scr_cookie;
@ -678,10 +679,10 @@ voodoofb_putchar(void *cookie, int row, int col, u_int c, long attr)
int fg, bg, uc, i;
int x, y, wi, he;
wi = ri->ri_font->fontwidth;
he = ri->ri_font->fontheight;
wi = font->fontwidth;
he = font->fontheight;
if (!CHAR_IN_FONT(c, ri->ri_font))
if (!CHAR_IN_FONT(c, font))
return;
bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
@ -690,14 +691,13 @@ voodoofb_putchar(void *cookie, int row, int col, u_int c, long attr)
if (c == 0x20) {
voodoofb_rectfill(sc, x, y, wi, he, bg);
} else {
uc = c-ri->ri_font->firstchar;
data = (uint8_t *)ri->ri_font->data + uc *
uc = c - font->firstchar;
data = (uint8_t *)font->data + uc *
ri->ri_fontscale;
voodoofb_setup_mono(sc, x, y, wi, he, fg, bg);
for (i = 0; i < he; i++) {
voodoofb_feed_line(sc,
ri->ri_font->stride, data);
data += ri->ri_font->stride;
voodoofb_feed_line(sc, font->stride, data);
data += font->stride;
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: voyagerfb.c,v 1.2 2009/08/20 02:40:57 macallan Exp $ */
/* $NetBSD: voyagerfb.c,v 1.3 2010/05/04 05:00:33 macallan Exp $ */
/*
* Copyright (c) 2009 Michael Lorenz
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.2 2009/08/20 02:40:57 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.3 2010/05/04 05:00:33 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -679,6 +679,7 @@ static void
voyagerfb_putchar(void *cookie, int row, int col, u_int c, long attr)
{
struct rasops_info *ri = cookie;
struct wsdisplay_font *font = PICK_FONT(ri, c);
struct vcons_screen *scr = ri->ri_hw;
struct voyagerfb_softc *sc = scr->scr_cookie;
uint32_t cmd;
@ -687,10 +688,10 @@ voyagerfb_putchar(void *cookie, int row, int col, u_int c, long attr)
int fg, bg, uc;
uint8_t *data;
int x, y, wi, he;
wi = ri->ri_font->fontwidth;
he = ri->ri_font->fontheight;
wi = font->fontwidth;
he = font->fontheight;
if (!CHAR_IN_FONT(c, ri->ri_font))
if (!CHAR_IN_FONT(c, font))
return;
bg = ri->ri_devcmap[(attr >> 16) & 0x0f];
fg = ri->ri_devcmap[(attr >> 24) & 0x0f];
@ -699,9 +700,8 @@ voyagerfb_putchar(void *cookie, int row, int col, u_int c, long attr)
if (c == 0x20) {
voyagerfb_rectfill(sc, x, y, wi, he, bg);
} else {
uc = c - ri->ri_font->firstchar;
data = (uint8_t *)ri->ri_font->data + uc *
ri->ri_fontscale;
uc = c - font->firstchar;
data = (uint8_t *)font->data + uc * ri->ri_fontscale;
cmd = ROP_COPY |
SM502_CTRL_USE_ROP2 |
SM502_CTRL_CMD_HOSTWRT |