version 1.7 | | version 1.8 |
---|
| | |
* Graphical routines for drawing fonts. | | * Graphical routines for drawing fonts. |
* | | * |
* $Log$ | | * $Log$ |
| | * Revision 1.8 1999/10/14 04:48:21 donut |
| | * alpha fixes, and gl_font args |
| | * |
* Revision 1.7 1999/10/12 05:21:10 donut | | * Revision 1.7 1999/10/12 05:21:10 donut |
* made colored messages work even with fonts that have chars in the 0-6 range | | * made colored messages work even with fonts that have chars in the 0-6 range |
* | | * |
| | |
#include <stdarg.h> | | #include <stdarg.h> |
#include <stdio.h> | | #include <stdio.h> |
#include <stdlib.h> | | #include <stdlib.h> |
| | #include <string.h> |
| | |
#include <fcntl.h> | | #include <fcntl.h> |
| | |
| | |
| | |
bits = 0; | | bits = 0; |
| | |
VideoOffset1 = (unsigned int)DATA + y * ROWSIZE + x; | | VideoOffset1 = (size_t)DATA + y * ROWSIZE + x; |
| | |
gr_vesa_setpage(VideoOffset1 >> 16); | | gr_vesa_setpage(VideoOffset1 >> 16); |
| | |
| | |
| | |
bits = 0; | | bits = 0; |
| | |
VideoOffset1 = (unsigned int)DATA + y * ROWSIZE + x; | | VideoOffset1 = (size_t)DATA + y * ROWSIZE + x; |
| | |
gr_vesa_setpage(VideoOffset1 >> 16); | | gr_vesa_setpage(VideoOffset1 >> 16); |
| | |
| | |
BM_FLAG_TRANSPARENT, //flags | | BM_FLAG_TRANSPARENT, //flags |
0, //rowsize | | 0, //rowsize |
NULL, //data | | NULL, //data |
0 //selector | | #ifdef BITMAP_SELECTOR |
| | 0, //selector |
| | #endif |
| | 0, //avg_color |
| | 0 //unused |
}; | | }; |
| | |
int gr_internal_color_string(int x, int y, char *s ) | | int gr_internal_color_string(int x, int y, char *s ) |
| | |
#else //OGL | | #else //OGL |
#include "../main/inferno.h" | | #include "../main/inferno.h" |
#include "ogl_init.h" | | #include "ogl_init.h" |
| | #include "args.h" |
//font handling routines for OpenGL - Added 9/25/99 Matthew Mueller - they are here instead of in arch/ogl because they use all these defines | | //font handling routines for OpenGL - Added 9/25/99 Matthew Mueller - they are here instead of in arch/ogl because they use all these defines |
| | |
int pow2ize(int x);//from ogl.c | | int pow2ize(int x);//from ogl.c |
| | |
} | | } |
if (!(font->ft_flags & FT_COLOR)) { | | if (!(font->ft_flags & FT_COLOR)) { |
//use GL_INTENSITY instead of GL_RGB | | //use GL_INTENSITY instead of GL_RGB |
font->ft_parent_bitmap.gltexture->handle=-2; | | if (FindArg("-gl_font2")){ |
font->ft_parent_bitmap.gltexture->internalformat=GL_LUMINANCE4_ALPHA4; | | font->ft_parent_bitmap.gltexture->internalformat=GL_LUMINANCE4_ALPHA4; |
font->ft_parent_bitmap.gltexture->format=GL_LUMINANCE_ALPHA; | | font->ft_parent_bitmap.gltexture->format=GL_LUMINANCE_ALPHA; |
| | }else if (FindArg("-gl_font3")){ |
| | font->ft_parent_bitmap.gltexture->internalformat=GL_RGBA2; |
| | font->ft_parent_bitmap.gltexture->format=GL_RGBA; |
| | }else if (FindArg("-gl_font4")){ |
| | font->ft_parent_bitmap.gltexture->internalformat=GL_RGBA; |
| | font->ft_parent_bitmap.gltexture->format=GL_RGBA; |
| | }else{ |
| | font->ft_parent_bitmap.gltexture->internalformat=GL_INTENSITY4; |
| | font->ft_parent_bitmap.gltexture->format=GL_LUMINANCE; |
| | } |
} | | } |
ogl_loadbmtexture_m(&font->ft_parent_bitmap,0); | | ogl_loadbmtexture_m(&font->ft_parent_bitmap,0); |
} | | } |
| | |
| | |
cfread(font,1,datasize,fontfile); | | cfread(font,1,datasize,fontfile); |
| | |
| | newfont->ft_flags=font->ft_flags; |
| | newfont->ft_w=font->ft_w; |
| | newfont->ft_h=font->ft_h; |
| | newfont->ft_baseline=font->ft_baseline; |
| | newfont->ft_maxchar=font->ft_maxchar; |
| | newfont->ft_minchar=font->ft_minchar; |
| | newfont->ft_bytewidth=font->ft_bytewidth; |
| | |
nchars = font->ft_maxchar-font->ft_minchar+1; | | nchars = font->ft_maxchar-font->ft_minchar+1; |
| | |
if (font->ft_flags & FT_PROPORTIONAL) { | | if (font->ft_flags & FT_PROPORTIONAL) { |
| | |
font->ft_widths = (short *) (((int) font->ft_widths) + ((ubyte *) font)); | | newfont->ft_widths = (short *) (font->ft_widths + ((ubyte *) font)); |
| | |
font->ft_data = ((int) font->ft_data) + ((ubyte *) font); | | newfont->ft_data = (font->ft_data) + ((ubyte *) font); |
| | |
font->ft_chars = (unsigned char **)malloc( nchars * sizeof(unsigned char *)); | | newfont->ft_chars = (unsigned char **)malloc( nchars * sizeof(unsigned char *)); |
| | |
ptr = font->ft_data; | | ptr = newfont->ft_data; |
| | |
for (i=0; i< nchars; i++ ) { | | for (i=0; i< nchars; i++ ) { |
font->ft_chars[i] = ptr; | | newfont->ft_chars[i] = ptr; |
if (font->ft_flags & FT_COLOR) | | if (newfont->ft_flags & FT_COLOR) |
ptr += font->ft_widths[i] * font->ft_h; | | ptr += newfont->ft_widths[i] * newfont->ft_h; |
else | | else |
ptr += BITS_TO_BYTES(font->ft_widths[i]) * font->ft_h; | | ptr += BITS_TO_BYTES(newfont->ft_widths[i]) * newfont->ft_h; |
} | | } |
| | |
} else { | | } else { |
| | |
font->ft_data = ((unsigned char *) font) + sizeof(*font); | | newfont->ft_data = ((unsigned char *) font) + sizeof(*font); |
| | |
font->ft_chars = NULL; | | newfont->ft_chars = NULL; |
font->ft_widths = NULL; | | newfont->ft_widths = NULL; |
| | |
ptr = font->ft_data + (nchars * font->ft_w * font->ft_h); | | ptr = newfont->ft_data + (nchars * newfont->ft_w * newfont->ft_h); |
} | | } |
| | |
if (font->ft_flags & FT_KERNED) | | if (newfont->ft_flags & FT_KERNED) |
font->ft_kerndata = ((int) font->ft_kerndata) + ((ubyte *) font); | | newfont->ft_kerndata = (font->ft_kerndata) + ((ubyte *) font); |
| | |
| | |
if (font->ft_flags & FT_COLOR) { //remap palette | | if (newfont->ft_flags & FT_COLOR) { //remap palette |
ubyte palette[256*3]; | | ubyte palette[256*3]; |
ubyte colormap[256]; | | ubyte colormap[256]; |
int freq[256]; | | int freq[256]; |
| | |
| | |
colormap[255] = 255; | | colormap[255] = 255; |
| | |
decode_data_asm(font->ft_data, ptr-font->ft_data, colormap, freq ); | | decode_data_asm(newfont->ft_data, ptr-newfont->ft_data, colormap, freq ); |
} | | } |
| | |
cfclose(fontfile); | | cfclose(fontfile); |
| | |
memcpy(newfont,font,(ubyte*)&newfont->oldfont-(ubyte*)newfont);//fill in newfont data from oldfont struct | | // memcpy(newfont,font,(ubyte*)&newfont->oldfont-(ubyte*)newfont);//fill in newfont data from oldfont struct |
mprintf((0,"%i %i %i\n",sizeof(grs_font),sizeof(old_grs_font),(ubyte*)&newfont->oldfont-(ubyte*)newfont)); | | // mprintf((0,"%i %i %i\n",sizeof(grs_font),sizeof(old_grs_font),(ubyte*)&newfont->oldfont-(ubyte*)newfont)); |
| | |
//set curcanv vars | | //set curcanv vars |
| | |