Patch 8.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.
Files:      runtime/doc/options.txt, runtime/doc/gui.txt,
            runtime/doc/mbyte.txt, src/gui_w32.c, src/os_mswin.c


*** ../vim-8.1.1223/runtime/doc/options.txt     2019-04-27 20:36:52.526303597 
+0200
--- runtime/doc/options.txt     2019-04-28 13:54:11.773008464 +0200
***************
*** 3705,3795 ****
                        {not in Vi}
                        {only available when compiled with GUI enabled}
        This is a list of fonts which will be used for the GUI version of Vim.
!       In its simplest form the value is just one font name.  When
!       the font cannot be found you will get an error message.  To try other
!       font names a list can be specified, font names separated with commas.
!       The first valid font is used.
! 
!       On systems where 'guifontset' is supported (X11) and 'guifontset' is
!       not empty, then 'guifont' is not used.
! 
!       Note: As to the GTK GUIs, no error is given against any invalid names,
!       and the first element of the list is always picked up and made use of.
!       This is because, instead of identifying a given name with a font, the
!       GTK GUIs use it to construct a pattern and try to look up a font which
!       best matches the pattern among available fonts, and this way, the
!       matching never fails.  An invalid name doesn't matter because a number
!       of font properties other than name will do to get the matching done.
! 
!       Spaces after a comma are ignored.  To include a comma in a font name
!       precede it with a backslash.  Setting an option requires an extra
!       backslash before a space and a backslash.  See also
!       |option-backslash|.  For example: >
!           :set guifont=Screen15,\ 7x13,font\\,with\\,commas
! <     will make Vim try to use the font "Screen15" first, and if it fails it
!       will try to use "7x13" and then "font,with,commas" instead.
! 
!       If none of the fonts can be loaded, Vim will keep the current setting.
!       If an empty font list is given, Vim will try using other resource
!       settings (for X, it will use the Vim.font resource), and finally it
!       will try some builtin default which should always be there ("7x13" in
!       the case of X).  The font names given should be "normal" fonts.  Vim
!       will try to find the related bold and italic fonts.
! 
!       For Win32, GTK, Motif, Mac OS and Photon: >
!           :set guifont=*
! <     will bring up a font requester, where you can pick the font you want.
! 
!       The font name depends on the GUI used.  See |setting-guifont| for a
!       way to set 'guifont' for various systems.
! 
!       For the GTK+ 2 and 3 GUIs, the font name looks like this: >
!           :set guifont=Andale\ Mono\ 11
! <     That's all.  XLFDs are not used.  For Chinese this is reported to work
!       well: >
!           if has("gui_gtk2")
!             set guifont=Bitstream\ Vera\ Sans\ Mono\ 12,Fixed\ 12
!             set guifontwide=Microsoft\ Yahei\ 12,WenQuanYi\ Zen\ Hei\ 12
!           endif
! <
!         (Replace gui_gtk2 with gui_gtk3 for the GTK+ 3 GUI)
! 
!       For Mac OSX you can use something like this: >
!           :set guifont=Monaco:h10
! <     Also see 'macatsui', it can help fix display problems.
!                                                               *E236*
!       Note that the fonts must be mono-spaced (all characters have the same
!       width).  An exception is GTK: all fonts are accepted, but mono-spaced
!       fonts look best.
! 
!       To preview a font on X11, you might be able to use the "xfontsel"
!       program.  The "xlsfonts" program gives a list of all available fonts.
! 
!       For the Win32 GUI                                       *E244* *E245*
!       - takes these options in the font name:
!               hXX - height is XX (points, can be floating-point)
!               wXX - width is XX (points, can be floating-point)
!               b   - bold
!               i   - italic
!               u   - underline
!               s   - strikeout
!               cXX - character set XX.  Valid charsets are: ANSI, ARABIC,
!                     BALTIC, CHINESEBIG5, DEFAULT, EASTEUROPE, GB2312, GREEK,
!                     HANGEUL, HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS,
!                     SYMBOL, THAI, TURKISH, VIETNAMESE ANSI and BALTIC.
!                     Normally you would use "cDEFAULT".
!               qXX - quality XX.  Valid quality names are: PROOF, DRAFT,
!                     ANTIALIASED, NONANTIALIASED, CLEARTYPE, DEFAULT.
!                     Normally you would use "qDEFAULT".
!                     Some quality values are not 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
!         backslashes to escape the spaces.
!       - Examples: >
!           :set guifont=courier_new:h12:w5:b:cRUSSIAN
!           :set guifont=Andale_Mono:h7.5:w4.5
! <     See also |font-sizes|.
  
                                        *'guifontset'* *'gfs'*
                                        *E250* *E252* *E234* *E597* *E598*
