bug#18077: 24.4.50; Info-quoted face should inherit default

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Sebastian Wiesner-2
Currently, the `Info-quoted' face is defined as follows in info.el:

(defface Info-quoted
  '((t :family "courier"))
  "Face used for quoted elements.")

I do no think that mode faces should *hard-code* specific font families,
and thus bypass any customization of the default face that the user
might have made to pick their preferred font.

Besides, courier is not a particularly friendly choice.  There is no
specific font with that name.  The actual font depends on the font
configuration and aliasing picked by the OS and the user, and depending
on the quality of this configuration the appearance of this font varies
greatly.  If the configuration is particularly poor, or if a proper
substitute font is missing, Emacs might even fall back to X11 bitmap
fonts, which are particularly ugly on modern screens.

So just because it's pretty on your screen, it doesn't need to be pretty
on some else's screen.

Please remove the hard-coded font family and inherit from the default
face instead.



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Eli Zaretskii
> From: [hidden email]
> Date: Tue, 22 Jul 2014 10:15:38 +0200
>
> Currently, the `Info-quoted' face is defined as follows in info.el:
>
> (defface Info-quoted
>   '((t :family "courier"))
>   "Face used for quoted elements.")

This also violates the convention that Info face names start with a
lower-case letter.

> I do no think that mode faces should *hard-code* specific font families,
> and thus bypass any customization of the default face that the user
> might have made to pick their preferred font.
>
> Besides, courier is not a particularly friendly choice.  There is no
> specific font with that name.  The actual font depends on the font
> configuration and aliasing picked by the OS and the user, and depending
> on the quality of this configuration the appearance of this font varies
> greatly.  If the configuration is particularly poor, or if a proper
> substitute font is missing, Emacs might even fall back to X11 bitmap
> fonts, which are particularly ugly on modern screens.
>
> So just because it's pretty on your screen, it doesn't need to be pretty
> on some else's screen.
>
> Please remove the hard-coded font family and inherit from the default
> face instead.

Thank you for your report.

Would you like to suggest a patch for fixing this problem?  Please
note that the underlying issue here is that the font should provide
nice-looking glyphs for the Unicode quote characters.



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Sebastian Wiesner-2
> > I do no think that mode faces should *hard-code* specific font families,
> > and thus bypass any customization of the default face that the user
> > might have made to pick their preferred font.
> >
> > Besides, courier is not a particularly friendly choice.  There is no
> > specific font with that name.  The actual font depends on the font
> > configuration and aliasing picked by the OS and the user, and depending
> > on the quality of this configuration the appearance of this font varies
> > greatly.  If the configuration is particularly poor, or if a proper
> > substitute font is missing, Emacs might even fall back to X11 bitmap
> > fonts, which are particularly ugly on modern screens.
> >
> > So just because it's pretty on your screen, it doesn't need to be pretty
> > on some else's screen.
> >
> > Please remove the hard-coded font family and inherit from the default
> > face instead.
>
> Thank you for your report.
>
> Would you like to suggest a patch for fixing this problem?  Please
> note that the underlying issue here is that the font should provide
> nice-looking glyphs for the Unicode quote characters.

I do not think that I am in a position to suggest a patch that could generally
fix this problem.  I use Emacs only in two different environments, and have no
idea of what limits and constraints Emacs must obey with regards to fonts to
remain portable across various platforms.

I can only say that for my case it would be entirely sufficient to simply make
Info-quoted inherit from default, i.e. use '((:inherit default)) as spec in
defface.  

But I only use a GUI Emacs, and only on very recent and modern systems (Arch
Linux with KDE, and OS X 10.9), where Unicode fonts are less of a problem.  On
these systems Emacs typically picks a font with good unicode coverage for the
default face automatically, e.g. DejaVu Sans Mono or a variant thereof.

Courier however does not exist as a specific family, and might be aliased to
something entirely different than the standard monospace font of the system.  
It could be a fallback URW font, or (even worse) a built-in X11 bitmap font,
which looks really ugly, and quite likely has much worse Unicode coverage than
the font picked for the default face, if it even has any Unicode support at
all.

But I do not know whether this is also the case on Windows, or on older X11
environments, that do not use fontconfig, or even still rely on a font server.

