Subject: bug#46971: 28.0.50; Fontifications in Info buffers break alignment in @multitable

From: Protesilaos Stavrou <[email-masked]>
Date: Sat, 02 Oct 2021 07:56:40 +0300

On 2021-09-26, 07:34 -0700, Stefan Kangas <[email-masked]> wrote:

> Eli Zaretskii <[email-masked]> writes:
>
>> To reproduce:
>>
>>   emacs -Q
>>   C-u C-h i ../info/elisp.info RET
>>   C-s Syntax name
>
>> You should now see the table of syntax categories.  The characters in
>> the rightmost column don't align, which looks ugly.
>>
>> This happens because font-lock is instructed to do this:
>>
>>   (defvar Info-mode-font-lock-keywords
>>     '(("‘\\([‘’]\\|[^‘’]*\\)’" (1 'Info-quoted))))
>>
>> Thus the quotes and the quoted text use different faces, and if those
>> faces use different fonts (as they do by default), the table will not
>> be aligned.
>>
>> One possible solution would be to modify Info-mode-font-lock-keywords
>> such that the quotes are also fontified in Info-quoted face.
>
> That fix solves this issue in "emacs -Q" here, but not in my personal
> Emacs configuration where I use a different font.
>
> In "emacs -Q" I have these fonts for the column text (1), and the
> whitespace in between columns (2), and everything lines up:
>
>   1. ftcrhb:-bitstream-Courier 10
> Pitch-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1 (#x08)
>   2. ftcrhb:-Bits-Bitstream Vera Sans
> Mono-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1 (#x03)
>
> With my personal configuration, I have these fonts for the column text
> (1), and the whitespace in between (2), and the alignment is wrong (see
> screenshots below):

Hello Stefan,

The reason you are getting two distinct fonts is because the
'Info-quoted' face is inheriting from 'fixed-pitch'.

Does the alignment get fixed if you make fixed-pitch use the same font
as the default?  Such as with this:

    (set-face-attribute 'fixed-pitch nil
                        :family (face-attribute 'default :family)
                        :height (face-attribute 'default :height))

All the best,
Protesilaos

-- 
Protesilaos Stavrou
https://protesilaos.com