From bd0d7da24182cbe6a67271de1c2cf45f7f4b38b3 Mon Sep 17 00:00:00 2001 From: Cyd Date: Wed, 28 Nov 2018 10:34:32 +0100 Subject: [PATCH] Tagging the 0.70.0.7 release of the kitty project. --- 0.70_My_PuTTY/putty.h | 1 + 0.70_My_PuTTY/terminal.c | 12 +++ 0.70_My_PuTTY/windows/version.txt | 2 +- 0.70_My_PuTTY/windows/version_minor.txt | 2 +- 0.70_My_PuTTY/windows/window.c | 117 ++++++++++++++++++++++-- 5 files changed, 126 insertions(+), 8 deletions(-) diff --git a/0.70_My_PuTTY/putty.h b/0.70_My_PuTTY/putty.h index 04cb1cc..0aadd54 100644 --- a/0.70_My_PuTTY/putty.h +++ b/0.70_My_PuTTY/putty.h @@ -28,6 +28,7 @@ typedef struct terminal_tag Terminal; #include "misc.h" #ifdef PERSOPORT +#define ATTR_ITALIC 0x1000000U #include void debug_log( const char *fmt, ...) ; int switch_private_key_flag( void ) ; diff --git a/0.70_My_PuTTY/terminal.c b/0.70_My_PuTTY/terminal.c index b1fb84c..a6849bd 100644 --- a/0.70_My_PuTTY/terminal.c +++ b/0.70_My_PuTTY/terminal.c @@ -4030,6 +4030,12 @@ static void term_out(Terminal *term) compatibility(VT100AVO); term->curr_attr |= ATTR_BOLD; break; +#ifdef PERSOPORT + case 3: /* enable italics */ + compatibility(ANSI); + term->curr_attr |= ATTR_ITALIC; + break; +#endif case 21: /* (enable double underline) */ compatibility(OTHER); case 4: /* enable underline */ @@ -4065,6 +4071,12 @@ static void term_out(Terminal *term) compatibility2(OTHER, VT220); term->curr_attr &= ~ATTR_BOLD; break; +#ifdef PERSPORT + case 23: /* disable italics */ + compatibility(ANSI); + term->curr_attr &= ~ATTR_ITALIC; + break; +#endif case 24: /* disable underline */ compatibility2(OTHER, VT220); term->curr_attr &= ~ATTR_UNDER; diff --git a/0.70_My_PuTTY/windows/version.txt b/0.70_My_PuTTY/windows/version.txt index 5c6a832..a78961e 100644 --- a/0.70_My_PuTTY/windows/version.txt +++ b/0.70_My_PuTTY/windows/version.txt @@ -1 +1 @@ -0.70.0.6 \ No newline at end of file +0.70.0.7 \ No newline at end of file diff --git a/0.70_My_PuTTY/windows/version_minor.txt b/0.70_My_PuTTY/windows/version_minor.txt index 1e8b314..7f8f011 100644 --- a/0.70_My_PuTTY/windows/version_minor.txt +++ b/0.70_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -6 +7 diff --git a/0.70_My_PuTTY/windows/window.c b/0.70_My_PuTTY/windows/window.c index 56ed51a..1b358e9 100644 --- a/0.70_My_PuTTY/windows/window.c +++ b/0.70_My_PuTTY/windows/window.c @@ -172,6 +172,22 @@ struct agent_callback { #define FONT_BOLD 1 #define FONT_UNDERLINE 2 #define FONT_BOLDUND 3 + +#ifdef PERSOPORT +#define FONT_ITALIC 4 +#define FONT_WIDE 0x08 +#define FONT_HIGH 0x10 +#define FONT_NARROW 0x20 + +#define FONT_OEM 0x40 +#define FONT_OEMBOLD 0x41 +#define FONT_OEMUND 0x42 +#define FONT_OEMBOLDUND 0x43 + +#define FONT_MAXNO 0x4F +#define FONT_SHIFT 6 +static int use_italics; +#else #define FONT_WIDE 0x04 #define FONT_HIGH 0x08 #define FONT_NARROW 0x10 @@ -183,6 +199,8 @@ struct agent_callback { #define FONT_MAXNO 0x40 #define FONT_SHIFT 5 +#endif + static HFONT fonts[FONT_MAXNO]; static LOGFONT lfont; static int fontflag[FONT_MAXNO]; @@ -729,9 +747,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) i++ ; int j = 2, r,g,b ; sscanf( argv[i], "%d:%d:%d", &r, &g, &b ) ; - if( r<0 ) r=0 ; if( r>255 ) r=255; - if( g<0 ) g=0 ; if( g>255 ) g=255; - if( b<0 ) b=0 ; if( b>255 ) b=255; + if( r<0 ) { r=0 ; } if( r>255 ) { r=255; } + if( g<0 ) { g=0 ; } if( g>255 ) { g=255; } + if( b<0 ) { b=0 ; } if( b>255 ) { b=255; } conf_set_int_int(conf, CONF_colours, j*3+0, r); conf_set_int_int(conf, CONF_colours, j*3+1, g); conf_set_int_int(conf, CONF_colours, j*3+2, b); @@ -2410,6 +2428,15 @@ static void init_fonts(int pick_width, int pick_height) font_width = pick_width; quality = conf_get_int(conf, CONF_font_quality); +#ifdef PERSOPORT +#define f(i,c,w,u,t) \ + fonts[i] = CreateFont (font_height, font_width, 0, 0, w, t, u, FALSE, \ + c, OUT_DEFAULT_PRECIS, \ + CLIP_DEFAULT_PRECIS, FONT_QUALITY(quality), \ + FIXED_PITCH | FF_DONTCARE, font->name) + + f(FONT_NORMAL, font->charset, fw_dontcare, FALSE, FALSE); +#else #define f(i,c,w,u) \ fonts[i] = CreateFont (font_height, font_width, 0, 0, w, FALSE, u, FALSE, \ c, OUT_DEFAULT_PRECIS, \ @@ -2417,7 +2444,7 @@ static void init_fonts(int pick_width, int pick_height) FIXED_PITCH | FF_DONTCARE, font->name) f(FONT_NORMAL, font->charset, fw_dontcare, FALSE); - +#endif SelectObject(hdc, fonts[FONT_NORMAL]); GetTextMetrics(hdc, &tm); @@ -2460,7 +2487,61 @@ static void init_fonts(int pick_width, int pick_height) ucsdata.dbcs_screenfont = (cpinfo.MaxCharSize > 1); } +#ifdef PERSOPORT + /* Check whether italic face is acceptable... */ + f(FONT_ITALIC, font->charset, fw_dontcare, FALSE, TRUE); + + { + LPOUTLINETEXTMETRICA regularOtm, italicOtm; + + use_italics = 0; + + i = GetOutlineTextMetricsA(hdc, 0, NULL); + if (i > 0) { + regularOtm = (LPOUTLINETEXTMETRICA)safemalloc(1, i); + regularOtm->otmSize = sizeof(OUTLINETEXTMETRICA); + if (GetOutlineTextMetricsA(hdc, i, regularOtm)) { + /* Now get the italic version */ + SelectObject(hdc, fonts[FONT_ITALIC]); + i = GetOutlineTextMetricsA(hdc, 0, NULL); + if (i > 0) { + italicOtm = (LPOUTLINETEXTMETRICA)safemalloc(1, i); + italicOtm->otmSize = sizeof(OUTLINETEXTMETRICA); + if (GetOutlineTextMetricsA(hdc, i, italicOtm)) { + /* Compare... */ + char *regStyle = (char*)regularOtm + (int)regularOtm->otmpStyleName; + char *itaStyle = (char*)italicOtm + (int)italicOtm->otmpStyleName; + + /* Weed out "italic" fonts that... + - Do not specify an italic slant (probably just the regular font) + - Have the same style as the regular font. Then it *is* just the regular + font with a linear transformation. + - Report the style name of "Oblique". + + My experience is these a) don't look very good b) tend to overhang the + next character and get cut off during paints... which doesn't look very good. */ + if (strcmp(regStyle, itaStyle) && stricmp(itaStyle, "Oblique") && italicOtm->otmItalicAngle != 0) { + use_italics = 1; + } + } + + safefree(italicOtm); + } + } + + safefree(regularOtm); + } + + if (!use_italics) { + DeleteObject(fonts[FONT_ITALIC]); + fonts[FONT_ITALIC] = NULL; + } + } + + f(FONT_UNDERLINE, font->charset, fw_dontcare, TRUE, FALSE); +#else f(FONT_UNDERLINE, font->charset, fw_dontcare, TRUE); +#endif /* * Some fonts, e.g. 9-pt Courier, draw their underlines @@ -2511,7 +2592,11 @@ static void init_fonts(int pick_width, int pick_height) } if (bold_font_mode == BOLD_FONT) { +#ifdef PERSOPORT + f(FONT_BOLD, font->charset, fw_bold, FALSE, FALSE); +#else f(FONT_BOLD, font->charset, fw_bold, FALSE); +#endif } #undef f @@ -2552,7 +2637,11 @@ static void another_font(int fontno) { int basefont; int fw_dontcare, fw_bold, quality; +#ifdef PERSOPORT + int c, u, w, x, t; +#else int c, u, w, x; +#endif char *s; FontSpec *font; @@ -2578,6 +2667,9 @@ static void another_font(int fontno) u = FALSE; s = font->name; x = font_width; +#ifdef PERSOPORT + t = FALSE; +#endif if (fontno & FONT_WIDE) x *= 2; @@ -2589,12 +2681,20 @@ static void another_font(int fontno) w = fw_bold; if (fontno & FONT_UNDERLINE) u = TRUE; +#ifdef PERSOPORT + if (fontno & FONT_ITALIC && use_italics) + t = TRUE; +#endif quality = conf_get_int(conf, CONF_font_quality); fonts[fontno] = CreateFont(font_height * (1 + !!(fontno & FONT_HIGH)), x, 0, 0, w, +#ifdef PERSOPORT + t, u, FALSE, c, OUT_DEFAULT_PRECIS, +#else FALSE, u, FALSE, c, OUT_DEFAULT_PRECIS, +#endif CLIP_DEFAULT_PRECIS, FONT_QUALITY(quality), DEFAULT_PITCH | FF_DONTCARE, s); @@ -3946,7 +4046,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation case IDM_RESIZE: //Redmensionner { int w = LOWORD( lParam ), h = HIWORD( lParam ) ; - if (w < 1) w = 1 ; if (h < 1) h = 1 ; + if (w < 1) { w = 1 ; } if (h < 1) { h = 1 ; } conf_set_int( conf, CONF_width, w ) ; // cfg.width = w ; conf_set_int( conf, CONF_height, h ) ; // cfg.height = h ; term_size( term, h, w, conf_get_int( conf, CONF_savelines) /*cfg.savelines*/ ) ; @@ -3956,7 +4056,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation case IDM_REPOS: //Redmensionner { int x = LOWORD( lParam ), y = HIWORD( lParam ) ; - if (x < 1) x = 1 ; if (y < 1) y = 1 ; + if (x < 1) { x = 1 ; } if (y < 1) { y = 1 ; } conf_set_int( conf, CONF_xpos, x ) ; // cfg.xpos = x ; conf_set_int( conf, CONF_ypos, y ) ; // cfg.ypos = y ; SetWindowPos( hwnd, 0, x, y, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE ) ; @@ -5504,8 +5604,13 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len, nbg = ((attr & ATTR_BGMASK) >> ATTR_BGSHIFT); if (bold_font_mode == BOLD_FONT && (attr & ATTR_BOLD)) nfont |= FONT_BOLD; +#ifdef PERSOPORT + if (attr & ATTR_ITALIC) + nfont |= FONT_ITALIC; +#endif if (und_mode == UND_FONT && (attr & ATTR_UNDER)) nfont |= FONT_UNDERLINE; + another_font(nfont); if (!fonts[nfont]) { if (nfont & FONT_UNDERLINE)