Still, presuming that the user customized the default face to use a good font
with reasonable character coverage (many users do, in my expierence), I think
that it is very unlikely that "courier" is a better choice than the font of
the default face with regards to Unicode coverage.

Also, inheriting from default seems to be the standard among other built-in
faces.

TL;DR: My suggestion would be to simply inherit from default, with no other
attributes set.  Sorry for the long comment.




Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Eli Zaretskii
> From: Sebastian Wiesner <[hidden email]>
> Cc: [hidden email]
> Date: Fri, 25 Jul 2014 12:25:47 +0200
>
> > Would you like to suggest a patch for fixing this problem?  Please
> > note that the underlying issue here is that the font should provide
> > nice-looking glyphs for the Unicode quote characters.
>
> I do not think that I am in a position to suggest a patch that could generally
> fix this problem.  I use Emacs only in two different environments, and have no
> idea of what limits and constraints Emacs must obey with regards to fonts to
> remain portable across various platforms.
>
> I can only say that for my case it would be entirely sufficient to simply make
> Info-quoted inherit from default, i.e. use '((:inherit default)) as spec in
> defface.  
>
> But I only use a GUI Emacs, and only on very recent and modern systems (Arch
> Linux with KDE, and OS X 10.9), where Unicode fonts are less of a problem.  On
> these systems Emacs typically picks a font with good unicode coverage for the
> default face automatically, e.g. DejaVu Sans Mono or a variant thereof.

Character coverage is not the problem.  The problem is that some
widely used fonts that cover these characters have ugly or barely
visible glyphs for them.

> inheriting from default seems to be the standard among other
> built-in faces.

I would trust Stefan (who introduced this face) that he knows that for
quite some time, and had his reasons for not doing that.



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Sebastian Wiesner-2
Am Freitag, 25. Juli 2014, 15:11:42 schrieb Eli Zaretskii:

> > From: Sebastian Wiesner <[hidden email]>
> > Cc: [hidden email]
> > Date: Fri, 25 Jul 2014 12:25:47 +0200
> >
> > > Would you like to suggest a patch for fixing this problem?  Please
> > > note that the underlying issue here is that the font should provide
> > > nice-looking glyphs for the Unicode quote characters.
> >
> > I do not think that I am in a position to suggest a patch that could
> > generally fix this problem.  I use Emacs only in two different
> > environments, and have no idea of what limits and constraints Emacs must
> > obey with regards to fonts to remain portable across various platforms.
> >
> > I can only say that for my case it would be entirely sufficient to simply
> > make Info-quoted inherit from default, i.e. use '((:inherit default)) as
> > spec in defface.
> >
> > But I only use a GUI Emacs, and only on very recent and modern systems
> > (Arch Linux with KDE, and OS X 10.9), where Unicode fonts are less of a
> > problem.  On these systems Emacs typically picks a font with good unicode
> > coverage for the default face automatically, e.g. DejaVu Sans Mono or a
> > variant thereof.
>
> Character coverage is not the problem.  The problem is that some
> widely used fonts that cover these characters have ugly or barely
> visible glyphs for them.
I see.  I doubt, though, that "courier" has generally better quote glyphs than
those  decent modern fonts that are typically used for the default face,
either automatically or by user customization.

Take a look at the attached images, which show the quote characters of various
fonts in Emacs on both of my systems:  

On OS X, the quote characters of Courier aren't any better than that of the
standard monospace faces Menlo and Monaco.  On Linux, Courier isn't even anti-
aliased.  And in both cases the quote characters of Courier are worse than
those of Source Code Pro and Inconsolata, which are popular 3rd party fonts.

Now, I understand that my setup is just some example and by no means
authoritative, and that Courier may look significantly different and much
better on your Linux system.

But I'm trying to demonstrate with these examples that Courier is by no means
*guaranteed* to have good quote characters, and can in fact be significantly
worse than other fonts.  

IOW, there's a chance that Courier gets it right, and there's also a good
chance that Courier gets it wrong.  And that goes for the default face as
well:  It can either have good quotes, or bad ones.

