unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font
@ 2016-02-23  5:41 Alex Khesin
  2016-09-14 14:15 ` Philipp Stephani
  2017-03-14 19:50 ` Andrew M. Bishop
  0 siblings, 2 replies; 6+ messages in thread
From: Alex Khesin @ 2016-02-23  5:41 UTC (permalink / raw)
  To: 22780

[-- Attachment #1: Type: text/plain, Size: 3363 bytes --]

emacs 25 choses fonts with different average width for 7x13 font, making
bold text take more horizontal space.  This is particularly a problem when
using themes like https://github.com/bbatsov/zenburn-emacs which use bold
to hihglight matching parenthesis in show-paren-mode, causing characters to
shift as the cursor is moved from a parenthesis to a non-parenthesis
character.

Repro that demonstrates the problem in both 25 pretest 1 and current head
(but is perfectly ok in emacs 24):

$ emacs -Q --eval '(progn (set-face-font '\''default "7x13") (print
(face-font "default")) (print (face-font "bold")))'

shows
  -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
  -misc-fixed-bold-r-normal--13-120-75-75-c-80-iso8859-1

Notice the jump from 70 to 80 before the iso8859 component - that's the
average width, and that's what I believe is causing bold characters to
render wider than non-bold ones.  Both are 70 in emacs 24.


Below is the diagnostics output from M-x report-emacs-bug:

In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll
bars)
 of 2016-02-22 built on alexk1
Repository revision: 81ef756e6aea369ec78f19b3609f01ceddc5851f
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04 LTS (upgraded from: Ubuntu 12.04.3 LTS)

Configured using:
 'configure --with-x-toolkit=lucid'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Features:
(shadow sort mail-extr emacsbug message dired dired-loaddefs format-spec
rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting x-toolkit x
multi-tty make-network-process emacs)

[-- Attachment #2: Type: text/html, Size: 4404 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font
  2016-02-23  5:41 bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font Alex Khesin
@ 2016-09-14 14:15 ` Philipp Stephani
  2016-09-14 16:49   ` Eli Zaretskii
  2017-03-14 19:50 ` Andrew M. Bishop
  1 sibling, 1 reply; 6+ messages in thread
From: Philipp Stephani @ 2016-09-14 14:15 UTC (permalink / raw)
  To: Alex Khesin, 22780

[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]

Alex Khesin <alex@khesin.com> schrieb am Di., 23. Feb. 2016 um 08:20 Uhr:

> emacs 25 choses fonts with different average width for 7x13 font, making
> bold text take more horizontal space.  This is particularly a problem when
> using themes like https://github.com/bbatsov/zenburn-emacs which use bold
> to hihglight matching parenthesis in show-paren-mode, causing characters to
> shift as the cursor is moved from a parenthesis to a non-parenthesis
> character.
>
> Repro that demonstrates the problem in both 25 pretest 1 and current head
> (but is perfectly ok in emacs 24):
>
> $ emacs -Q --eval '(progn (set-face-font '\''default "7x13") (print
> (face-font "default")) (print (face-font "bold")))'
>
> shows
>   -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
>   -misc-fixed-bold-r-normal--13-120-75-75-c-80-iso8859-1
>
> Notice the jump from 70 to 80 before the iso8859 component - that's the
> average width, and that's what I believe is causing bold characters to
> render wider than non-bold ones.  Both are 70 in emacs 24.
>
>
This appears to be a regression from Emacs 24. Would be great if somebody
who has knowledge about this area could look into this.

[-- Attachment #2: Type: text/html, Size: 2106 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font
  2016-09-14 14:15 ` Philipp Stephani
@ 2016-09-14 16:49   ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2016-09-14 16:49 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 22780, alex

> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Wed, 14 Sep 2016 14:15:47 +0000
> 
> Alex Khesin <alex@khesin.com> schrieb am Di., 23. Feb. 2016 um 08:20 Uhr:
> 
>  emacs 25 choses fonts with different average width for 7x13 font, making bold text take more horizontal
>  space. This is particularly a problem when using themes like https://github.com/bbatsov/zenburn-emacs
>  which use bold to hihglight matching parenthesis in show-paren-mode, causing characters to shift as
>  the cursor is moved from a parenthesis to a non-parenthesis character.
> 
>  Repro that demonstrates the problem in both 25 pretest 1 and current head (but is perfectly ok in emacs
>  24):
> 
>  $ emacs -Q --eval '(progn (set-face-font '\''default "7x13") (print (face-font "default")) (print (face-font
>  "bold")))'
> 
>  shows
>  -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
>  -misc-fixed-bold-r-normal--13-120-75-75-c-80-iso8859-1
> 
>  Notice the jump from 70 to 80 before the iso8859 component - that's the average width, and that's what
>  I believe is causing bold characters to render wider than non-bold ones. Both are 70 in emacs 24.
> 
> This appears to be a regression from Emacs 24. Would be great if somebody who has knowledge about this
> area could look into this. 

