all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Font in mode line
@ 2013-11-24 16:15 Francesco Mazzoli
  2013-11-24 16:57 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Francesco Mazzoli @ 2013-11-24 16:15 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm trying to set "8x13" (one of the fonts shipped with X) to be the font in 
my mode line.

If I start emacs using `emacs -Q', and then execute

    (set-face-attribute 'mode-line nil :font "8x13")

The font is rendered wrongly: <http://i.imgur.com/QUHaWnj.png>.  Note that 
the buffer id appears differently because it follows the `mode-line-buffer-
id' face, if I set that to use 8x13 too that is rendered wrongly as well.

Weirdly, if I set "8x13" to be the default font, it renders fine (both in the 
buffer and in the mode line): <http://i.imgur.com/o9QcxLr.png>.

Am I doing something wrong?  I'm running `GNU Emacs 24.3.1 (x86_64-pc-linux-
gnu, GTK+ Version 3.8.4) of 2013-09-27 on trouble, modified by Debian' 
(`emacs24' on Debian testing).

Francesco




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

* Re: Font in mode line
  2013-11-24 16:15 Font in mode line Francesco Mazzoli
@ 2013-11-24 16:57 ` Eli Zaretskii
  2013-11-26 17:26   ` Francesco Mazzoli
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2013-11-24 16:57 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Francesco Mazzoli <f@mazzo.li>
> Date: Sun, 24 Nov 2013 16:15:35 +0000 (UTC)
> 
> I'm trying to set "8x13" (one of the fonts shipped with X) to be the font in 
> my mode line.
> 
> If I start emacs using `emacs -Q', and then execute
> 
>     (set-face-attribute 'mode-line nil :font "8x13")
> 
> The font is rendered wrongly: <http://i.imgur.com/QUHaWnj.png>.  Note that 
> the buffer id appears differently because it follows the `mode-line-buffer-
> id' face, if I set that to use 8x13 too that is rendered wrongly as well.

By "wrongly" you mean that it looks like a different font was actually
used?  Because I cannot see anything wrong with the display shown in
that screenshot.

If the font seems to be the problem, then please use format-mode-line
to format a line of text using that font, then type "C-u C-x =" on one
of the characters that are rendered incorrectly, and see which font
was actually used for its display.  That might give a clue about
what's going on.



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

* Re: Font in mode line
  2013-11-24 16:57 ` Eli Zaretskii
@ 2013-11-26 17:26   ` Francesco Mazzoli
  2013-11-26 18:11     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Francesco Mazzoli @ 2013-11-26 17:26 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz <at> gnu.org> writes:
> By "wrongly" you mean that it looks like a different font was actually
> used?  Because I cannot see anything wrong with the display shown in
> that screenshot.

By "wrongly" I mean that the font is not displayed as it should.  Compare my 
first screenshot <http://i.imgur.com/QUHaWnj.png>, to the second 
<http://i.imgur.com/o9QcxLr.png> to see what I mean.

> If the font seems to be the problem, then please use format-mode-line
> to format a line of text using that font, then type "C-u C-x =" on one
> of the characters that are rendered incorrectly, and see which font
> was actually used for its display.  That might give a clue about
> what's going on.

I'm fairly sure the font is the correct one, since I can see I change when, 
for example, I change specifically the `mode-line-buffer-id' face.  I'm not 
sure how to use `format-mode-line' the way you described.  If I format `mode-
line-format' there doesn't seem to be an obvious way to infer the faces that 
are used to render the various elements.  If I format some plain string it is 
returned as-is.

Francesco





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

* Re: Font in mode line
  2013-11-26 17:26   ` Francesco Mazzoli
@ 2013-11-26 18:11     ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2013-11-26 18:11 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Francesco Mazzoli <f@mazzo.li>
> Date: Tue, 26 Nov 2013 17:26:35 +0000 (UTC)
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> > By "wrongly" you mean that it looks like a different font was actually
> > used?  Because I cannot see anything wrong with the display shown in
> > that screenshot.
> 
> By "wrongly" I mean that the font is not displayed as it should.  Compare my 
> first screenshot <http://i.imgur.com/QUHaWnj.png>, to the second 
> <http://i.imgur.com/o9QcxLr.png> to see what I mean.

They just look different, that's all.  But "different" doesn't
necessarily mean "wrong".

So those pictures are not enough to understand what, if anything, is
wrong.

> > If the font seems to be the problem, then please use format-mode-line
> > to format a line of text using that font, then type "C-u C-x =" on one
> > of the characters that are rendered incorrectly, and see which font
> > was actually used for its display.  That might give a clue about
> > what's going on.
> 
> I'm fairly sure the font is the correct one, since I can see I change when, 
> for example, I change specifically the `mode-line-buffer-id' face.

How can it be the correct font, and yet look differently from the same
font in the second screenshot?

> I'm not sure how to use `format-mode-line' the way you described.

Like this:

  C-x b *scratch* RET
  M-x font-lock-mode RET
  Now type this:

   (insert (format-mode-line mode-line-format))

  and press C-j at the rightmost closing parenthesis.

> If I format `mode- line-format' there doesn't seem to be an obvious
> way to infer the faces that are used to render the various elements.

Go to one of the problematic characters and type "C-u C-x =".  Emacs
will then show the font it used to display that character.



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

* Re: Font in mode line
@ 2013-11-26 21:22 Francesco Mazzoli
  2013-11-27  3:45 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Francesco Mazzoli @ 2013-11-26 21:22 UTC (permalink / raw)
  To: eliz, help-gnu-emacs

> > I'm not sure how to use `format-mode-line' the way you described.
>
> Like this:
>
>   C-x b *scratch* RET
>   M-x font-lock-mode RET
>   Now type this:
>
>    (insert (format-mode-line mode-line-format))
>
>   and press C-j at the rightmost closing parenthesis.
>
> > If I format `mode- line-format' there doesn't seem to be an obvious
> > way to infer the faces that are used to render the various elements.
>
> Go to one of the problematic characters and type "C-u C-x =".  Emacs
> will then show the font it used to display that character.

Thanks, the part I was missing is `insert'.

However, this doen't seem to work.  Whatever my mode line looks like,
the inserted text always look plain (font lock is on).  For example if I set

    (set-face-attribute 'mode-line-buffer-id nil :font "8x13" :foreground nil)

The buffer id in the mode line displays red, but when I execute

    (insert (format-mode-line mode-line-format))

In *scratch* I get the contents of the mode line rendered with normal
font.

Francesco



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

* Re: Font in mode line
  2013-11-26 21:22 Francesco Mazzoli
@ 2013-11-27  3:45 ` Eli Zaretskii
  2013-11-27 18:47   ` Francesco Mazzoli
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2013-11-27  3:45 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 26 Nov 2013 22:22:59 +0100
> From: Francesco Mazzoli <f@mazzo.li>
> 
> >   C-x b *scratch* RET
> >   M-x font-lock-mode RET
> >   Now type this:
> >
> >    (insert (format-mode-line mode-line-format))
> >
> >   and press C-j at the rightmost closing parenthesis.
> >
> > > If I format `mode- line-format' there doesn't seem to be an obvious
> > > way to infer the faces that are used to render the various elements.
> >
> > Go to one of the problematic characters and type "C-u C-x =".  Emacs
> > will then show the font it used to display that character.
> 
> Thanks, the part I was missing is `insert'.
> 
> However, this doen't seem to work.  Whatever my mode line looks like,
> the inserted text always look plain (font lock is on).
                                       ^^^^^^^^^^^^^^^
That's why I said to type "M-x font-lock-mode RET" -- this turns OFF
font lock.  If you don't do that, font-lock removes the font text
properties from the inserted text, and you don't see them.  Please
don't skip anything in those steps, they are all important.



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

* Re: Font in mode line
  2013-11-27  3:45 ` Eli Zaretskii
@ 2013-11-27 18:47   ` Francesco Mazzoli
  2013-11-27 23:10     ` Peter Dyballa
  0 siblings, 1 reply; 11+ messages in thread
From: Francesco Mazzoli @ 2013-11-27 18:47 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz <at> gnu.org> writes:
> That's why I said to type "M-x font-lock-mode RET" -- this turns OFF
> font lock.  If you don't do that, font-lock removes the font text
> properties from the inserted text, and you don't see them.  Please
> don't skip anything in those steps, they are all important.

Oh, sorry, I did follow your steps but while trying I must have turned font-
lock off and then on again.

So, with font-lock off, I find out that the used font (for example for the 
buffer-id) is:

                  display: by this font (glyph code)
        xft:-Misc-Fixed-normal-normal-normal-ja-13-*-*-*-c-120-iso10646-1 
(#x43)

While the `mode-line-buffer-id' face (referenced in the same screen given by 
`C-u C-x =') lists

    Font: #<font-object -misc-fixed-medium-r-normal--13-120-75-75-c-80-
iso8859-1>

So the two seem to be different.  If I set the font explicitly using a 
string from `xfontsel', for example

    (set-face-attribute 'mode-line-buffer-id nil :font "-misc-fixed-medium-
r-normal--13-120-75-75-c-80-iso10646-1")

I still get the same glyph when actually inspecting the font with `C-u C-x 
='.

What are the circumstances where the font for some text is different from 
the font specified by its face?

Thanks again,
Francesco





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

* Re: Font in mode line
  2013-11-27 18:47   ` Francesco Mazzoli
@ 2013-11-27 23:10     ` Peter Dyballa
  2013-11-28  0:30       ` Francesco Mazzoli
       [not found]       ` <mailman.7301.1385598665.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Peter Dyballa @ 2013-11-27 23:10 UTC (permalink / raw)
  To: Francesco Mazzoli; +Cc: help-gnu-emacs


Am 27.11.2013 um 19:47 schrieb Francesco Mazzoli:

>        xft:-Misc-Fixed-normal-normal-normal-ja-13-*-*-*-c-120-iso10646-1 
> (#x43)
> 
> While the `mode-line-buffer-id' face (referenced in the same screen given by 
> `C-u C-x =') lists
> 
>    Font: #<font-object -misc-fixed-medium-r-normal--13-120-75-75-c-80-
> iso8859-1>

These two fonts are the same. Their foundry is "[Mm]isc" (not determined, could be X Consortium/X.Org), their family name is the same: "[Ff]ixed". Their weight is also the same, normal  is medium. What makes a difference is the value of "ja" (for Japanese) in the field for additional typographic styles. This makes sense in combination with the ISO 10646-1 (or Unicode) font encoding. It is possible that this setting, "ja", reserves a bit too big cells for the characters, cells into which Japanese could fit (which a bit bigger than those for Latin scripts). The setting for average width (120 vs. 80, i.e. wide vs. compact) confirms this. GNU Emacs 24.x seems to love Japanese…

--
Greetings

  Pete       (:
        _    / __    -    -
      _/ \__/_/        -     -
     (´`)      (´`)   -    -
      `´        `´




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

* Re: Font in mode line
  2013-11-27 23:10     ` Peter Dyballa
@ 2013-11-28  0:30       ` Francesco Mazzoli
       [not found]       ` <mailman.7301.1385598665.10748.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 11+ messages in thread
From: Francesco Mazzoli @ 2013-11-28  0:30 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

On 28 November 2013 00:10, Peter Dyballa <Peter_Dyballa@web.de> wrote:
> These two fonts are the same. Their foundry is "[Mm]isc" (not determined, could be X Consortium/X.Org), their family name is the same: "[Ff]ixed". Their weight is also the same, normal  is medium. What makes a difference is the value of "ja" (for Japanese) in the field for additional typographic styles. This makes sense in combination with the ISO 10646-1 (or Unicode) font encoding. It is possible that this setting, "ja", reserves a bit too big cells for the characters, cells into which Japanese could fit (which a bit bigger than those for Latin scripts). The setting for average width (120 vs. 80, i.e. wide vs. compact) confirms this. GNU Emacs 24.x seems to love Japanese…

What I don't understand is this font change (in this case in terms of
typographic style) happens only in the mode-line faces.  To make it
clear again, I use that font successfully elsewhere (e.g. in the
`default' face).

Francesco



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

* Re: Font in mode line
       [not found]       ` <mailman.7301.1385598665.10748.help-gnu-emacs@gnu.org>
@ 2013-12-03 14:32         ` Jason Rumney
  2013-12-03 20:48           ` Francesco Mazzoli
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Rumney @ 2013-12-03 14:32 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, 28 November 2013 08:30:47 UTC+8, Francesco Mazzoli  wrote:

> What I don't understand is this font change (in this case in terms of
> typographic style) happens only in the mode-line faces.  To make it
> clear again, I use that font successfully elsewhere (e.g. in the
> `default' face).

I think the default face prefers Latin fonts (other scripts are pulled in by the default fontset rules).  Probably if the default font is set first, mode-line face subsequently prefers the font that is already loaded over one that is not, but otherwise it seems it is not prefering latin fonts in the same way the default face does, so it takes the first one it sees (which may be as simple as medium coming alphabetically before normal, or it may be to do with paths where the fonts are found or the backend that is serving them).


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

* Re: Font in mode line
  2013-12-03 14:32         ` Jason Rumney
@ 2013-12-03 20:48           ` Francesco Mazzoli
  0 siblings, 0 replies; 11+ messages in thread
From: Francesco Mazzoli @ 2013-12-03 20:48 UTC (permalink / raw)
  To: help-gnu-emacs

Jason Rumney <jasonrumney <at> gmail.com> writes:

> 
> On Thursday, 28 November 2013 08:30:47 UTC+8, Francesco Mazzoli  wrote:
> 
> > What I don't understand is this font change (in this case in terms of
> > typographic style) happens only in the mode-line faces.  To make it
> > clear again, I use that font successfully elsewhere (e.g. in the
> > `default' face).
> 
> I think the default face prefers Latin fonts (other scripts are pulled in 
by the default fontset rules). 
> Probably if the default font is set first, mode-line face subsequently 
prefers the font that is already
> loaded over one that is not, but otherwise it seems it is not prefering 
latin fonts in the same way the
> default face does, so it takes the first one it sees (which may be as 
simple as medium coming alphabetically
> before normal, or it may be to do with paths where the fonts are found or 
the backend that is serving them).

Mhm.  So if I set the `default' face to the `8x13' font (what I want for the 
mode line) everything displays fine.  Then I set the mode line faces to 
`8x13' and things keep displaying fine, and `C-u C-x =' displays what you'd 
expect regarding the mode line faces.

Then if I change `default' back to "9x15", the mode line goes to back to the 
"bad" font.  This hints at the fact that this choice between Latin fonts and 
some other script is related to what `default' face, which seems weird.

Moreover, when using the fontset string I'm fully specifying the font...

In any case, where can I find more information on this preference for Latin 
fonts?

Thanks,
Francesco





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

end of thread, other threads:[~2013-12-03 20:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-24 16:15 Font in mode line Francesco Mazzoli
2013-11-24 16:57 ` Eli Zaretskii
2013-11-26 17:26   ` Francesco Mazzoli
2013-11-26 18:11     ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2013-11-26 21:22 Francesco Mazzoli
2013-11-27  3:45 ` Eli Zaretskii
2013-11-27 18:47   ` Francesco Mazzoli
2013-11-27 23:10     ` Peter Dyballa
2013-11-28  0:30       ` Francesco Mazzoli
     [not found]       ` <mailman.7301.1385598665.10748.help-gnu-emacs@gnu.org>
2013-12-03 14:32         ` Jason Rumney
2013-12-03 20:48           ` Francesco Mazzoli

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.