However, the default fonts of modern systems are typically not that bad, and
users typically don't choose very poor fonts for their "default" face, so I
think it's less likely for "default" to get it wrong that for "Info-quoted".  
And the latter can fail really bad, as seen in my Arch Linux example.

 
> > inheriting from default seems to be the standard among other
> > built-in faces.
>
> I would trust Stefan (who introduced this face) that he knows that for
> quite some time, and had his reasons for not doing that.

I'd trust Stefan to the end of the universe, for sure, but he might just have
been lucky to have a proper Courier variant installed on his own systems.  
Even he can't test a face on each and every font setup out there :)

OS X.png (18K) Download Attachment
Arch Linux.png (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Stefan Monnier
In reply to this post by Sebastian Wiesner-2
> Please remove the hard-coded font family and inherit from the default
> face instead.

Inheriting from default would be equivalent to defining the attributes
as just nil.

The whole purpose of this is to make quoted text appear different, so we
don't want to use the default face.

I agree that a specific family is kind of annoying and theoretically
problematic, but it sounds too hypothetical to bother fixing (and to
know how to fix).

Do you have a concrete situation at hand?
Maybe we can address the problem with a a bit more fiddling of
face-font-family-alternatives.


        Stefan



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Sebastian Wiesner-2

Am 26.07.2014 um 00:37 schrieb Stefan Monnier <[hidden email]>:

>> Please remove the hard-coded font family and inherit from the default
>> face instead.
>
> Inheriting from default would be equivalent to defining the attributes
> as just nil.
>
> The whole purpose of this is to make quoted text appear different, so we
> don't want to use the default face.

A different style or color would not be sufficient?

> I agree that a specific family is kind of annoying and theoretically
> problematic, but it sounds too hypothetical to bother fixing (and to
> know how to fix).
>
> Do you have a concrete situation at hand?
> Maybe we can address the problem with a a bit more fiddling of
> face-font-family-alternatives.

With respect, I mean no offense, but did you actually look at the screenshots that I attached to my previous mail?  Did you notice the different between “Courier” and “Source Code Pro” (which is my default face) in the Arch Linux screenshot?

It’s not at all hypothetical.


Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Andreas Schwab-2
In reply to this post by Stefan Monnier
Stefan Monnier <[hidden email]> writes:

> The whole purpose of this is to make quoted text appear different, so we
> don't want to use the default face.

That obviously fails if the default face is the same as courier (which
is the default without Fontconfig support).

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Stefan Monnier
In reply to this post by Sebastian Wiesner-2
>> The whole purpose of this is to make quoted text appear different, so we
>> don't want to use the default face.
> A different style or color would not be sufficient?

To me "courier" is a different style.

Making it bold or italic or colored would not really match my
expectations as a reader of such documentation.

> With respect, I mean no offense, but did you actually look at the
> screenshots that I attached to my previous mail?

No, I didn't notice them, and they don't appear very well in my tty
connection ;-)

Have you looked at whether or not face-font-family-alternatives would
provide a good fix?


        Stefan



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Sebastian Wiesner-2

>>> The whole purpose of this is to make quoted text appear different, so we
>>> don't want to use the default face.
>> A different style or color would not be sufficient?
>
> To me "courier" is a different style.
>
> Making it bold or italic or colored would not really match my
> expectations as a reader of such documentation.

What expectations?  

With respect, Info didn’t use different face for quoted text for ages.  Did the expectations of the readers change all of a sudden?

And if it’s just *your* expectation and your preference, doesn’t it belong into your personal "init.el" then?

>> With respect, I mean no offense, but did you actually look at the
>> screenshots that I attached to my previous mail?
>
> No, I didn't notice them, and they don't appear very well in my tty
> connection ;-)

Oh, well, they are of quite some importance, since they happen to demonstrate what this is all about:  That courier is not consistently of good quality, and can be a very poor font on some systems.

> Have you looked at whether or not face-font-family-alternatives would
> provide a good fix?

I’m not sure whether I can follow.  I mean, I could add an arbitrary “good” font as alias for "courier" myself, but then I could just customize the "Info-quoted" face right away (which is what I’m doing currently).

And if the system can’t provide proper courier font or alias, how could Emacs do any better?


Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Stefan Monnier
> What expectations?

The expectations of someone reading online documentation.  Most online
documentation I can find don't use bold, italics, or colors to
distinguish "technical elements" like those that usually appear in
Info-quoted face.