Alas, we don't have such experts on board.  Moreover, I could be
wrong, but I don't think font selection has seen any changes between
Emacs 24 and 25.

Perhaps the best way ahead is for someone who sees the problem to
revert changes since Emacs 24.5 to xftfont.c, ftfont.c, and font.c one
by one, and see which one causes the problem.  There are only a few
changes there that affect the code and font selection in particular.

Sorry, but I have no better advice.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font
  2016-02-23  5:41 bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font Alex Khesin
  2016-09-14 14:15 ` Philipp Stephani
@ 2017-03-14 19:50 ` Andrew M. Bishop
  2017-03-15 15:39   ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew M. Bishop @ 2017-03-14 19:50 UTC (permalink / raw)
  To: 22780; +Cc: alex

I have also found this problem since I use 7x13 as my default font.
The widening of the bold version of this font makes Emacs version 25
unusable by me.

Using Alex Khesin's test case:

$ emacs -Q --eval '(progn (set-face-font '\''default "7x13") (print (face-font "default")) (print (face-font "bold")))'

I find that these fonts all work correctly (the width is the same for
normal and bold versions):  6x9, 6x10, 6x12, 6x13, 7x14, 8x13, 8x16.

It is only the 7x13 font that does not scale correctly since it gives
different widths (80 compared to 70) for the bold compared to normal
font:

  -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
  -misc-fixed-bold-r-normal--13-120-75-75-c-80-iso8859-1


Using 'git bisect' I traced down the change that caused it and
demonstrated that it can be fixed by this patch.

-------------------- src/xfaces.c patch --------------------
diff --git a/src/xfaces.c b/src/xfaces.c
index 5077cb2d94..c898b7886f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5485,7 +5485,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE])
 	}
       if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
 	attrs[LFACE_FONT_INDEX]
