Enforced the inclusion of windows headers before nethack headers.
Moved the code page 437 mapping table to winnt.c so that it could be used in window and console clients. Added check that fonts support unicode values we use from code page 437. Use unicode to draw text if font supports it otherwise use ASCII.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
/* font management and such */
|
||||
|
||||
#include "winos.h"
|
||||
#include "mhfont.h"
|
||||
|
||||
#define MAXFONTS 64
|
||||
@@ -12,6 +13,7 @@
|
||||
static struct font_table_entry {
|
||||
int code;
|
||||
HFONT hFont;
|
||||
BOOL supportsUnicode;
|
||||
} font_table[MAXFONTS];
|
||||
static int font_table_size = 0;
|
||||
HFONT version_splash_font;
|
||||
@@ -50,6 +52,16 @@ mswin_destroy_splashfonts()
|
||||
DeleteObject(version_splash_font);
|
||||
}
|
||||
|
||||
BOOL
|
||||
mswin_font_supports_unicode(HFONT hFont)
|
||||
{
|
||||
for (int i = 0; i < font_table_size; i++)
|
||||
if (font_table[i].hFont == hFont)
|
||||
return font_table[i].supportsUnicode;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* create font based on window type, charater attributes and
|
||||
window device context */
|
||||
HGDIOBJ
|
||||
@@ -198,6 +210,8 @@ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace)
|
||||
|
||||
font_table[font_index].code = NHFONT_CODE(win_type, attr);
|
||||
font_table[font_index].hFont = fnt;
|
||||
font_table[font_index].supportsUnicode = winos_font_support_cp437(fnt);
|
||||
|
||||
return fnt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user