> And if it’s just *your* expectation and your preference, doesn’t it belong
> into your personal "init.el" then?

I indeed have a different personal setting for Info-quoted in my .emacs,
but I wouldn't want to push this as the default.

> Oh, well, they are of quite some importance, since they happen to
> demonstrate what this is all about:  That courier is not consistently of
> good quality, and can be a very poor font on some systems.

No need for a screenshot to convince me of that, then.
When I say "concrete case" I don't mean "please try to construct
a situation where this happen" (I can usually do it myself), but rather
"did someone involuntarily bump into this in his everyday use of Emacs?".

So, IIUC, this is still hypothetical.

>> Have you looked at whether or not face-font-family-alternatives would
>> provide a good fix?
> I’m not sure whether I can follow.  I mean, I could add an arbitrary “good”
> font as alias for "courier" myself, but then I could just customize the
> "Info-quoted" face right away (which is what I’m doing currently).

On those systems that have a bad "courier" font (probably
bitmapped), do they usually have another font that looks good and is almost
identical (but obviously under a different name)?

> And if the system can’t provide proper courier font or alias, how
> could Emacs do any better?

I think the best we can do is to choose another monospaced font
with serif.  After all, face-font-family-alternatives already has
a fallback to "fixed" as a last resort, so any monospaced font with
serif would be a better fit than "fixed".


        Stefan



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Sebastian Wiesner-2

Am 27.07.2014 um 12:16 schrieb Stefan Monnier <[hidden email]>:

>> What expectations?
>
> The expectations of someone reading online documentation.  Most online
> documentation I can find don't use bold, italics, or colors to
> distinguish "technical elements" like those that usually appear in
> Info-quoted face.

Such documentation also uses proportional fonts for standard body text.  Now where’s `Info-body` with “Times New Roman”, to match this expectation as well?

>> And if it’s just *your* expectation and your preference, doesn’t it belong
>> into your personal "init.el" then?
>
> I indeed have a different personal setting for Info-quoted in my .emacs,
> but I wouldn't want to push this as the default.
>
>> Oh, well, they are of quite some importance, since they happen to
>> demonstrate what this is all about:  That courier is not consistently of
>> good quality, and can be a very poor font on some systems.
>
> No need for a screenshot to convince me of that, then.
> When I say "concrete case" I don't mean "please try to construct
> a situation where this happen" (I can usually do it myself), but rather
> "did someone involuntarily bump into this in his everyday use of Emacs?“.

I did not specifically “construct” any situation where this issue appears.  I have better uses for my time than trying to provoke random issues ;)  I involuntary bumped into this, when after a rebuild of Emacs trunk I realized that all quoted text in Info had suddenly become quite ugly.

The screenshots should just demonstrate the issue, and show in how far „Courier“ can be expected to have good quote characters, as Eli demanded in his reply.

>>> Have you looked at whether or not face-font-family-alternatives would
>>> provide a good fix?
>> I’m not sure whether I can follow.  I mean, I could add an arbitrary “good”
>> font as alias for "courier" myself, but then I could just customize the
>> "Info-quoted" face right away (which is what I’m doing currently).
>
> On those systems that have a bad "courier" font (probably
> bitmapped), do they usually have another font that looks good and is almost
> identical (but obviously under a different name)?

How am I supposed to know what fonts are available on arbitrary systems?  I can only say that on my Linux system there are various other fonts available.  Liberation Mono would probably be the one that is closest to Courier.

But whether that font is widely installed, I do not know.  As I said, font configuration and availability on Linux greatly various between distributions and individual setups.  There is no general set of fonts to rely upon on Linux beyond generic names (e.g. „Serif“, „Monospace“, „Sans“, etc.)


Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Stefan Monnier
>> The expectations of someone reading online documentation.  Most online
>> documentation I can find don't use bold, italics, or colors to
>> distinguish "technical elements" like those that usually appear in
>> Info-quoted face.
> Such documentation also uses proportional fonts for standard body text.

