MCPcopy Create free account
hub / github.com/NetHack/NetHack / get_char_info

Function get_char_info

win/X11/winmap.c:1109–1143  ·  view source on GitHub ↗

* Retrieve the font associated with the map window and save attributes * that are used when updating it. */

Source from the content-addressed store, hash-verified

1107 * that are used when updating it.
1108 */
1109static void
1110get_char_info(struct xwindow *wp)
1111{
1112 XFontStruct *fs;
1113 struct map_info_t *map_info = wp->map_information;
1114 struct text_map_info_t *text_map = &map_info->text_map;
1115
1116 fs = X11_get_map_font_struct(wp);
1117 text_map->square_width = fs->max_bounds.width;
1118 text_map->square_height = fs->max_bounds.ascent + fs->max_bounds.descent;
1119 text_map->square_ascent = fs->max_bounds.ascent;
1120 text_map->square_lbearing = -fs->min_bounds.lbearing;
1121
1122#ifdef VERBOSE
1123 printf("Font information:\n");
1124 printf("fid = %ld, direction = %d\n", fs->fid, fs->direction);
1125 printf("first = %d, last = %d\n",
1126 fs->min_char_or_byte2, fs->max_char_or_byte2);
1127 printf("all chars exist? %s\n", fs->all_chars_exist ? "yes" : "no");
1128 printf("min_bounds:lb=%d rb=%d width=%d asc=%d des=%d attr=%d\n",
1129 fs->min_bounds.lbearing, fs->min_bounds.rbearing,
1130 fs->min_bounds.width, fs->min_bounds.ascent,
1131 fs->min_bounds.descent, fs->min_bounds.attributes);
1132 printf("max_bounds:lb=%d rb=%d width=%d asc=%d des=%d attr=%d\n",
1133 fs->max_bounds.lbearing, fs->max_bounds.rbearing,
1134 fs->max_bounds.width, fs->max_bounds.ascent,
1135 fs->max_bounds.descent, fs->max_bounds.attributes);
1136 printf("per_char = 0x%lx\n", (unsigned long) fs->per_char);
1137 printf("Text: (max) width = %d, height = %d\n",
1138 text_map->square_width, text_map->square_height);
1139#endif
1140
1141 if (fs->min_bounds.width != fs->max_bounds.width)
1142 X11_raw_print("Warning: map font is not monospaced!");
1143}
1144
1145/*
1146 * keyhit buffer

Callers 1

init_textFunction · 0.85

Calls 3

X11_get_map_font_structFunction · 0.85
printfFunction · 0.85
X11_raw_printFunction · 0.85

Tested by

no test coverage detected