Skip to content

Commit 7c1c6db

Browse files
committed
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)
1 parent 3dda7db commit 7c1c6db

File tree

5 files changed

+80
-3
lines changed

5 files changed

+80
-3
lines changed

runtime/doc/options.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 7.4. Last change: 2016 Mar 24
1+
*options.txt* For Vim version 7.4. Last change: 2016 Apr 03
22

33

44
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|.
10701070

10711071
Note that environment variables are not expanded. If you want to use
10721072
$HOME you must expand it explicitly, e.g.: >
1073-
:let backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
1073+
:let &backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
10741074
10751075
< Note that the default also makes sure that "crontab -e" works (when a
10761076
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|.
12451245
break if 'linebreak' is on. Only works for ASCII and also for 8-bit
12461246
characters when 'encoding' is an 8-bit encoding.
12471247

1248-
*'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
1248+
*'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
12491249
'breakindent' 'bri' boolean (default off)
12501250
local to window
12511251
{not in Vi}
@@ -3634,6 +3634,10 @@ A jump table for the options with a short description can be found at |Q_op|.
36343634
HANGEUL, HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS,
36353635
SYMBOL, THAI, TURKISH, VIETNAMESE ANSI and BALTIC.
36363636
Normally you would use "cDEFAULT".
3637+
qXX - quality XX. Valid charsets are: PROOF, DRAFT,
3638+
ANTIALIASED, UNANTIALIASED, CLEARTYPE, DEFAULT.
3639+
Normally you would use "qDEFAULT".
3640+
Some quality values isn't supported in legacy OSs.
36373641

36383642
Use a ':' to separate the options.
36393643
- A '_' can be used in the place of a space, so you don't need to use

src/gui_w32.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,6 +3291,7 @@ logfont2name(LOGFONT lf)
32913291
char *p;
32923292
char *res;
32933293
char *charset_name;
3294+
char *quality_name;
32943295
char *font_name = lf.lfFaceName;
32953296

32963297
charset_name = charset_id2name((int)lf.lfCharSet);
@@ -3304,6 +3305,8 @@ logfont2name(LOGFONT lf)
33043305
(char_u **)&font_name, &len);
33053306
}
33063307
#endif
3308+
quality_name = quality_id2name((int)lf.lfQuality);
3309+
33073310
res = (char *)alloc((unsigned)(strlen(font_name) + 20
33083311
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
33093312
if (res != NULL)
@@ -3331,6 +3334,11 @@ logfont2name(LOGFONT lf)
33313334
STRCAT(p, ":c");
33323335
STRCAT(p, charset_name);
33333336
}
3337+
if (quality_name != NULL)
3338+
{
3339+
STRCAT(p, ":q");
3340+
STRCAT(p, quality_name);
3341+
}
33343342
}
33353343

33363344
#ifdef FEAT_MBYTE

src/os_mswin.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,6 +2689,33 @@ charset_pairs[] =
26892689
{NULL, 0}
26902690
};
26912691

2692+
struct quality_pair
2693+
{
2694+
char *name;
2695+
DWORD quality;
2696+
};
2697+
2698+
static struct quality_pair
2699+
quality_pairs[] = {
2700+
#ifdef CLEARTYPE_QUALITY
2701+
{"CLEARTYPE", CLEARTYPE_QUALITY},
2702+
#endif
2703+
#ifdef ANTIALIASED_QUALITY
2704+
{"ANTIALIASED", ANTIALIASED_QUALITY},
2705+
#endif
2706+
#ifdef NOANTIALIASED_QUALITY
2707+
{"NOANTIALIASED", NOANTIALIASED_QUALITY},
2708+
#endif
2709+
#ifdef PROOF_QUALITY
2710+
{"PROOF", PROOF_QUALITY},
2711+
#endif
2712+
#ifdef PROOF_QUALITY
2713+
{"DRAFT", DRAFT_QUALITY},
2714+
#endif
2715+
{"DEFAULT", DEFAULT_QUALITY},
2716+
{NULL, 0}
2717+
};
2718+
26922719
/*
26932720
* Convert a charset ID to a name.
26942721
* Return NULL when not recognized.
@@ -2704,6 +2731,21 @@ charset_id2name(int id)
27042731
return cp->name;
27052732
}
27062733

2734+
/*
2735+
* Convert a quality ID to a name.
2736+
* Return NULL when not recognized.
2737+
*/
2738+
char *
2739+
quality_id2name(DWORD id)
2740+
{
2741+
struct quality_pair *qp;
2742+
2743+
for (qp = quality_pairs; qp->name != NULL; ++qp)
2744+
if (id == qp->quality)
2745+
break;
2746+
return qp->name;
2747+
}
2748+
27072749
static const LOGFONT s_lfDefault =
27082750
{
27092751
-12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
@@ -2985,6 +3027,26 @@ get_logfont(
29853027
}
29863028
break;
29873029
}
3030+
case 'q':
3031+
{
3032+
struct quality_pair *qp;
3033+
3034+
for (qp = quality_pairs; qp->name != NULL; ++qp)
3035+
if (STRNCMP(p, qp->name, strlen(qp->name)) == 0)
3036+
{
3037+
lf->lfQuality = qp->quality;
3038+
p += strlen(qp->name);
3039+
break;
3040+
}
3041+
if (qp->name == NULL && verbose)
3042+
{
3043+
vim_snprintf((char *)IObuff, IOSIZE,
3044+
_("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name);
3045+
EMSG(IObuff);
3046+
break;
3047+
}
3048+
break;
3049+
}
29883050
default:
29893051
if (verbose)
29903052
{

src/proto/os_mswin.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void serverForeground(char_u *name);
4949
char_u *serverGetReply(HWND server, int *expr_res, int remove, int wait);
5050
void serverProcessPendingMessages(void);
5151
char *charset_id2name(int id);
52+
char *quality_id2name __ARGS((DWORD id));
5253
int get_logfont(LOGFONT *lf, char_u *name, HDC printer_dc, int verbose);
5354
void channel_init_winsock(void);
5455
/* vim: set ft=c : */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1705,
751753
/**/
752754
1704,
753755
/**/

0 commit comments

Comments
 (0)