Subject: bug#72771: 31.0.50; shr html renderer throwing "Specified window is not displaying the current buffer"

From: Eli Zaretskii <[email-masked]>
Date: Sat, 24 Aug 2024 22:01:05 +0300

> Date: Sat, 24 Aug 2024 10:10:06 -0700
> Cc: [email-masked], [email-masked], [email-masked]
> From: Jim Porter <[email-masked]>
> 
> >   . use the font obtained from (face-font 'default) (or the actual face
> >     of the text, if you can get at it easily), like this:
> > 
> >        (aref (font-info (face-font 'default)) 10)
> 
> I think the problem is getting the actual face, which works for simple 
> cases via 'get-text-property', but not for more complex ones, e.g. when 
> the 'face' property is a list; 'face-font' raises an error in that case. 
> Effectively what I want would be a Lisp version of 
> 'face_at_buffer_position', but that requires a window object anyway, so 
> I'm back to the original problem...

What's wrong with face-at-point?

> >   . use buffer-text-pixel-size or string-pixel-width to measure the
> >     width of a string of a single SPC character
> 
> I think this wouldn't work since I want the average font width, not the 
> width of SPC.

Then use a few different characters and take their average width.

And I think you place too much faith in the average-width parameter of
a font.  It can fail you.  The display engine uses:

	      char_width = (font->average_width
	                    ? font->average_width
	                    : font->space_width);

> In light of the above, I think what I have now might be the best way to 
> do it for the time being

Do you still think that?