From 49e3eb31e4975299400c7aa284fe417bfb9ddf98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sat, 21 Jun 2014 19:48:22 +0000 Subject: [PATCH] added ST fonts --- Makefile | 1 + include/font.h | 98 +++++++++++++++++++++++++++++++++++++++++++++ video/fnt_st_8x16.c | 6 +-- 3 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 include/font.h diff --git a/Makefile b/Makefile index 70128ef..9201c92 100644 --- a/Makefile +++ b/Makefile @@ -124,6 +124,7 @@ CSRCS= \ radeon_accel.c \ radeon_cursor.c \ radeon_monitor.c \ + fnt_st_8x16.c \ \ x86decode.c \ x86sys.c \ diff --git a/include/font.h b/include/font.h new file mode 100644 index 0000000..84ba317 --- /dev/null +++ b/include/font.h @@ -0,0 +1,98 @@ +/* + * font.h - font specific definitions + * + * Copyright (c) 2001 Lineo, Inc. + * Copyright (c) 2004 by Authors: + * + * Authors: + * MAD Martin Doering + * + * This file is distributed under the GPL, version 2 or at your + * option any later version. See doc/license.txt for details. + */ + +#ifndef FONT_H +#define FONT_H + +#include + +/* font header flags */ + +#define F_DEFAULT 1 /* this is the default font (face and size) */ +#define F_HORZ_OFF 2 /* there are left and right offset tables */ +#define F_STDFORM 4 /* is the font in standard format */ +#define F_MONOSPACE 8 /* is the font monospaced */ + +/* font style bits */ + +#define F_THICKEN 1 +#define F_LIGHT 2 +#define F_SKEW 4 +#define F_UNDER 8 +#define F_OUTLINE 16 +#define F_SHADOW 32 + +/* font specific linea variables */ + +extern const uint16_t *v_fnt_ad; /* address of current monospace font */ +extern const uint16_t *v_off_ad; /* address of font offset table */ +extern uint16_t v_fnt_nd; /* ascii code of last cell in font */ +extern uint16_t v_fnt_st; /* ascii code of first cell in font */ +extern uint16_t v_fnt_wr; /* font cell wrap */ + +/* character cell specific linea variables */ + +extern uint16_t v_cel_ht; /* cell height (width is 8) */ +extern uint16_t v_cel_mx; /* needed by MiNT: columns on the screen minus 1 */ +extern uint16_t v_cel_my; /* needed by MiNT: rows on the screen minus 1 */ +extern uint16_t v_cel_wr; /* needed by MiNT: length (in int8_ts) of a line of characters */ + +/* + * font_ring is a struct of four pointers, each of which points to + * a list of font headers linked together to form a string. + */ + +extern struct font_head *font_ring[4]; /* Ring of available fonts */ +extern int16_t font_count; /* all three fonts and NULL */ + +/* the font header descibes a font */ + +struct font_head { + int16_t font_id; + int16_t point; + int8_t name[32]; + uint16_t first_ade; + uint16_t last_ade; + uint16_t top; + uint16_t ascent; + uint16_t half; + uint16_t descent; + uint16_t bottom; + uint16_t max_char_width; + uint16_t max_cell_width; + uint16_t left_offset; /* amount character slants left when skewed */ + uint16_t right_offset; /* amount character slants right */ + uint16_t thicken; /* number of pixels to smear */ + uint16_t ul_size; /* size of the underline */ + uint16_t lighten; /* mask to and with to lighten */ + uint16_t skew; /* mask for skewing */ + uint16_t flags; + + const uint8_t *hor_table; /* horizontal offsets */ + const uint16_t *off_table; /* character offsets */ + const uint16_t *dat_table; /* character definitions */ + uint16_t form_width; + uint16_t form_height; + + struct font_head *next_font;/* pointer to next font */ + uint16_t font_seg; +}; + + + +/* prototypes */ + +void font_init(void); /* initialize BIOS font ring */ +void font_set_default(void); /* choose the default font */ + +#endif /* FONT_H */ diff --git a/video/fnt_st_8x16.c b/video/fnt_st_8x16.c index 8c323cc..1c6a2ed 100644 --- a/video/fnt_st_8x16.c +++ b/video/fnt_st_8x16.c @@ -7,11 +7,9 @@ * option any later version. See doc/license.txt for details. */ -#include "config.h" -#include "portab.h" #include "font.h" -static const UWORD off_table[] = +static const uint16_t off_table[] = { 0x0000, 0x0008, 0x0010, 0x0018, 0x0020, 0x0028, 0x0030, 0x0038, 0x0040, 0x0048, 0x0050, 0x0058, 0x0060, 0x0068, 0x0070, 0x0078, @@ -48,7 +46,7 @@ static const UWORD off_table[] = 0x0800, }; -static const UWORD dat_table[] = +static const uint16_t dat_table[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1104,