void z_set_font (void) { zword win = (h_version == V6) ? cwin : 0; zword font = zargs[0]; if (font != 0) { if (os_font_data (font, &font_height, &font_width)) { store (wp[win].font); wp[win].font = font; wp[win].font_size = (font_height << 8) | font_width; if (!ostream_memory && ostream_screen && enable_buffering) { print_char (ZC_NEW_FONT); print_char (font); } else os_set_font (font); } else store (0); } else store (wp[win].font); }/* z_set_font */
static void set_window (zword win) { flush_buffer (); cwin = win; cwp = wp + win; update_attributes (); if (h_version == V6) { os_set_colour (lo (cwp->colour), hi (cwp->colour)); if (os_font_data (cwp->font, &font_height, &font_width)) os_set_font (cwp->font); os_set_text_style (cwp->style); } else refresh_text_style (); if (h_version != V6 && win != 0) { wp[win].y_cursor = 1; wp[win].x_cursor = 1; } update_cursor (); }/* set_window */
void restart_screen (void) { /* Use default settings */ os_set_colour (h_default_foreground, h_default_background); if (os_font_data (TEXT_FONT, &font_height, &font_width)) os_set_font (TEXT_FONT); os_set_text_style (0); cursor = TRUE; /* Initialise window properties */ mwin = 1; for (cwp = wp; cwp < wp + 8; cwp++) { cwp->y_pos = 1; cwp->x_pos = 1; cwp->y_size = 0; cwp->x_size = 0; cwp->y_cursor = 1; cwp->x_cursor = 1; cwp->left = 0; cwp->right = 0; cwp->nl_routine = 0; cwp->nl_countdown = 0; cwp->style = 0; cwp->colour = (h_default_background << 8) | h_default_foreground; cwp->font = TEXT_FONT; cwp->font_size = (font_height << 8) | font_width; cwp->attribute = 8; cwp->true_fore = hx_fore_colour; cwp->true_back = hx_back_colour; } /* Prepare lower/upper windows and status line */ wp[0].attribute = 15; wp[0].left = option_left_margin; wp[0].right = option_right_margin; wp[0].x_size = h_screen_width; wp[1].x_size = h_screen_width; if (h_version <= V3) wp[7].x_size = h_screen_width; os_restart_game (RESTART_WPROP_SET); /* Clear the screen, unsplit it and select window 0 */ erase_screen ((zword) (-1)); }/* restart_screen */
/* * screen_word * * Display a string of characters on the screen. If the word doesn't fit * then use wrapping or clipping depending on the current setting of the * enable_wrapping flag. * */ void screen_word (const zchar *s) { int width; if (discarding) return; if (*s == ZC_INDENT && cwp->x_cursor != cwp->left + 1) screen_char (*s++); if (units_left () < (width = os_string_width (s))) { if (!enable_wrapping) { zchar c; while ((c = *s++) != 0) if (c == ZC_NEW_FONT || c == ZC_NEW_STYLE) { int arg = (int) *s++; if (c == ZC_NEW_FONT) os_set_font (arg); if (c == ZC_NEW_STYLE) os_set_text_style (arg); } else screen_char (c); return; } if (*s == ' ' || *s == ZC_INDENT || *s == ZC_GAP) width = os_string_width (++s); #ifdef AMIGA if (cwin == 0) Justifiable (); #endif screen_new_line (); } os_display_string (s); cwp->x_cursor += width; }/* screen_word */
void os_display_string (const zchar *s) { zchar c; while ((c = (unsigned char) *s++) != 0) if (c == ZC_NEW_FONT || c == ZC_NEW_STYLE) { int arg = (unsigned char) *s++; if (c == ZC_NEW_FONT) os_set_font (arg); if (c == ZC_NEW_STYLE) os_set_text_style (arg); } else os_display_char (c); }/* os_display_string */
void os_display_string (const zchar *s) { zchar c; while ((c = (unsigned char) *s++) != 0) /* Is this superfluous given it's also done in screen_word()? */ if (c == ZC_NEW_FONT || c == ZC_NEW_STYLE) { int arg = (unsigned char) *s++; if (c == ZC_NEW_FONT) os_set_font (arg); if (c == ZC_NEW_STYLE) os_set_text_style (arg); } else os_display_char (c); }/* os_display_string */
void z_set_font (void) { zword font = zargs[0]; zword win = 0; if (h_version == V6) { if (zargc < 2 || (short) zargs[1] == -3) win = cwin; else if (zargs[1] >= 8) runtime_error (ERR_ILL_WIN); else win = zargs[1]; } if (font != 0) { if (os_font_data (font, &font_height, &font_width)) { store (wp[win].font); wp[win].font = font; wp[win].font_size = (font_height << 8) | font_width; if ((h_version != V6) || (win == cwin)) { if (!ostream_memory && ostream_screen && enable_buffering) { print_char (ZC_NEW_FONT); print_char (font); } else os_set_font (font); } } else store (0); } else store (wp[win].font); }/* z_set_font */