[Ttssh2-commit] [3395] フォントスケーリングに暫定対応

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 5月 12日 (火) 23:57:28 JST


Revision: 3395
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3395
Author:   doda
Date:     2009-05-12 23:57:28 +0900 (Tue, 12 May 2009)

Log Message:
-----------
フォントスケーリングに暫定対応

Modified Paths:
--------------
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpset/ttset.c


-------------- next part --------------
Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2009-05-12 14:51:04 UTC (rev 3394)
+++ trunk/teraterm/common/tttypes.h	2009-05-12 14:57:28 UTC (rev 3395)
@@ -454,6 +454,7 @@
 	WORD ClearScreenOnCloseConnection;
 	WORD DisableAcceleratorDuplicateSession;
 	int PasteDelayPerLine;
+	WORD FontScaling;
 };
 
 typedef struct tttset TTTSet, *PTTSet;

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2009-05-12 14:51:04 UTC (rev 3394)
+++ trunk/teraterm/teraterm/vtwin.cpp	2009-05-12 14:57:28 UTC (rev 3395)
@@ -2469,8 +2469,43 @@
 		ResizeWindow(R.left,R.top,w,h,cx,cy);
 	}
 	else {
-		w = cx / FontWidth;
-		h = cy / FontHeight;
+		if (ts.FontScaling) {
+			int NewFontWidth, NewFontHeight;
+			BOOL FontChanged = FALSE;
+
+			NewFontWidth = cx / ts.TerminalWidth;
+			NewFontHeight = cy / ts.TerminalHeight;
+
+			if (NewFontWidth - ts.FontDW < 3) {
+				NewFontWidth = ts.FontDW + 3;
+			}
+			if (NewFontWidth != FontWidth) {
+				ts.VTFontSize.x = ts.FontDW - NewFontWidth;
+				FontWidth = NewFontWidth;
+				FontChanged = TRUE;
+			}
+
+			if (NewFontHeight - ts.FontDH < 3) {
+				NewFontHeight = ts.FontDH + 3;
+			}
+			if (NewFontHeight != FontHeight) {
+				ts.VTFontSize.y = ts.FontDH - NewFontHeight;
+				FontHeight = NewFontHeight;
+				FontChanged = TRUE;
+			}
+
+			w = ts.TerminalWidth;
+			h = ts.TerminalHeight;
+
+			if (FontChanged) {
+				ChangeFont();
+			}
+		}
+		else {
+			w = cx / FontWidth;
+			h = cy / FontHeight;
+		}
+
 		HideStatusLine();
 		BuffChangeWinSize(w,h);
 	}

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2009-05-12 14:51:04 UTC (rev 3394)
+++ trunk/teraterm/ttpset/ttset.c	2009-05-12 14:57:28 UTC (rev 3395)
@@ -1272,6 +1272,9 @@
 		int tmp = min(max(0, ts->PasteDelayPerLine), 5000);
 		ts->PasteDelayPerLine = tmp;
 	}
+
+	// Font scaling -- test
+	ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE);
 }
 
 void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)



Ttssh2-commit メーリングリストの案内
Back to archive index