--- 3727,3734 ----
                        {not in Vi}
                        {only available when compiled with GUI enabled}
        This is a list of fonts which will be used for the GUI version of Vim.
!       In its simplest form the value is just one font name.
!       See |gui-font| for the details.
  
                                        *'guifontset'* *'gfs'*
                                        *E250* *E252* *E234* *E597* *E598*
***************
*** 3802,3821 ****
        When not empty, specifies two (or more) fonts to be used.  The first
        one for normal English, the second one for your special language.  See
        |xfontset|.
!       Setting this option also means that all font names will be handled as
!       a fontset name.  Also the ones used for the "font" argument of the
!       |:highlight| command.
!       The fonts must match with the current locale.  If fonts for the
!       character sets that the current locale uses are not included, setting
!       'guifontset' will fail.
!       Note the difference between 'guifont' and 'guifontset': In 'guifont'
!       the comma-separated names are alternative names, one of which will be
!       used.  In 'guifontset' the whole string is one fontset name,
!       including the commas.  It is not possible to specify alternative
!       fontset names.
!       This example works on many X11 systems: >
!               :set guifontset=-*-*-medium-r-normal--16-*-*-*-c-*-*-*
! <
                                *'guifontwide'* *'gfw'* *E231* *E533* *E534*
  'guifontwide' 'gfw'   string  (default "")
                        global
--- 3741,3747 ----
        When not empty, specifies two (or more) fonts to be used.  The first
        one for normal English, the second one for your special language.  See
        |xfontset|.
! 
                                *'guifontwide'* *'gfw'* *E231* *E533* *E534*
  'guifontwide' 'gfw'   string  (default "")
                        global
***************
*** 3823,3853 ****
                        {only available when compiled with GUI enabled}
        When not empty, specifies a comma-separated list of fonts to be used
        for double-width characters.  The first font that can be loaded is
!       used.
!       Note: The size of these fonts must be exactly twice as wide as the one
!       specified with 'guifont' and the same height.
! 
!       All GUI versions but GTK+:
! 
!       'guifontwide' is only used when 'encoding' is set to "utf-8" and
!       'guifontset' is empty or invalid.
!       When 'guifont' is set and a valid font is found in it and
!       'guifontwide' is empty Vim will attempt to find a matching
!       double-width font and set 'guifontwide' to it.
! 
!       GTK+ GUI only:                          *guifontwide_gtk*
! 
!       If set and valid, 'guifontwide' is always used for double width
!       characters, even if 'encoding' is not set to "utf-8".
!       Vim does not attempt to find an appropriate value for 'guifontwide'
!       automatically.  If 'guifontwide' is empty Pango/Xft will choose the
!       font for characters not available in 'guifont'.  Thus you do not need
!       to set 'guifontwide' at all unless you want to override the choice
!       made by Pango/Xft.
! 
!       Windows +multibyte only:                *guifontwide_win_mbyte*
! 
!       If set and valid, 'guifontwide' is used for IME instead of 'guifont'.
  
                                                *'guiheadroom'* *'ghr'*
  'guiheadroom' 'ghr'   number  (default 50)
