To: vim_dev@googlegroups.com Subject: Patch 7.4.1705 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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) Files: runtime/doc/options.txt, src/gui_w32.c, src/os_mswin.c, src/proto/os_mswin.pro *** ../vim-7.4.1704/runtime/doc/options.txt 2016-03-19 18:21:30.322003282 +0100 --- runtime/doc/options.txt 2016-04-03 21:58:26.244168430 +0200 *************** *** 3627,3632 **** --- 3634,3643 ---- 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 *** ../vim-7.4.1704/src/gui_w32.c 2016-04-02 15:59:37.019059251 +0200 --- src/gui_w32.c 2016-04-03 22:02:47.445475299 +0200 *************** *** 3291,3296 **** --- 3291,3297 ---- char *p; char *res; char *charset_name; + char *quality_name; char *font_name = lf.lfFaceName; charset_name = charset_id2name((int)lf.lfCharSet); *************** *** 3304,3309 **** --- 3305,3312 ---- (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,3336 **** --- 3334,3344 ---- STRCAT(p, ":c"); STRCAT(p, charset_name); } + if (quality_name != NULL) + { + STRCAT(p, ":q"); + STRCAT(p, quality_name); + } } #ifdef FEAT_MBYTE *** ../vim-7.4.1704/src/os_mswin.c 2016-03-12 22:11:34.239300280 +0100 --- src/os_mswin.c 2016-04-03 21:59:04.743771420 +0200 *************** *** 2689,2694 **** --- 2689,2721 ---- {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,2709 **** --- 2731,2751 ---- 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, *************** *** 2983,2988 **** --- 3025,3050 ---- EMSG(IObuff); break; } + 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: *** ../vim-7.4.1704/src/proto/os_mswin.pro 2016-01-29 21:11:20.967061365 +0100 --- src/proto/os_mswin.pro 2016-04-03 22:06:36.239117027 +0200 *************** *** 49,54 **** --- 49,55 ---- 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 : */ *** ../vim-7.4.1704/src/version.c 2016-04-03 21:22:53.246228473 +0200 --- src/version.c 2016-04-03 22:04:19.440526990 +0200 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1705, /**/ -- hundred-and-one symptoms of being an internet addict: 213. Your kids start referring to you as "that guy in front of the monitor." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///