fix glyph_to_cmap() odd macro results

Some discrepencies between glyph_is_cmap and glyph_to_cmap
arose after b14b830b because the change resulted in
glyph_is_cmap matching on zap beams which weren't accounted
for in the glyph_to_cmap macro. It is unlikely that
glyph_to_cmap will ever be used on such a glyph, but at least
have glyph_to_cmap return a sane value rather than drop through
to the last-resort value (currently NO_GLYPH) which is far
outside the range of the defsyms[] array indices.
This commit is contained in:
nhmall
2022-08-27 08:23:24 -04:00
parent 5d90d2250c
commit c92a3b0653
2 changed files with 30 additions and 21 deletions
+2
View File
@@ -731,6 +731,8 @@ enum glyph_offsets {
? (((glyph) - GLYPH_CMAP_B_OFF) + S_grave) \ ? (((glyph) - GLYPH_CMAP_B_OFF) + S_grave) \
: glyph_is_cmap_c(glyph) \ : glyph_is_cmap_c(glyph) \
? (((glyph) - GLYPH_CMAP_C_OFF) + S_digbeam) \ ? (((glyph) - GLYPH_CMAP_C_OFF) + S_digbeam) \
: glyph_is_cmap_zap(glyph) \
? ((((glyph) - GLYPH_ZAP_OFF) % 4) + S_vbeam) \
: NO_GLYPH) : NO_GLYPH)
#define glyph_to_swallow(glyph) \ #define glyph_to_swallow(glyph) \
+7
View File
@@ -4026,6 +4026,13 @@ wiz_display_macros(void)
glyph, test); glyph, test);
putstr(win, 0, buf); putstr(win, 0, buf);
} }
if (glyph_is_cmap_zap(glyph)
&& !(test >= S_vbeam && test <= S_rslant)) {
Sprintf(buf,
"glyph_is_zap(glyph=%d) returned non-zap cmap %d",
glyph, test);
putstr(win, 0, buf);
}
/* check against defsyms array subscripts */ /* check against defsyms array subscripts */
if (test < 0 || test >= SIZE(defsyms)) { if (test < 0 || test >= SIZE(defsyms)) {
if (!trouble++) if (!trouble++)