summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-04-03 22:08:05 +0200
committerBram Moolenaar <Bram@vim.org>2016-04-03 22:08:05 +0200
commit7c1c6dbb6817640fd3956a0d5417da23fde336d8 (patch)
tree91ff75d4e867032fb58473b55021964b751cbadb /src
parent3dda7db4e1f7c4a8110a1f83001ec36b46693d27 (diff)
downloadvim-7c1c6dbb6817640fd3956a0d5417da23fde336d8.zip
patch 7.4.1705
Problem: The 'guifont' option does not allow for a quality setting. Solution: Add the "q" item, supported on MS-Windows. (Yasuhiro Matsumoto)
Diffstat (limited to 'src')
-rw-r--r--src/gui_w32.c8
-rw-r--r--src/os_mswin.c62
-rw-r--r--src/proto/os_mswin.pro1
-rw-r--r--src/version.c2
4 files changed, 73 insertions, 0 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 0679ed222..543d5d5a1 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -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
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 607fd6a51..77582cc47 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -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)
{
diff --git a/src/proto/os_mswin.pro b/src/proto/os_mswin.pro
index 333ba76c5..fb2da9371 100644
--- a/src/proto/os_mswin.pro
+++ b/src/proto/os_mswin.pro
@@ -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 : */
diff --git a/src/version.c b/src/version.c
index 58377a49e..aefcfae15 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1705,
+/**/
1704,
/**/
1703,