--- 3749,3755 ----
                        {only available when compiled with GUI enabled}
        When not empty, specifies a comma-separated list of fonts to be used
        for double-width characters.  The first font that can be loaded is
!       used.  See |gui-fontwide|.
  
                                                *'guiheadroom'* *'ghr'*
  'guiheadroom' 'ghr'   number  (default 50)
*** ../vim-8.1.1223/runtime/doc/gui.txt 2019-01-06 13:10:46.324499127 +0100
--- runtime/doc/gui.txt 2019-04-28 13:58:23.719831619 +0200
***************
*** 1,4 ****
! *gui.txt*       For Vim version 8.1.  Last change: 2018 Mar 06
  
  
                  VIM REFERENCE MANUAL    by Bram Moolenaar
--- 1,4 ----
! *gui.txt*       For Vim version 8.1.  Last change: 2019 Apr 28
  
  
                  VIM REFERENCE MANUAL    by Bram Moolenaar
***************
*** 11,18 ****
  3. Mouse Control              |gui-mouse|
  4. Making GUI Selections      |gui-selections|
  5. Menus                      |menus|
! 6. Extras                     |gui-extras|
! 7. Shell Commands             |gui-shell|
  
  Other GUI documentation:
  |gui_x11.txt| For specific items of the X11 GUI.
--- 11,19 ----
  3. Mouse Control              |gui-mouse|
  4. Making GUI Selections      |gui-selections|
  5. Menus                      |menus|
! 6. Font                               |gui-font|
! 7. Extras                     |gui-extras|
! 8. Shell Commands             |gui-shell|
  
  Other GUI documentation:
  |gui_x11.txt| For specific items of the X11 GUI.
***************
*** 1037,1043 ****
  Note that a menu that starts with ']' will not be displayed.
  
  ==============================================================================
! 6. Extras                                             *gui-extras*
  
  This section describes other features which are related to the GUI.
  
--- 1038,1176 ----
  Note that a menu that starts with ']' will not be displayed.
  
  ==============================================================================