-	  = font_load_for_lface (f, attrs, Ffont_spec (0, NULL));
+	  = font_load_for_lface (f, attrs, attrs[LFACE_FONT_INDEX]);
       if (FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
 	{
 	  face->font = XFONT_OBJECT (attrs[LFACE_FONT_INDEX]);
-------------------- src/xfaces.c patch --------------------

This reverts a patch that was made as part of bug #17973.  The change
in src/font.c that was also made in that bug report seems to not be
relevant.

This is clearly a regression from Emacs 24 but since this change was
made to fix another bug it might be quite difficult to find a change
that works for both.





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font
  2017-03-14 19:50 ` Andrew M. Bishop
@ 2017-03-15 15:39   ` Eli Zaretskii
  2019-11-17  6:55     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-03-15 15:39 UTC (permalink / raw)
  To: Andrew M. Bishop, Kenichi Handa; +Cc: 22780, alex

> From: gnubugs@gedanken.org.uk (Andrew M. Bishop)
> Date: Tue, 14 Mar 2017 19:50:40 +0000
> Cc: alex@khesin.com
> 
> I have also found this problem since I use 7x13 as my default font.
> The widening of the bold version of this font makes Emacs version 25
> unusable by me.
> 
> Using Alex Khesin's test case:
> 
> $ emacs -Q --eval '(progn (set-face-font '\''default "7x13") (print (face-font "default")) (print (face-font "bold")))'
> 
> I find that these fonts all work correctly (the width is the same for
> normal and bold versions):  6x9, 6x10, 6x12, 6x13, 7x14, 8x13, 8x16.
> 
> It is only the 7x13 font that does not scale correctly since it gives
> different widths (80 compared to 70) for the bold compared to normal
> font:
> 
>   -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
>   -misc-fixed-bold-r-normal--13-120-75-75-c-80-iso8859-1
> 
> 
> Using 'git bisect' I traced down the change that caused it and
> demonstrated that it can be fixed by this patch.
> 
> -------------------- src/xfaces.c patch --------------------
> diff --git a/src/xfaces.c b/src/xfaces.c
> index 5077cb2d94..c898b7886f 100644
> --- a/src/xfaces.c
> +++ b/src/xfaces.c
> @@ -5485,7 +5485,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE])
>  	}
>        if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
>  	attrs[LFACE_FONT_INDEX]
> -	  = font_load_for_lface (f, attrs, Ffont_spec (0, NULL));
> +	  = font_load_for_lface (f, attrs, attrs[LFACE_FONT_INDEX]);
>        if (FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
>  	{
>  	  face->font = XFONT_OBJECT (attrs[LFACE_FONT_INDEX]);
> -------------------- src/xfaces.c patch --------------------
> 
> This reverts a patch that was made as part of bug #17973.  The change
> in src/font.c that was also made in that bug report seems to not be
> relevant.
> 
> This is clearly a regression from Emacs 24 but since this change was
> made to fix another bug it might be quite difficult to find a change
> that works for both.

I'm CC'ing Handa-san who was involved in solving that bug.  Reverting
the solution for that bug is clearly not TRT, but I hope Handa-san
will have comments about your particular problem.

Thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font
  2017-03-15 15:39   ` Eli Zaretskii
@ 2019-11-17  6:55     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-17  6:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 22780, alex, Andrew M. Bishop

Eli Zaretskii <eliz@gnu.org> writes:

>> Using 'git bisect' I traced down the change that caused it and
>> demonstrated that it can be fixed by this patch.
>> 
>> -------------------- src/xfaces.c patch --------------------
>> diff --git a/src/xfaces.c b/src/xfaces.c
>> index 5077cb2d94..c898b7886f 100644
>> --- a/src/xfaces.c
>> +++ b/src/xfaces.c
>> @@ -5485,7 +5485,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE])
>>  	}
>>        if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
>>  	attrs[LFACE_FONT_INDEX]
>> -	  = font_load_for_lface (f, attrs, Ffont_spec (0, NULL));
>> +	  = font_load_for_lface (f, attrs, attrs[LFACE_FONT_INDEX]);
>>        if (FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
>>  	{
>>  	  face->font = XFONT_OBJECT (attrs[LFACE_FONT_INDEX]);
>> -------------------- src/xfaces.c patch --------------------
>> 
>> This reverts a patch that was made as part of bug #17973.  The change
>> in src/font.c that was also made in that bug report seems to not be
>> relevant.
>> 
>> This is clearly a regression from Emacs 24 but since this change was
>> made to fix another bug it might be quite difficult to find a change
>> that works for both.
>
> I'm CC'ing Handa-san who was involved in solving that bug.  Reverting
> the solution for that bug is clearly not TRT, but I hope Handa-san
> will have comments about your particular problem.

I tried the recipe with Emacs 27, and the problem still seems to be
present there:

"-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1"
"-misc-fixed-bold-r-normal--13-120-75-75-c-80-iso8859-1"

The code in realize_gui_face hasn't changed since the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-17  6:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-23  5:41 bug#22780: 25.1.50; wrong average width picked for bold face for 7x13 X11 font Alex Khesin
2016-09-14 14:15 ` Philipp Stephani
2016-09-14 16:49   ` Eli Zaretskii
2017-03-14 19:50 ` Andrew M. Bishop
2017-03-15 15:39   ` Eli Zaretskii
2019-11-17  6:55     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).