summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-04-28 14:02:47 +0200
committerBram Moolenaar <Bram@vim.org>2019-04-28 14:02:47 +0200
commitf720d0a77e393990b2171a77210565bdc82064f2 (patch)
tree06c64d67d8893900e2244a53c09722d697f6a466 /src
parent564344ace9ef06b22e4e60a0196c41b410ac27da (diff)
patch 8.1.1224: MS-Windows: cannot specify font weightv8.1.1224
Problem: MS-Windows: cannot specify font weight. Solution: Add the "W" option to 'guifont'. (closes #4309) Move GUI font explanation out of options.txt.
Diffstat (limited to 'src')
-rw-r--r--src/gui_w32.c15
-rw-r--r--src/os_mswin.c3
-rw-r--r--src/version.c2
3 files changed, 15 insertions, 5 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c
index dbc8d95a43..aac1398b32 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -3119,6 +3119,7 @@ logfont2name(LOGFONTW lf)
char *charset_name;
char *quality_name;
char *font_name;
+ int points;
font_name = (char *)utf16_to_enc(lf.lfFaceName, NULL);
if (font_name == NULL)
@@ -3126,15 +3127,19 @@ logfont2name(LOGFONTW lf)
charset_name = charset_id2name((int)lf.lfCharSet);
quality_name = quality_id2name((int)lf.lfQuality);
- res = (char *)alloc((unsigned)(strlen(font_name) + 20
+ res = (char *)alloc((unsigned)(strlen(font_name) + 30
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)
+ (quality_name == NULL ? 0 : strlen(quality_name) + 2)));
if (res != NULL)
{
p = res;
- /* make a normal font string out of the lf thing:*/
- sprintf((char *)p, "%s:h%d", font_name, pixels_to_points(
- lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
+ // make a normal font string out of the lf thing:
+ points = pixels_to_points(
+ lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE);
+ if (lf.lfWeight == FW_NORMAL || lf.lfWeight == FW_BOLD)
+ sprintf((char *)p, "%s:h%d", font_name, points);
+ else
+ sprintf((char *)p, "%s:h%d:W%d", font_name, points, lf.lfWeight);
while (*p)
{
if (*p == ' ')
@@ -3143,7 +3148,7 @@ logfont2name(LOGFONTW lf)
}
if (lf.lfItalic)
STRCAT(p, ":i");
- if (lf.lfWeight >= FW_BOLD)
+ if (lf.lfWeight == FW_BOLD)
STRCAT(p, ":b");
if (lf.lfUnderline)
STRCAT(p, ":u");
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 48be0de52c..503d3d7d7b 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -2992,6 +2992,9 @@ get_logfont(
case L'w':
lf->lfWidth = points_to_pixels(p, &p, FALSE, (long_i)printer_dc);
break;
+ case L'W':
+ lf->lfWeight = wcstol(p, &p, 10);
+ break;
case L'b':
lf->lfWeight = FW_BOLD;
break;
diff --git a/src/version.c b/src/version.c
index fdbb9a63bc..ae93dc3a4c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1224,
+/**/
1223,
/**/
1222,