patch 7.4.1705 v7.4.1705
authorBram Moolenaar <Bram@vim.org>
Sun, 3 Apr 2016 20:08:05 +0000 (22:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 3 Apr 2016 20:08:05 +0000 (22:08 +0200)
Problem:    The 'guifont' option does not allow for a quality setting.
Solution:   Add the "q" item, supported on MS-Windows. (Yasuhiro Matsumoto)

runtime/doc/options.txt
src/gui_w32.c
src/os_mswin.c
src/proto/os_mswin.pro
src/version.c

index f71c4ad2dcd426158a8f810ae02a175703a88471..6ddf07673aa5c92e0845eecb2fb7f68a8528f0b1 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 7.4.  Last change: 2016 Mar 24
+*options.txt*  For Vim version 7.4.  Last change: 2016 Apr 03
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1070,7 +1070,7 @@ A jump table for the options with a short description can be found at |Q_op|.
 
        Note that environment variables are not expanded.  If you want to use
        $HOME you must expand it explicitly, e.g.: >
-               :let backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
+               :let &backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
 
 <      Note that the default also makes sure that "crontab -e" works (when a
        backup would be made by renaming the original file crontab won't see
@@ -1245,7 +1245,7 @@ A jump table for the options with a short description can be found at |Q_op|.
        break if 'linebreak' is on.  Only works for ASCII and also for 8-bit
        characters when 'encoding' is an 8-bit encoding.
 
-                               *'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
+                       *'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
 'breakindent' 'bri'    boolean (default off)
                        local to window
                        {not in Vi}
@@ -3634,6 +3634,10 @@ A jump table for the options with a short description can be found at |Q_op|.
                      HANGEUL, HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS,
                      SYMBOL, THAI, TURKISH, VIETNAMESE ANSI and BALTIC.
                      Normally you would use "cDEFAULT".
+               qXX - quality XX.  Valid charsets are: PROOF, DRAFT,
+                     ANTIALIASED, UNANTIALIASED, CLEARTYPE, DEFAULT.
+                     Normally you would use "qDEFAULT".
+                     Some quality values isn't supported in legacy OSs.
 
          Use a ':' to separate the options.
        - A '_' can be used in the place of a space, so you don't need to use
index 0679ed222bcbd0304c0640c0641f614af91ce7b2..543d5d5a12ec40acc41789ae4e941ae3073ec72b 100644 (file)
@@ -3291,6 +3291,7 @@ logfont2name(LOGFONT lf)
     char       *p;
     char       *res;
     char       *charset_name;
+    char       *quality_name;
     char       *font_name = lf.lfFaceName;
 
     charset_name = charset_id2name((int)lf.lfCharSet);
@@ -3304,6 +3305,8 @@ logfont2name(LOGFONT lf)
                                                (char_u **)&font_name, &len);
     }
 #endif
+    quality_name = quality_id2name((int)lf.lfQuality);
+
     res = (char *)alloc((unsigned)(strlen(font_name) + 20
                    + (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
     if (res != NULL)
@@ -3331,6 +3334,11 @@ logfont2name(LOGFONT lf)
            STRCAT(p, ":c");
            STRCAT(p, charset_name);
        }
+       if (quality_name != NULL)
+       {
+           STRCAT(p, ":q");
+           STRCAT(p, quality_name);
+       }
     }
 
 #ifdef FEAT_MBYTE
index 607fd6a51fdc364255dea56c1cf8715ec55342af..77582cc479d524ca73887d877d4c92f12070c435 100644 (file)
@@ -2689,6 +2689,33 @@ charset_pairs[] =
     {NULL,             0}
 };
 
+struct quality_pair
+{
+    char       *name;
+    DWORD      quality;
+};
+
+static struct quality_pair
+quality_pairs[] = {
+#ifdef CLEARTYPE_QUALITY
+    {"CLEARTYPE",      CLEARTYPE_QUALITY},
+#endif
+#ifdef ANTIALIASED_QUALITY
+    {"ANTIALIASED",    ANTIALIASED_QUALITY},
+#endif
+#ifdef NOANTIALIASED_QUALITY
+    {"NOANTIALIASED",  NOANTIALIASED_QUALITY},
+#endif
+#ifdef PROOF_QUALITY
+    {"PROOF",          PROOF_QUALITY},
+#endif
+#ifdef PROOF_QUALITY
+    {"DRAFT",          DRAFT_QUALITY},
+#endif
+    {"DEFAULT",                DEFAULT_QUALITY},
+    {NULL,             0}
+};
+
 /*
  * Convert a charset ID to a name.
  * Return NULL when not recognized.
@@ -2704,6 +2731,21 @@ charset_id2name(int id)
     return cp->name;
 }
 
+/*
+ * Convert a quality ID to a name.
+ * Return NULL when not recognized.
+ */
+    char *
+quality_id2name(DWORD id)
+{
+    struct quality_pair *qp;
+
+    for (qp = quality_pairs; qp->name != NULL; ++qp)
+       if (id == qp->quality)
+           break;
+    return qp->name;
+}
+
 static const LOGFONT s_lfDefault =
 {
     -12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
@@ -2985,6 +3027,26 @@ get_logfont(
                    }
                    break;
                }
+           case 'q':
+               {
+                   struct quality_pair *qp;
+
+                   for (qp = quality_pairs; qp->name != NULL; ++qp)
+                       if (STRNCMP(p, qp->name, strlen(qp->name)) == 0)
+                       {
+                           lf->lfQuality = qp->quality;
+                           p += strlen(qp->name);
+                           break;
+                       }
+                   if (qp->name == NULL && verbose)
+                   {
+                       vim_snprintf((char *)IObuff, IOSIZE,
+                               _("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name);
+                       EMSG(IObuff);
+                       break;
+                   }
+                   break;
+               }
            default:
                if (verbose)
                {
index 333ba76c53e30216677fef32ac5821802c07e04a..fb2da93714f14b44021f9c97ea541bd24c656f8a 100644 (file)
@@ -49,6 +49,7 @@ void serverForeground(char_u *name);
 char_u *serverGetReply(HWND server, int *expr_res, int remove, int wait);
 void serverProcessPendingMessages(void);
 char *charset_id2name(int id);
+char *quality_id2name __ARGS((DWORD id));
 int get_logfont(LOGFONT *lf, char_u *name, HDC printer_dc, int verbose);
 void channel_init_winsock(void);
 /* vim: set ft=c : */
index 58377a49effa0bd58e4e5797bd7840a91de8f6e6..aefcfae1556892572a709114b857f1ed96676a4d 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1705,
 /**/
     1704,
 /**/