minow@decvax.UUCP (Martin Minow) (09/22/87)
#if 0
Many months ago, I asked the net (unsuccessfully) for information on
setting a font from memory. I finally succeeded in decompiling enough
of the operating system to make it work. The USE_LINEA stuff is only
needed if you want to do line-a text blit's. Note that the font must
be mono-spaced with 8-bit wide characters. I.e., you cannot use the
tiny icon font (6x6).
struct la_font is defined in linea.h on the Mark Williams C system.
If Atari ever gets around to documenting TOS, perhaps this routine
could be added.
Martin Minow
decvax!minow
#endif
#if USE_LINEA
char scr_work[1024]; /* LineA work area */
int scr_fat; /* Max. width for underline */
int scr_chi; /* Underline displacement */
#endif
switch_font(fp)
register struct la_font *fp;
/*
* This code invokes VDI ESC 102 code (page 440 in the July '86
* Abacus ST Internals BIOS listing). I decompiled some library
* routines to see how to make it work. It may not work on new ROMS.
* Martin Minow, Arlington MA 02174. This routine is in the public domain.
*/
{
contrl[0] = 5; /* VDI escape function */
contrl[1] = 0; /* Things in ptsin[] */
contrl[3] = 2; /* Things in intin[] */
contrl[5] = 102; /* Subfun. from Abacus rom list */
contrl[6] = vdi_handle; /* vdi_handle set by v_opnvwk() */
(*(long *) &intin[0]) = fp; /* Put font info in intin[0] */
vdi(); /* Execute vdi trap */
/*
* That's all you need if you only want to use Cconws() (etc.)
* If you want to use the Line-A textblit routine, you should do
* the following, too. See the Mark Williams C manual for info.
*/
#if USE_LINEA
FBASE = fp->font_data;
FWIDTH = fp->font_width;
TEXTFG = 1; /* Text foreground, color 1 */
SRCY = 0;
DELY = fp->font_height;
scr_fat = fp->font_fat_cell;
scr_chi = fp->font_height - 1;
COLBIT0 = 1;
COLBIT1 = 0;
COLBIT2 = 0;
COLBIT3 = 0;
LITEMSK = 0x5555;
SKEWMSK = 0x1111;
SCRTCHP = scr_work;
WEIGHT = 1;
LSTLIN = -1;
#endif
}