/* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ /* font management and such */ #include "mhfont.h" #define MAXFONTS 64 /* font table - 64 fonts ought to be enough */ static struct font_table_entry { int code; HFONT hFont; } font_table[MAXFONTS] ; static int font_table_size = 0; #define NHFONT_CODE(win, attr) (((attr&0xFF)<<8)|(win_type&0xFF)) /* create font based on window type, charater attributes and window device context */ HGDIOBJ mswin_create_font(int win_type, int attr, HDC hdc) { HFONT fnt = NULL; LOGFONT lgfnt; int font_size; int i; ZeroMemory( &lgfnt, sizeof(lgfnt) ); /* try find font in the table */ for(i=0; i=MAXFONTS ) panic( "font table overflow!" ); font_table[font_table_size].code = NHFONT_CODE(win_type, attr); font_table[font_table_size].hFont = fnt; font_table_size++; return fnt; } /* dispose the font object */ void mswin_destroy_font( HGDIOBJ fnt ) { /* do nothing - we are going to reuse the font, then it will destroyed when application exits (at least I hope it will) */ /* if(fnt) DeleteObject(fnt); */ }