Re: [patch][win32] Fix multibyte fontname
Ken Takata wrote: > On Win32, "_" can be used instead of a white space for 'guifont' for > convenience. > For example, when a user sets "guifont=MS_Gothic", vim will also search a font > named "MS Gothic". > However, I found that this doesn't work well when a font name contains a > character which includes "_" as a part of it. E.g. The second byte of "柔" is > the same as "_" in the cp932 encoding. So ":set gfn=源柔ゴシック等幅_Regular" > doesn't work as expected. (":set gfn=源柔ゴシック等幅\ Regular" works.) > > Attached patch fixes the problem. Thanks! -- Q: What kind of stuff do you do? A: I collect hobbies. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[patch][win32] Fix multibyte fontname
Hi, On Win32, "_" can be used instead of a white space for 'guifont' for convenience. For example, when a user sets "guifont=MS_Gothic", vim will also search a font named "MS Gothic". However, I found that this doesn't work well when a font name contains a character which includes "_" as a part of it. E.g. The second byte of "柔" is the same as "_" in the cp932 encoding. So ":set gfn=源柔ゴシック等幅_Regular" doesn't work as expected. (":set gfn=源柔ゴシック等幅\ Regular" works.) Attached patch fixes the problem. Regards, Ken Takata -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. # HG changeset patch # Parent b7e4b79446e36195e00330cb22ef4e56c1daa61b diff --git a/src/os_mswin.c b/src/os_mswin.c --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -2990,7 +2990,9 @@ get_logfont( int did_replace = FALSE; for (i = 0; lf->lfFaceName[i]; ++i) - if (lf->lfFaceName[i] == '_') + if (IsDBCSLeadByte(lf->lfFaceName[i])) + ++i; + else if (lf->lfFaceName[i] == '_') { lf->lfFaceName[i] = ' '; did_replace = TRUE;