]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fonts where boldface is wider than usual are now beaten up so they fit.
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 30 Mar 1999 19:44:52 +0000 (19:44 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 30 Mar 1999 19:44:52 +0000 (19:44 +0000)
Note that this doesn't happen for non-COlor QuickDraw yet, due to the lack of
CharExtra().

[originally from svn r141]

macterm.c
putty.h

index afc60aa9c71e16a49045fb65ba39a94d57a5895c..84d88969235be27be2f9d5e902ffa12208629931 100644 (file)
--- a/macterm.c
+++ b/macterm.c
@@ -1,4 +1,4 @@
-/* $Id: macterm.c,v 1.1.2.32 1999/03/29 19:50:23 ben Exp $ */
+/* $Id: macterm.c,v 1.1.2.33 1999/03/30 19:44:51 ben Exp $ */
 /*
  * Copyright (c) 1999 Simon Tatham
  * Copyright (c) 1999 Ben Harris
@@ -180,6 +180,11 @@ static void mac_initfont(Session *s) {
     s->font_ascent = fi.ascent;
     s->font_leading = fi.leading;
     s->font_height = s->font_ascent + fi.descent + s->font_leading;
+    if (!s->cfg.bold_colour) {
+       TextFace(bold);
+       s->font_boldadjust = s->font_width - CharWidth('W');
+    } else
+       s->font_boldadjust = 0;
     mac_adjustsize(s, s->rows, s->cols);
 }
 
@@ -765,9 +770,20 @@ void do_text(Session *s, int x, int y, char *text, int len,
     TextFace(style);
     TextSize(s->cfg.fontheight);
     SetFractEnable(FALSE); /* We want characters on pixel boundaries */
+    if (mac_gestalts.qdvers > gestaltOriginalQD)
+       if (style & bold) {
+           SpaceExtra(s->font_boldadjust << 16);
+           CharExtra(s->font_boldadjust << 16);
+       } else {
+           SpaceExtra(0);
+           CharExtra(0);
+       }
     textrgn = NewRgn();
     RectRgn(textrgn, &a.textrect);
-    DeviceLoop(textrgn, &do_text_for_device_upp, (long)&a, 0);
+    if (mac_gestalts.qdvers == gestaltOriginalQD)
+       do_text_for_device(1, 0, NULL, (long)&a);
+    else
+       DeviceLoop(textrgn, &do_text_for_device_upp, (long)&a, 0);
     DisposeRgn(textrgn);
     /* Tell the window manager about it in case this isn't an update */
     ValidRect(&a.textrect);
diff --git a/putty.h b/putty.h
index 4c78be66f12e74feec76f1b3d7c0bc675f5737f5..87f05d2f2a02e98334ae29a9414cd28d3175157e 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -13,7 +13,6 @@
 #include <Controls.h>
 #include <Windows.h>
 typedef UInt32 DWORD;
-struct mac_session;
 #endif /* macintosh */
 
 #ifndef TRUE
@@ -48,13 +47,6 @@ struct mac_session;
 #define ATTR_MASK    0xFFFFFF00UL
 #define CHAR_MASK    0x000000FFUL
 
-#ifdef macintosh
-struct mac_session;
-typedef struct mac_session *Context;
-#else /* not macintosh */
-typedef HDC Context;
-#endif /* not macintosh */
-
 #ifdef macintosh
 #define SEL_NL { 13 }
 #else
@@ -252,6 +244,7 @@ typedef struct Session {
     short              fontnum;
     int                        font_ascent;
     int                        font_leading;
+    int                        font_boldadjust;
     WindowPtr          window;
     PaletteHandle      palette;
     ControlHandle      scrollbar;