! 6. Font
! 
! This section describes font related options.
! 
! GUIFONT                                                       *gui-font*
! 
! 'guifont' is the option that tells Vim what font to use.  In its simplest form
! the value is just one font name.  It can also be a list of font names
! separated with commas.  The first valid font is used.  When no valid font can
! be found you will get an error message. 
! 
! On systems where 'guifontset' is supported (X11) and 'guifontset' is not
! empty, then 'guifont' is not used.  See |xfontset|.
! 
! Note: As to the GTK GUIs, no error is given against any invalid names, and the
! first element of the list is always picked up and made use of.  This is
! because, instead of identifying a given name with a font, the GTK GUIs use it
! to construct a pattern and try to look up a font which best matches the
! pattern among available fonts, and this way, the matching never fails.  An
! invalid name doesn't matter because a number of font properties other than
! name will do to get the matching done.
! 
! Spaces after a comma are ignored.  To include a comma in a font name precede
! it with a backslash.  Setting an option requires an extra backslash before a
! space and a backslash.  See also |option-backslash|.  For example: >
!     :set guifont=Screen15,\ 7x13,font\\,with\\,commas
! will make Vim try to use the font "Screen15" first, and if it fails it will
! try to use "7x13" and then "font,with,commas" instead.
! 
! If none of the fonts can be loaded, Vim will keep the current setting.  If an
! empty font list is given, Vim will try using other resource settings (for X,
! it will use the Vim.font resource), and finally it will try some builtin
! default which should always be there ("7x13" in the case of X).  The font
! names given should be "normal" fonts.  Vim will try to find the related bold
! and italic fonts.
! 
! For Win32, GTK, Motif, Mac OS and Photon: >
!     :set guifont=*
! will bring up a font requester, where you can pick the font you want.
! 
! The font name depends on the GUI used.  See |setting-guifont| for a way to set
! 'guifont' for various systems.
! 
! For the GTK+ 2 and 3 GUIs, the font name looks like this: >
!     :set guifont=Andale\ Mono\ 11
! That's all.  XLFDs are not used.  For Chinese this is reported to work well: >
!     if has("gui_gtk2")
!       set guifont=Bitstream\ Vera\ Sans\ Mono\ 12,Fixed\ 12
!       set guifontwide=Microsoft\ Yahei\ 12,WenQuanYi\ Zen\ Hei\ 12
!     endif
! <
! (Replace gui_gtk2 with gui_gtk3 for the GTK+ 3 GUI)
! 
! For Mac OSX you can use something like this: >
!     :set guifont=Monaco:h10
! Also see 'macatsui', it can help fix display problems.
!                                                       *E236*
! Note that the fonts must be mono-spaced (all characters have the same width).
! An exception is GTK: all fonts are accepted, but mono-spaced fonts look best.
! 
! To preview a font on X11, you might be able to use the "xfontsel" program.
! The "xlsfonts" program gives a list of all available fonts.
! 
! For the Win32 GUI                                     *E244* *E245*
! - Takes these options in the font name (use a ':' to separate the options):
!       hXX - height is XX (points, can be floating-point)
!       wXX - width is XX (points, can be floating-point)
!       WXX - weight is XX (see Note on Weights below)
!       b   - bold. This is equivalent to setting the weight to 700.
!       i   - italic
!       u   - underline
!       s   - strikeout
!       cXX - character set XX.  Valid charsets are: ANSI, ARABIC, BALTIC,
!             CHINESEBIG5, DEFAULT, EASTEUROPE, GB2312, GREEK, HANGEUL,
!             HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS, SYMBOL, THAI,
!             TURKISH, VIETNAMESE ANSI and BALTIC.  Normally you would use
!             "cDEFAULT".
!       qXX - quality XX.  Valid quality names are: PROOF, DRAFT, ANTIALIASED,
!             NONANTIALIASED, CLEARTYPE, DEFAULT.  Normally you would use
!             "qDEFAULT".
!             Some quality values are not supported in legacy OSs.
! - A '_' can be used in the place of a space, so you don't need to use
!   backslashes to escape the spaces.
! Examples: >
!     :set guifont=courier_new:h12:w5:b:cRUSSIAN
!     :set guifont=Andale_Mono:h7.5:w4.5
! 
! See also |font-sizes|.
! 
! Note on Weights: Fonts often come with a variety of weights. "Normal" weights
! in Windows have a value of 400 and, left unspecified, this is the value that
! will be used when attempting to find fonts. Windows will often match fonts
! based on their weight with higher priority than the font name which means a
! Book or Medium variant of a font might be used despite specifying a Light or
! ExtraLight variant. If you are experiencing heavier weight substitution, then
! explicitly setting a lower weight value may mitigate against this unwanted
! substitution.
! 
! 
! GUIFONTWIDE                                           *gui-fontwide*
! 
! When not empty, 'guifontwide' specifies a comma-separated list of fonts to be
! used for double-width characters.  The first font that can be loaded is
! used.
! 
! Note: The size of these fonts must be exactly twice as wide as the one
! specified with 'guifont' and the same height.  If there is a mismatch then
! the text will not be drawn correctly.
! 
! All GUI versions but GTK+:
! 
! 'guifontwide' is only used when 'encoding' is set to "utf-8" and
! 'guifontset' is empty or invalid.
! When 'guifont' is set and a valid font is found in it and
! 'guifontwide' is empty Vim will attempt to find a matching
! double-width font and set 'guifontwide' to it.
! 
! GTK+ GUI only:                        *guifontwide_gtk*
! 
! If set and valid, 'guifontwide' is always used for double width
! characters, even if 'encoding' is not set to "utf-8".
! Vim does not attempt to find an appropriate value for 'guifontwide'
! automatically.  If 'guifontwide' is empty Pango/Xft will choose the
! font for characters not available in 'guifont'.  Thus you do not need
! to set 'guifontwide' at all unless you want to override the choice
! made by Pango/Xft.
! 
! Windows +multibyte only:              *guifontwide_win_mbyte*
! 
! If set and valid, 'guifontwide' is used for IME instead of 'guifont'.
! 
! ==============================================================================
! 7. Extras                                             *gui-extras*
  
  This section describes other features which are related to the GUI.
  
