fix qd font clobbering on system 7

This commit is contained in:
cy384 2020-07-23 20:47:02 -04:00
parent 292e571a63
commit 285067139d
1 changed files with 19 additions and 0 deletions

View File

@ -10,6 +10,11 @@
void draw_char(int x, int y, Rect* r, char c) void draw_char(int x, int y, Rect* r, char c)
{ {
// don't clobber font settings
short save_font = qd.thePort->txFont;
short save_font_size = qd.thePort->txSize;
short save_font_face = qd.thePort->txFace;
TextFont(kFontIDMonaco); TextFont(kFontIDMonaco);
TextSize(9); TextSize(9);
TextFace(normal); TextFace(normal);
@ -19,6 +24,10 @@ void draw_char(int x, int y, Rect* r, char c)
MoveTo(r->left + x * cell_width + 2, r->top + ((y+1) * cell_height) - 2); MoveTo(r->left + x * cell_width + 2, r->top + ((y+1) * cell_height) - 2);
DrawChar(c); DrawChar(c);
TextFont(save_font);
TextSize(save_font_size);
TextFace(save_font_face);
} }
void draw_screen(Rect* r) void draw_screen(Rect* r)
@ -156,6 +165,11 @@ void set_window_title(WindowPtr w, const char* c_name)
void console_setup(void) void console_setup(void)
{ {
// don't clobber font settings
short save_font = qd.thePort->txFont;
short save_font_size = qd.thePort->txSize;
short save_font_face = qd.thePort->txFace;
TextFont(kFontIDMonaco); TextFont(kFontIDMonaco);
TextSize(9); TextSize(9);
TextFace(normal); TextFace(normal);
@ -163,6 +177,10 @@ void console_setup(void)
int cell_height = 12; int cell_height = 12;
int cell_width = CharWidth('M'); int cell_width = CharWidth('M');
TextFont(save_font);
TextSize(save_font_size);
TextFace(save_font_face);
Rect initial_window_bounds = qd.screenBits.bounds; Rect initial_window_bounds = qd.screenBits.bounds;
InsetRect(&initial_window_bounds, 20, 20); InsetRect(&initial_window_bounds, 20, 20);
initial_window_bounds.top += 40; initial_window_bounds.top += 40;
@ -193,5 +211,6 @@ void console_setup(void)
con.cursor_x = 0; con.cursor_x = 0;
con.cursor_y = 0; con.cursor_y = 0;
} }