[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56808: 29.0.50; Elusive display problem on macOS
From: |
YAMAMOTO Mitsuharu |
Subject: |
bug#56808: 29.0.50; Elusive display problem on macOS |
Date: |
Sat, 30 Jul 2022 16:49:46 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
On Fri, 29 Jul 2022 23:32:03 +0900,
Gerd Möllmann wrote:
>
> YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
>
> > Does initializing font->space_width to 0 work for you?
>
> Yes it works. Thanks!
Thanks for checking. Eli, is it OK to install the following change to
the emacs-28 branch?
diff --git a/src/macfont.m b/src/macfont.m
index dfdd9bc6ba..eec1707c3c 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -2651,6 +2651,9 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
font->pixel_size = size;
font->driver = &macfont_driver;
font->encoding_charset = font->repertory_charset = -1;
+ /* Clear font->space_width so macfont_monospace_width_multiplier may
+ not be confused by an uninitialized value. */
+ font->space_width = 0;
block_input ();
> Can we be sure that other uses of space_width don't run into problems?
> For instance:
>
> case MACFONT_SPACING_MONO:
> if (cache->width_frac)
> bounds.origin.x += - ((cache->width_frac
> / (CGFloat) (WIDTH_FRAC_SCALE * 2))
> * (cache->width_int / font->space_width));
> break;
>
> That would be an integer division by 0. And it's a bit strange because
> of the integer division in a float expression...
This part is inside `if (metrics) ...' where `metrics' is the third
arg of macfont_glyph_extents, so it is not executed in the following
call in macfont_open:
font->space_width = macfont_glyph_extents (font, glyph, NULL, NULL, 0);
The reason for the integer division is that cache->width_int has
already been adjusted to a multiple of font->space_width if
macfont_info->spacing == MACFONT_SPACING_MONO and cache->width_frac != 0.
if (macfont_info->spacing == MACFONT_SPACING_MONO)
{
/* Some monospace fonts for programming languages contain
wider ligature glyphs consisting of multiple characters.
For such glyphs, simply rounding the combined fractional
width to an integer can result in a value that is not a
multiple of the (rounded) font width. */
int multiplier = macfont_monospace_width_multiplier (font, fwidth);
if (multiplier)
{
cache->width_int = font->space_width * multiplier;
cache->width_frac = lround ((fwidth / multiplier
- font->space_width)
* WIDTH_FRAC_SCALE);
}
else
{
cache->width_int = lround (fwidth);
cache->width_frac = 0;
}
}
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
- bug#56808: 29.0.50; Elusive display problem on macOS, (continued)
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/28
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/28
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/28
- bug#56808: 29.0.50; Elusive display problem on macOS, Eli Zaretskii, 2022/07/28
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/28
- bug#56808: 29.0.50; Elusive display problem on macOS, Eli Zaretskii, 2022/07/28
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/28
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/29
- bug#56808: 29.0.50; Elusive display problem on macOS, YAMAMOTO Mitsuharu, 2022/07/29
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/29
- bug#56808: 29.0.50; Elusive display problem on macOS,
YAMAMOTO Mitsuharu <=
- bug#56808: 29.0.50; Elusive display problem on macOS, Gerd Möllmann, 2022/07/30
- bug#56808: 29.0.50; Elusive display problem on macOS, Eli Zaretskii, 2022/07/30
- bug#56808: 29.0.50; Elusive display problem on macOS, YAMAMOTO Mitsuharu, 2022/07/30
bug#56808: 29.0.50; Elusive display problem on macOS, Alexander Adolf, 2022/07/29