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

@@ -46,7 +46,7 @@
\author{Original version - Eric S. Raymond\\
(Edited and expanded for 3.7 by Mike Stephenson and others)}
%DO NOT REMOVE NH_DATESUB \date{DATE(%B %-d, %Y)}
\date{February 27, 2022}
\date{May 7, 2022}
\maketitle
@@ -6071,6 +6071,46 @@ version 3.6.0, statues are displayed as the monster they depict.
So S\verb+_+rock is only used for boulders and not used at all if
overridden by the more specific S\verb+_+boulder.
%.lp
%.hn 2
\subsection*{Customizing Map Glyph Representations Using Unicode}
%.pg
If your platform or terminal supports the display of UTF-8 character
sequences, you can customize your game display by assigning Unicode
codepoint values and red-green-blue colors to glyph
representations. The customizations can be specified for use with a symset that
has a UTF8 handler within the symbols file such as the enhanced1 set, or
individually within your own nethack.rc file.
The format for defining a glyph representation is:\\
\begin{verbatim}
OPTIONS=glyph:glyphid/U+nnnn/R-G-B
\end{verbatim}
The window port that is active needs to provide support for displaying UTF-8
character sequences and explicit 24-bit red-green-blue colors in order for the glyph
representation to be visible as specified.
For example, the following line in your configuration file will cause
the glyph representation for glyphid G_pool to use Unicode codepoint U+224B
and the color represented by R-G-B value 0-0-160:\\
\begin{verbatim}
OPTIONS=glyph:G_pool/U+224B/0-0-160
\end{verbatim}
The list of acceptable glyphid's can be produced by
\begin{verbatim}
nethack --glyphids
\end{verbatim}
Individual NetHack glyphs can be specified using the G\verb+_+ prefix,
or you can use an S\verb+_+ symbol for a glyphid and store the custom
representation for all NetHack glyphs that would map to that
particular symbol.
You will need to select a symset with a UTF8 handler to enable the
display of the customizations, such as the Enhanced symset.
%.pg
%.hn 2
\subsection*{Configuring {\it NetHack\/} for Play by the Blind}