|
|
073263 |
To: vim_dev@googlegroups.com
|
|
|
073263 |
Subject: Patch 7.4.202
|
|
|
073263 |
Fcc: outbox
|
|
|
073263 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
073263 |
Mime-Version: 1.0
|
|
|
073263 |
Content-Type: text/plain; charset=UTF-8
|
|
|
073263 |
Content-Transfer-Encoding: 8bit
|
|
|
073263 |
------------
|
|
|
073263 |
|
|
|
073263 |
Patch 7.4.202
|
|
|
073263 |
Problem: MS-Windows: non-ASCII font names don't work.
|
|
|
073263 |
Solution: Convert between the current code page and 'encoding'. (Ken Takata)
|
|
|
073263 |
Files: src/gui_w48.c, src/os_mswin.c, src/proto/winclip.pro,
|
|
|
073263 |
src/winclip.c
|
|
|
073263 |
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.201/src/gui_w48.c 2013-09-22 15:43:34.000000000 +0200
|
|
|
073263 |
--- src/gui_w48.c 2014-03-12 19:18:14.264927370 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 3069,3083 ****
|
|
|
073263 |
char *p;
|
|
|
073263 |
char *res;
|
|
|
073263 |
char *charset_name;
|
|
|
073263 |
|
|
|
073263 |
charset_name = charset_id2name((int)lf.lfCharSet);
|
|
|
073263 |
! res = alloc((unsigned)(strlen(lf.lfFaceName) + 20
|
|
|
073263 |
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
|
|
|
073263 |
if (res != NULL)
|
|
|
073263 |
{
|
|
|
073263 |
p = res;
|
|
|
073263 |
/* make a normal font string out of the lf thing:*/
|
|
|
073263 |
! sprintf((char *)p, "%s:h%d", lf.lfFaceName, pixels_to_points(
|
|
|
073263 |
lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
|
|
|
073263 |
while (*p)
|
|
|
073263 |
{
|
|
|
073263 |
--- 3069,3094 ----
|
|
|
073263 |
char *p;
|
|
|
073263 |
char *res;
|
|
|
073263 |
char *charset_name;
|
|
|
073263 |
+ char *font_name = lf.lfFaceName;
|
|
|
073263 |
|
|
|
073263 |
charset_name = charset_id2name((int)lf.lfCharSet);
|
|
|
073263 |
! #ifdef FEAT_MBYTE
|
|
|
073263 |
! /* Convert a font name from the current codepage to 'encoding'.
|
|
|
073263 |
! * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */
|
|
|
073263 |
! if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
|
|
073263 |
! {
|
|
|
073263 |
! int len;
|
|
|
073263 |
! acp_to_enc(lf.lfFaceName, strlen(lf.lfFaceName),
|
|
|
073263 |
! (char_u **)&font_name, &len;;
|
|
|
073263 |
! }
|
|
|
073263 |
! #endif
|
|
|
073263 |
! res = alloc((unsigned)(strlen(font_name) + 20
|
|
|
073263 |
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
|
|
|
073263 |
if (res != NULL)
|
|
|
073263 |
{
|
|
|
073263 |
p = res;
|
|
|
073263 |
/* make a normal font string out of the lf thing:*/
|
|
|
073263 |
! sprintf((char *)p, "%s:h%d", font_name, pixels_to_points(
|
|
|
073263 |
lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
|
|
|
073263 |
while (*p)
|
|
|
073263 |
{
|
|
|
073263 |
***************
|
|
|
073263 |
*** 3102,3107 ****
|
|
|
073263 |
--- 3113,3122 ----
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
+ #ifdef FEAT_MBYTE
|
|
|
073263 |
+ if (font_name != lf.lfFaceName)
|
|
|
073263 |
+ vim_free(font_name);
|
|
|
073263 |
+ #endif
|
|
|
073263 |
return res;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.201/src/os_mswin.c 2014-02-11 17:05:57.278217857 +0100
|
|
|
073263 |
--- src/os_mswin.c 2014-03-12 19:18:14.264927370 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2867,2878 ****
|
|
|
073263 |
--- 2867,2893 ----
|
|
|
073263 |
{
|
|
|
073263 |
char_u *p;
|
|
|
073263 |
int i;
|
|
|
073263 |
+ int ret = FAIL;
|
|
|
073263 |
static LOGFONT *lastlf = NULL;
|
|
|
073263 |
+ #ifdef FEAT_MBYTE
|
|
|
073263 |
+ char_u *acpname = NULL;
|
|
|
073263 |
+ #endif
|
|
|
073263 |
|
|
|
073263 |
*lf = s_lfDefault;
|
|
|
073263 |
if (name == NULL)
|
|
|
073263 |
return OK;
|
|
|
073263 |
|
|
|
073263 |
+ #ifdef FEAT_MBYTE
|
|
|
073263 |
+ /* Convert 'name' from 'encoding' to the current codepage, because
|
|
|
073263 |
+ * lf->lfFaceName uses the current codepage.
|
|
|
073263 |
+ * TODO: Use Wide APIs instead of ANSI APIs. */
|
|
|
073263 |
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ int len;
|
|
|
073263 |
+ enc_to_acp(name, strlen(name), &acpname, &len;;
|
|
|
073263 |
+ name = acpname;
|
|
|
073263 |
+ }
|
|
|
073263 |
+ #endif
|
|
|
073263 |
if (STRCMP(name, "*") == 0)
|
|
|
073263 |
{
|
|
|
073263 |
#if defined(FEAT_GUI_W32)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2887,2896 ****
|
|
|
073263 |
cf.lpLogFont = lf;
|
|
|
073263 |
cf.nFontType = 0 ; //REGULAR_FONTTYPE;
|
|
|
073263 |
if (ChooseFont(&cf))
|
|
|
073263 |
! goto theend;
|
|
|
073263 |
! #else
|
|
|
073263 |
! return FAIL;
|
|
|
073263 |
#endif
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 2902,2910 ----
|
|
|
073263 |
cf.lpLogFont = lf;
|
|
|
073263 |
cf.nFontType = 0 ; //REGULAR_FONTTYPE;
|
|
|
073263 |
if (ChooseFont(&cf))
|
|
|
073263 |
! ret = OK;
|
|
|
073263 |
#endif
|
|
|
073263 |
+ goto theend;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2899,2905 ****
|
|
|
073263 |
for (p = name; *p && *p != ':'; p++)
|
|
|
073263 |
{
|
|
|
073263 |
if (p - name + 1 > LF_FACESIZE)
|
|
|
073263 |
! return FAIL; /* Name too long */
|
|
|
073263 |
lf->lfFaceName[p - name] = *p;
|
|
|
073263 |
}
|
|
|
073263 |
if (p != name)
|
|
|
073263 |
--- 2913,2919 ----
|
|
|
073263 |
for (p = name; *p && *p != ':'; p++)
|
|
|
073263 |
{
|
|
|
073263 |
if (p - name + 1 > LF_FACESIZE)
|
|
|
073263 |
! goto theend; /* Name too long */
|
|
|
073263 |
lf->lfFaceName[p - name] = *p;
|
|
|
073263 |
}
|
|
|
073263 |
if (p != name)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2927,2933 ****
|
|
|
073263 |
did_replace = TRUE;
|
|
|
073263 |
}
|
|
|
073263 |
if (!did_replace || init_logfont(lf) == FAIL)
|
|
|
073263 |
! return FAIL;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
while (*p == ':')
|
|
|
073263 |
--- 2941,2947 ----
|
|
|
073263 |
did_replace = TRUE;
|
|
|
073263 |
}
|
|
|
073263 |
if (!did_replace || init_logfont(lf) == FAIL)
|
|
|
073263 |
! goto theend;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
while (*p == ':')
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2988,3012 ****
|
|
|
073263 |
p[-1], name);
|
|
|
073263 |
EMSG(IObuff);
|
|
|
073263 |
}
|
|
|
073263 |
! return FAIL;
|
|
|
073263 |
}
|
|
|
073263 |
while (*p == ':')
|
|
|
073263 |
p++;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
- #if defined(FEAT_GUI_W32)
|
|
|
073263 |
theend:
|
|
|
073263 |
- #endif
|
|
|
073263 |
/* ron: init lastlf */
|
|
|
073263 |
! if (printer_dc == NULL)
|
|
|
073263 |
{
|
|
|
073263 |
vim_free(lastlf);
|
|
|
073263 |
lastlf = (LOGFONT *)alloc(sizeof(LOGFONT));
|
|
|
073263 |
if (lastlf != NULL)
|
|
|
073263 |
mch_memmove(lastlf, lf, sizeof(LOGFONT));
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
! return OK;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
#endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */
|
|
|
073263 |
--- 3002,3028 ----
|
|
|
073263 |
p[-1], name);
|
|
|
073263 |
EMSG(IObuff);
|
|
|
073263 |
}
|
|
|
073263 |
! goto theend;
|
|
|
073263 |
}
|
|
|
073263 |
while (*p == ':')
|
|
|
073263 |
p++;
|
|
|
073263 |
}
|
|
|
073263 |
+ ret = OK;
|
|
|
073263 |
|
|
|
073263 |
theend:
|
|
|
073263 |
/* ron: init lastlf */
|
|
|
073263 |
! if (ret == OK && printer_dc == NULL)
|
|
|
073263 |
{
|
|
|
073263 |
vim_free(lastlf);
|
|
|
073263 |
lastlf = (LOGFONT *)alloc(sizeof(LOGFONT));
|
|
|
073263 |
if (lastlf != NULL)
|
|
|
073263 |
mch_memmove(lastlf, lf, sizeof(LOGFONT));
|
|
|
073263 |
}
|
|
|
073263 |
+ #ifdef FEAT_MBYTE
|
|
|
073263 |
+ vim_free(acpname);
|
|
|
073263 |
+ #endif
|
|
|
073263 |
|
|
|
073263 |
! return ret;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
#endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */
|
|
|
073263 |
*** ../vim-7.4.201/src/proto/winclip.pro 2013-08-10 13:37:39.000000000 +0200
|
|
|
073263 |
--- src/proto/winclip.pro 2014-03-12 19:18:14.264927370 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 11,14 ****
|
|
|
073263 |
--- 11,15 ----
|
|
|
073263 |
short_u *enc_to_utf16 __ARGS((char_u *str, int *lenp));
|
|
|
073263 |
char_u *utf16_to_enc __ARGS((short_u *str, int *lenp));
|
|
|
073263 |
void acp_to_enc __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
|
|
|
073263 |
+ void enc_to_acp __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
|
|
|
073263 |
/* vim: set ft=c : */
|
|
|
073263 |
*** ../vim-7.4.201/src/winclip.c 2013-07-01 21:05:53.000000000 +0200
|
|
|
073263 |
--- src/winclip.c 2014-03-12 19:18:14.264927370 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 797,800 ****
|
|
|
073263 |
--- 797,825 ----
|
|
|
073263 |
vim_free(widestr);
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
+
|
|
|
073263 |
+ /*
|
|
|
073263 |
+ * Convert from 'encoding' to the active codepage.
|
|
|
073263 |
+ * Input is "str[str_size]".
|
|
|
073263 |
+ * The result is in allocated memory: "out[outlen]". With terminating NUL.
|
|
|
073263 |
+ */
|
|
|
073263 |
+ void
|
|
|
073263 |
+ enc_to_acp(str, str_size, out, outlen)
|
|
|
073263 |
+ char_u *str;
|
|
|
073263 |
+ int str_size;
|
|
|
073263 |
+ char_u **out;
|
|
|
073263 |
+ int *outlen;
|
|
|
073263 |
+
|
|
|
073263 |
+ {
|
|
|
073263 |
+ LPWSTR widestr;
|
|
|
073263 |
+ int len = str_size;
|
|
|
073263 |
+
|
|
|
073263 |
+ widestr = (WCHAR *)enc_to_utf16(str, &len;;
|
|
|
073263 |
+ if (widestr != NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ WideCharToMultiByte_alloc(GetACP(), 0, widestr, len,
|
|
|
073263 |
+ (LPSTR *)out, outlen, 0, 0);
|
|
|
073263 |
+ vim_free(widestr);
|
|
|
073263 |
+ }
|
|
|
073263 |
+ }
|
|
|
073263 |
#endif
|
|
|
073263 |
*** ../vim-7.4.201/src/version.c 2014-03-12 18:55:52.104906804 +0100
|
|
|
073263 |
--- src/version.c 2014-03-12 19:19:01.388928092 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 740,741 ****
|
|
|
073263 |
--- 740,743 ----
|
|
|
073263 |
{ /* Add new patch number below this line */
|
|
|
073263 |
+ /**/
|
|
|
073263 |
+ 202,
|
|
|
073263 |
/**/
|
|
|
073263 |
|
|
|
073263 |
--
|
|
|
073263 |
<Beeth> Girls are like internet domain names,
|
|
|
073263 |
the ones I like are already taken.
|
|
|
073263 |
<honx> Well, you can stil get one from a strange country :-P
|
|
|
073263 |
|
|
|
073263 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
073263 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
073263 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
073263 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|