notepad patch for chinese users

mengzhuo li muziwind at yahoo.com.cn
Fri Dec 16 00:21:13 CST 2005


Skipped content of type multipart/alternative-------------- next part --------------
diff -uNr notepad-back/dialog.c notepad-later/dialog.c
--- notepad-back/dialog.c	2005-12-15 13:17:29.000000000 +0800
+++ notepad-later/dialog.c	2005-12-16 12:31:40.894797808 +0800
@@ -379,11 +379,11 @@
     int cWidthPels, cHeightPels, border;
     int xLeft, yTop, pagecount, dopage, copycount;
     unsigned int i;
-    LOGFONT hdrFont;
-    HFONT font, old_font=0;
+    LOGFONT hdrFont,hdrFont2; 
+    HFONT font, old_font=0,font2;
     DWORD size;
     LPWSTR pTemp;
-    static const WCHAR times_new_romanW[] = { 'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0 };
+    static const WCHAR times_new_romanW[] = { 's','o','n','g',0 };
 
     /* Get a small font and print some header info on each page */
     hdrFont.lfHeight = 100;
@@ -436,6 +436,10 @@
     /* Get the page dimensions in pixels. */
     cWidthPels = GetDeviceCaps(printer.hDC, HORZRES);
     cHeightPels = GetDeviceCaps(printer.hDC, VERTRES);
+    
+    hdrFont2 = Globals.lfFont;
+    hdrFont2.lfHeight = -MulDiv(Globals.lfFont.lfHeight, GetDeviceCaps(printer.hDC, LOGPIXELSY), 72);
+    font2 = CreateFontIndirect(&hdrFont2);
 
     /* Get the file text */
     size = GetWindowTextLength(Globals.hEdit) + 1;
@@ -454,9 +458,7 @@
         do {
             static const WCHAR letterM[] = { 'M',0 };
 
-            if (pagecount >= printer.nFromPage &&
-    /*          ((printer.Flags & PD_PAGENUMS) == 0 ||  pagecount <= printer.nToPage))*/
-            pagecount <= printer.nToPage)
+	    if ( printer.nFromPage == printer.nToPage || (pagecount >= printer.nFromPage && pagecount <= printer.nToPage))
                 dopage = 1;
             else
                 dopage = 0;
@@ -480,10 +482,10 @@
             }
             
             /* The starting point for the main text */
-            xLeft = border*2;
+	    xLeft = border;
             yTop = border+szMetric.cy*4;
-            
-            SelectObject(printer.hDC, old_font);
+           
+	    SelectObject(printer.hDC, font2); 
             GetTextExtentPoint32(printer.hDC, letterM, 1, &szMetric); 
             
             /* Since outputting strings is giving me problems, output the main
@@ -491,13 +493,20 @@
             */
             do {
                 if (pTemp[i] == '\n') {
-                    xLeft = border*2;
+  		    xLeft = border;
                     yTop += szMetric.cy;
                 }
                 else if (pTemp[i] != '\r') {
                     if (dopage)
                         TextOut(printer.hDC, xLeft, yTop, &pTemp[i], 1);
                     xLeft += szMetric.cx;
+ 		    if (pTemp[i]>128)
+                        xLeft += szMetric.cx;
+  		    if (xLeft+border > cWidthPels)
+                    {
+                        xLeft = border;
+                        yTop += szMetric.cy;
+                    }
                 }
             } while (i++<size && yTop<(cHeightPels-border*2));
             
diff -uNr notepad-back/main.c notepad-later/main.c
--- notepad-back/main.c	2005-12-15 13:17:29.000000000 +0800
+++ notepad-later/main.c	2005-12-16 12:31:40.922793552 +0800
@@ -153,6 +153,11 @@
                              ES_AUTOVSCROLL | ES_MULTILINE,
                              0, 0, rc.right, rc.bottom, hWnd,
                              NULL, Globals.hInstance, NULL);
+	static const WCHAR font_nameW[] = { 's','o','n','g',0 };
+        lstrcpy(Globals.lfFont.lfFaceName, font_nameW);
+        Globals.lfFont.lfHeight = -16;
+        Globals.hFont = CreateFontIndirect(&Globals.lfFont);
+        SendMessage(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, (LPARAM)FALSE);
         break;
     }
 
diff -uNr notepad-back/Zh.rc notepad-later/Zh.rc
--- notepad-back/Zh.rc	2005-12-15 13:17:29.000000000 +0800
+++ notepad-later/Zh.rc	2005-12-16 12:31:40.933791880 +0800
@@ -43,6 +43,7 @@
   MENUITEM "²åÈëÈÕÆÚ¡¢Ê±¼ä£¨&T£©\tF5",    CMD_TIME_DATE
   MENUITEM SEPARATOR
   MENUITEM "×Ô¶¯»»ÐУ¨&W£©",  CMD_WRAP
+  MENUITEM "×ÖÌå...",            CMD_FONT
  }
 POPUP "ËÑË÷£¨&S£©" {
   MENUITEM "ËÑË÷£¨&S£©",           CMD_SEARCH


More information about the wine-patches mailing list