Indeed.  But currently, we can't do that very well because refilling
Info text is between hard and impossible (there would be other hurdles,
but that's the most immediate one).

> How am I supposed to know what fonts are available on arbitrary systems?

You don't need to know that.  You just need to know what alternative
fonts are available on the system where you bumped into the problem.

> I can only say that on my Linux system there are various other fonts
> available.  Liberation Mono would probably be the one that is closest
> to Courier.

Great, thanks.  I see my (xft, scalable) "courier" here on my Debian
machines is coming from the "foundry" "ibm", but I don't really know how
to further track its origin (e.g. which package it comes from).

> But whether that font is widely installed, I do not know.

Doesn't matter: face-font-family-alternatives is designed specifically
to overcome those problems.

E.g. we should probably change Info-quoted to use family
"monospace-serif" and then add an entry to face-font-family-alternatives
like ("monospace-serif" "Liberation Mono" "courier" "CMU Typewriter
Text" "fixed").


        Stefan





Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Juri Linkov
In reply to this post by Sebastian Wiesner-2
> Take a look at the attached images, which show the quote characters of various
> fonts in Emacs on both of my systems:

For `info-quoted' we could use the same font families as e.g.
StackOverflow uses for code blocks:

    Consolas
    Menlo
    Monaco
    Lucida Console
    Liberation Mono
    DejaVu Sans Mono
    Bitstream Vera Sans Mono
    Courier New
    monospace
    serif

http://meta.stackexchange.com/questions/36176/whats-the-font-used-in-code-blocks



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Stefan Monnier
> For `info-quoted' we could use the same font families as e.g.
> StackOverflow uses for code blocks:

It's probably a good source of inspiration, but we have to take into
account that the font of the "normal text" is usually proportional in
stackoverflow, whereas it's usually monospaced in Emacs.


        Stefan



Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Sebastian Wiesner-2
In reply to this post by Stefan Monnier
Am 28.07.2014 um 01:23 schrieb Stefan Monnier <[hidden email]>:

>>> The expectations of someone reading online documentation.  Most online
>>> documentation I can find don't use bold, italics, or colors to
>>> distinguish "technical elements" like those that usually appear in
>>> Info-quoted face.
>> Such documentation also uses proportional fonts for standard body text.
>
> Indeed.  But currently, we can't do that very well because refilling
> Info text is between hard and impossible (there would be other hurdles,
> but that's the most immediate one).

So Info is obviously *very* different from other online documentation, and we should probably not use other online documentation, that is not subject to these limitations, as a guideline for how Info mode should look like.  We can’t entirely match the expectations of readers of these other documentations anyway, because the constraints of the Info format won’t allow to make Info documentation really look like other documentation.  At best, we’ll have some remote similarity, and at worst, Info will look much worse (as it did in this case).

IOW, Info isn’t HTML, and we shouldn’t pretend that it was… my 2 cents.

Anyhow, the face is customizable, so it’s probably not an issue of importance, since anyone can customize it to have a sane style on their system, and we are used to customize Emacs anyway.

I do not know enough about font families and font style to discuss what fonts could be used as an alternative for Courier for use in the Info-quoted face, so if that is the solution you’d like to have, I can’t help anymore.


Reply | Threaded
Open this post in threaded view
|

bug#18077: 24.4.50; Info-quoted face should inherit default

Stefan Kangas
In reply to this post by Stefan Monnier
Stefan Monnier <[hidden email]> writes:

>> For `info-quoted' we could use the same font families as e.g.
>> StackOverflow uses for code blocks:
>
> It's probably a good source of inspiration, but we have to take into
> account that the font of the "normal text" is usually proportional in
> stackoverflow, whereas it's usually monospaced in Emacs.

Is this now fixed by this commit, or is there more to do here?

    Author: Paul Eggert <[hidden email]>
    Date:   Fri May 13 13:30:33 2016 -0700

        Improve display of tex-verbatim and Info quoted

        Problem reported by Glenn Morris (Bug#19889).
        * doc/emacs/display.texi (Standard Faces):
        * doc/lispref/display.texi (Basic Faces):
        * etc/NEWS: Mention fixed-pitch-serif.
        * lisp/faces.el (face-font-family-alternatives):
        New family alias Monospace Serif.
        (fixed-pitch-serif): New face, which uses the new family.
        * lisp/info.el (Info-quoted):
        * lisp/textmodes/tex-mode.el (tex-verbatim): Use the new face.
        * test/lisp/legacy/font-parse-tests.el (font-parse-tests--data):
        Add test case for Monospace Serif.