ENHANCED_SYMBOLS

A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c
This commit is contained in:
nhmall
2022-05-07 10:25:13 -04:00
parent 132e1d433a
commit cb0c21e91d
50 changed files with 3072 additions and 1242 deletions

View File

@@ -78,6 +78,7 @@ struct DisplayDesc {
int intr; /* non-zero if inread was interrupted */
winid lastwin; /* last window used for I/O */
char dismiss_more; /* extra character accepted at --More-- */
int topl_utf8; /* non-zero if utf8 in str */
};
#endif /* WINDOW_STRUCTS */
@@ -165,6 +166,10 @@ E void term_end_raw_bold(void);
E void term_end_color(void);
E void term_start_color(int color);
#endif /* TEXTCOLOR */
#ifdef ENHANCED_SYMBOLS
extern void term_start_24bitcolor(struct unicode_representation *);
extern void term_end_24bitcolor(void); /* termcap.c, consoletty.c */
#endif
/* ### topl.c ### */
@@ -182,6 +187,11 @@ E void setclipped(void);
E void docorner(int, int);
E void end_glyphout(void);
E void g_putch(int);
#ifdef ENHANCED_SYMBOLS
#if defined(WIN32) || defined(UNIX)
E void g_pututf8(uint8 *);
#endif
#endif /* ENHANCED_SYMBOLS */
E void win_tty_init(int);
/* external declarations */
@@ -200,6 +210,7 @@ E void tty_dismiss_nhwindow(winid);
E void tty_destroy_nhwindow(winid);
E void tty_curs(winid, int, int);
E void tty_putstr(winid, int, const char *);
E void tty_putmixed(winid window, int attr, const char *str);
E void tty_display_file(const char *, boolean);
E void tty_start_menu(winid, unsigned long);
E void tty_add_menu(winid, const glyph_info *, const ANY_P *, char, char,