***************
*** 1081,1087 ****
  http://www.lexikan.com/mincho.htm
  
  ==============================================================================
! 7. Shell Commands                                     *gui-shell*
  
  For the X11 GUI the external commands are executed inside the gvim window.
  See |gui-pty|.
--- 1214,1220 ----
  http://www.lexikan.com/mincho.htm
  
  ==============================================================================
! 8. Shell Commands                                     *gui-shell*
  
  For the X11 GUI the external commands are executed inside the gvim window.
  See |gui-pty|.
*** ../vim-8.1.1223/runtime/doc/mbyte.txt       2018-05-17 13:41:41.000000000 
+0200
--- runtime/doc/mbyte.txt       2019-04-28 13:51:04.377867566 +0200
***************
*** 633,638 ****
--- 620,640 ----
  locale.  You have to specify all the fonts that a locale requires in the
  'guifontset' option.
  
+ Setting the 'guifontset' option also means that all font names will be handled
+ as a fontset name.  Also the ones used for the "font" argument of the
+ |:highlight| command.
+ 
+ Note the difference between 'guifont' and 'guifontset': In 'guifont'
+ the comma-separated names are alternative names, one of which will be
+ used.  In 'guifontset' the whole string is one fontset name,
+ including the commas.  It is not possible to specify alternative
+ fontset names.
+ This example works on many X11 systems: >
+       :set guifontset=-*-*-medium-r-normal--16-*-*-*-c-*-*-*
+ <
+ The fonts must match with the current locale.  If fonts for the character sets
+ that the current locale uses are not included, setting 'guifontset' will fail.
+ 
  NOTE: The fontset always uses the current locale, even though 'encoding' may
  be set to use a different charset.  In that situation you might want to use
  'guifont' and 'guifontwide' instead of 'guifontset'.
*** ../vim-8.1.1223/src/gui_w32.c       2019-04-27 19:15:41.856806819 +0200
--- src/gui_w32.c       2019-04-28 14:00:23.807264628 +0200
***************
*** 3119,3124 ****
--- 3119,3125 ----
      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,3140 ****
      charset_name = charset_id2name((int)lf.lfCharSet);
      quality_name = quality_id2name((int)lf.lfQuality);
  
!     res = (char *)alloc((unsigned)(strlen(font_name) + 20
                    + (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));
        while (*p)
        {
            if (*p == ' ')
--- 3127,3145 ----
      charset_name = charset_id2name((int)lf.lfCharSet);
      quality_name = quality_id2name((int)lf.lfQuality);
  
!     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:
!       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,3149 ****
        }
        if (lf.lfItalic)
            STRCAT(p, ":i");
!       if (lf.lfWeight >= FW_BOLD)
            STRCAT(p, ":b");
        if (lf.lfUnderline)
            STRCAT(p, ":u");
--- 3148,3154 ----
        }
        if (lf.lfItalic)
            STRCAT(p, ":i");
!       if (lf.lfWeight == FW_BOLD)
            STRCAT(p, ":b");
        if (lf.lfUnderline)
            STRCAT(p, ":u");
*** ../vim-8.1.1223/src/os_mswin.c      2019-04-17 18:24:32.006143206 +0200
--- src/os_mswin.c      2019-04-28 13:41:04.784425947 +0200
***************
*** 2992,2997 ****
--- 2992,3000 ----
            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;
*** ../vim-8.1.1223/src/version.c       2019-04-28 13:00:08.627933382 +0200
--- src/version.c       2019-04-28 13:41:34.796308949 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1224,
  /**/

-- 
Some say the world will end in fire; some say in segfaults.
I say it will end in a curly bracket.

 /// 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.

Raspunde prin e-mail lui