unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* sans-serif name change
@ 2008-06-25  1:06 Miles Bader
  2008-06-25  9:22 ` Andreas Schwab
  0 siblings, 1 reply; 15+ messages in thread
From: Miles Bader @ 2008-06-25  1:06 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

Why the following change?  At least according to debian's
font-infrastructure, "Sans-Serif" is the canonical name...

   2008-06-25  Andreas Schwab  <schwab@suse.de>

           * faces.el (face-font-family-alternatives, variable-pitch): Use
           "Sans Serif", not "Sans-Serif".

Thanks,

-Miles

-- 
Happiness, n. An agreeable sensation arising from contemplating the misery of
another.




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

* Re: sans-serif name change
  2008-06-25  1:06 sans-serif name change Miles Bader
@ 2008-06-25  9:22 ` Andreas Schwab
  2008-06-25  9:32   ` Miles Bader
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2008-06-25  9:22 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

> Why the following change?  At least according to debian's
> font-infrastructure, "Sans-Serif" is the canonical name...

Have you tried it?  Sans-Serif does not work.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: sans-serif name change
  2008-06-25  9:22 ` Andreas Schwab
@ 2008-06-25  9:32   ` Miles Bader
  2008-06-25  9:45     ` Andreas Schwab
  2008-06-25 10:10     ` Jason Rumney
  0 siblings, 2 replies; 15+ messages in thread
From: Miles Bader @ 2008-06-25  9:32 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

Andreas Schwab <schwab@suse.de> writes:
>> Why the following change?  At least according to debian's
>> font-infrastructure, "Sans-Serif" is the canonical name...
>
> Have you tried it?  Sans-Serif does not work.

I've just tried both, and see the following:

  (set-frame-font "Sans-Serif-10")

works fine, but:

  (set-face-attribute 'variable-pitch nil :family "Sans-Serif")

does not (it uses some random font instead); using "Sans Serif" does
work with set-face-attribute.

So it looks like there's a bug somewhere (but we should fix that, not
kludge around it).

-Miles

-- 
Yo mama's so fat when she gets on an elevator it HAS to go down.




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

* Re: sans-serif name change
  2008-06-25  9:32   ` Miles Bader
@ 2008-06-25  9:45     ` Andreas Schwab
  2008-06-25 10:33       ` James Cloos
  2008-06-25 13:19       ` Miles Bader
  2008-06-25 10:10     ` Jason Rumney
  1 sibling, 2 replies; 15+ messages in thread
From: Andreas Schwab @ 2008-06-25  9:45 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles.bader@necel.com> writes:

> So it looks like there's a bug somewhere (but we should fix that, not
> kludge around it).

Ypu cannot use a dash in a font name in XFT.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: sans-serif name change
  2008-06-25  9:32   ` Miles Bader
  2008-06-25  9:45     ` Andreas Schwab
@ 2008-06-25 10:10     ` Jason Rumney
  2008-06-25 11:36       ` Kenichi Handa
  1 sibling, 1 reply; 15+ messages in thread
From: Jason Rumney @ 2008-06-25 10:10 UTC (permalink / raw)
  To: Miles Bader; +Cc: Andreas Schwab, emacs-devel

Miles Bader wrote:

>   (set-face-attribute 'variable-pitch nil :family "Sans-Serif")
> 
> does not (it uses some random font instead); using "Sans Serif" does
> work with set-face-attribute.
> 
> So it looks like there's a bug somewhere (but we should fix that, not
> kludge around it).

My guess is that the `-' in Sans-Serif is being treated as a separator
character, and causes Emacs to look for a font called Serif with the
foundry Sans, or something similar.





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

* Re: sans-serif name change
  2008-06-25  9:45     ` Andreas Schwab
@ 2008-06-25 10:33       ` James Cloos
  2008-06-25 13:19       ` Miles Bader
  1 sibling, 0 replies; 15+ messages in thread
From: James Cloos @ 2008-06-25 10:33 UTC (permalink / raw)
  To: emacs-devel; +Cc: Andreas Schwab, Chong Yidong, Miles Bader

>>>>> "Andreas" == Andreas Schwab <schwab@suse.de> writes:

Andreas> You cannot use a dash in a font name in XFT.

Since I posted the note that Sans-Serif is the canonical name for the
fontconfig alias:

I forgot that point.  Fontconfig backslash-escapes dashes in font names
in the output of command such as fc-cat, fc-list, fc-match.  Using a
space, though, probably triggers the GTK fontname path.

So emacs should probably ignore that the canonical name is Sans-Serif
and go back to using Sans, in the hope that that alias will remain in
the shipped fontconfig configs.

Sorry for the time waste!

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6




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

* Re: sans-serif name change
  2008-06-25 10:10     ` Jason Rumney
@ 2008-06-25 11:36       ` Kenichi Handa
  2008-06-25 14:00         ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Kenichi Handa @ 2008-06-25 11:36 UTC (permalink / raw)
  To: Jason Rumney; +Cc: schwab, emacs-devel, miles

In article <4862198F.4060305@gnu.org>, Jason Rumney <jasonr@gnu.org> writes:

> My guess is that the `-' in Sans-Serif is being treated as a separator
> character, and causes Emacs to look for a font called Serif with the
> foundry Sans, or something similar.

Yes.  I didn't change that behaviour for backward
compatibility, but as face has the attribute :foundy now, it
may be ok to break that compatibility.

The parsing of XXX-YYY as FOUNDRY-FAMILY is now done in
the function set-face-attribute as this:

	(if (and (eq (car args) :family)
		 (stringp (cadr args))
		 (string-match "\\([^-]*\\)-\\([^-]*\\)" (cadr args)))
	    (let ((foundry (match-string 1 (cadr args)))
		  (family (match-string 2 (cadr args))))
	      (internal-set-lisp-face-attribute face :foundry
						(purecopy foundry)
						where)
	      (internal-set-lisp-face-attribute face :family
						(purecopy family)
						where))
	  (internal-set-lisp-face-attribute face (car args)
					    (purecopy (cadr args))
					    where)))

---
Kenichi Handa
handa@ni.aist.go.jp




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

* Re: sans-serif name change
  2008-06-25  9:45     ` Andreas Schwab
  2008-06-25 10:33       ` James Cloos
@ 2008-06-25 13:19       ` Miles Bader
  2008-06-25 13:26         ` Andreas Schwab
  1 sibling, 1 reply; 15+ messages in thread
From: Miles Bader @ 2008-06-25 13:19 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

Andreas Schwab <schwab@suse.de> writes:
>> So it looks like there's a bug somewhere (but we should fix that, not
>> kludge around it).
>
> Ypu cannot use a dash in a font name in XFT.

Eh?  Clearly you can, as (1) `set-frame-font' works properly with
"Sans-Serif", and (2) `set-frame-attribute' works properly as well, once
the hack in the lisp code (of set-frame-attribute, which Kenichi
described) is removed.

-Miles

-- 
Monday, n. In Christian countries, the day after the baseball game.




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

* Re: sans-serif name change
  2008-06-25 13:19       ` Miles Bader
@ 2008-06-25 13:26         ` Andreas Schwab
  2008-06-25 13:35           ` Miles Bader
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2008-06-25 13:26 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

> Andreas Schwab <schwab@suse.de> writes:
>>> So it looks like there's a bug somewhere (but we should fix that, not
>>> kludge around it).
>>
>> Ypu cannot use a dash in a font name in XFT.
>
> Eh?  Clearly you can,

Try xfd -fa "Sans-Serif-8" and compare that with xfd -fa "Sans Serif-8".

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: sans-serif name change
  2008-06-25 13:26         ` Andreas Schwab
@ 2008-06-25 13:35           ` Miles Bader
  2008-06-25 13:54             ` Andreas Schwab
  0 siblings, 1 reply; 15+ messages in thread
From: Miles Bader @ 2008-06-25 13:35 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

Andreas Schwab <schwab@suse.de> writes:
>>>> So it looks like there's a bug somewhere (but we should fix that, not
>>>> kludge around it).
>>>
>>> Ypu cannot use a dash in a font name in XFT.
>>
>> Eh?  Clearly you can,
>
> Try xfd -fa "Sans-Serif-8" and compare that with xfd -fa "Sans Serif-8".

Those commands give different results.

However, in Emacs, they give the same result; try:

   (set-frame-font "Sans Serif-8")

and:

   (set-frame-font "Sans-Serif-8")
   
Result:  same.

So the font-parser in xfd seems to be broken, whereas one in Emacs is
not.

Since we are discussing Emacs, there would seem to be no problem.

-Miles

-- 
Patience, n. A minor form of despair, disguised as a virtue.




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

* Re: sans-serif name change
  2008-06-25 13:35           ` Miles Bader
@ 2008-06-25 13:54             ` Andreas Schwab
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2008-06-25 13:54 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

> Since we are discussing Emacs, there would seem to be no problem.

Since "Sans Serif" works everywhere (and all other frontends seem to be
using dash-less names) it should be preferred, IMHO.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: sans-serif name change
  2008-06-25 11:36       ` Kenichi Handa
@ 2008-06-25 14:00         ` Stefan Monnier
  2008-06-27  7:21           ` Kenichi Handa
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2008-06-25 14:00 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: miles, schwab, emacs-devel, Jason Rumney

>> My guess is that the `-' in Sans-Serif is being treated as a separator
>> character, and causes Emacs to look for a font called Serif with the
>> foundry Sans, or something similar.

> Yes.  I didn't change that behaviour for backward
> compatibility, but as face has the attribute :foundy now, it
> may be ok to break that compatibility.

> The parsing of XXX-YYY as FOUNDRY-FAMILY is now done in
> the function set-face-attribute as this:

> 	(if (and (eq (car args) :family)
> 		 (stringp (cadr args))
> 		 (string-match "\\([^-]*\\)-\\([^-]*\\)" (cadr args)))
> 	    (let ((foundry (match-string 1 (cadr args)))
> 		  (family (match-string 2 (cadr args))))
> 	      (internal-set-lisp-face-attribute face :foundry
> 						(purecopy foundry)
> 						where)
> 	      (internal-set-lisp-face-attribute face :family
> 						(purecopy family)
> 						where))
> 	  (internal-set-lisp-face-attribute face (car args)
> 					    (purecopy (cadr args))
> 					    where)))

Maybe this "FOUNDRY-FAMILY" fallback code could be moved to the same
code that handles face-font-family-alternatives?


        Stefan




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

* Re: sans-serif name change
  2008-06-25 14:00         ` Stefan Monnier
@ 2008-06-27  7:21           ` Kenichi Handa
  2008-06-27  7:49             ` Miles Bader
  0 siblings, 1 reply; 15+ messages in thread
From: Kenichi Handa @ 2008-06-27  7:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: schwab, emacs-devel, jasonr, miles

In article <jwviqvxk4bq.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > The parsing of XXX-YYY as FOUNDRY-FAMILY is now done in
> > the function set-face-attribute as this:
[...]
> Maybe this "FOUNDRY-FAMILY" fallback code could be moved to the same
> code that handles face-font-family-alternatives?

It can find a font of FOUNDRY and FAMILY, but face
attributes are not updated propery with that change, i.e.
(set-face-attribute 'variable-pitch nil :family "misc-fixed")
(face-attribute 'variable-pitch :family) => "misc-fixed"
(face-attribute 'variable-pitch :foundry) => unspecified

Currently, we have:
(set-face-attribute 'variable-pitch nil :family "misc-fixed")
(face-attribute 'variable-pitch :family) => "fixed"
(face-attribute 'variable-pitch :foundry) => "misc"

And, fontconfig requires `-' in a family name to be escaped
by `\':

% fc-list 'DV-TTSurekh'
% fc-list 'DV\-TTSurekh'
DV\-TTSurekh:style=Normal

So, how about using the same rule for Emacs?

(set-face-attribute 'variable-pitch nil :family "sans\\-serif")

---
Kenichi Handa
handa@ni.aist.go.jp




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

* Re: sans-serif name change
  2008-06-27  7:21           ` Kenichi Handa
@ 2008-06-27  7:49             ` Miles Bader
  2008-06-27  8:12               ` Kenichi Handa
  0 siblings, 1 reply; 15+ messages in thread
From: Miles Bader @ 2008-06-27  7:49 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: schwab, jasonr, Stefan Monnier, emacs-devel

Kenichi Handa <handa@m17n.org> writes:
> And, fontconfig requires `-' in a family name to be escaped
> by `\':
..
> So, how about using the same rule for Emacs?
>
> (set-face-attribute 'variable-pitch nil :family "sans\\-serif")

But currently other places, such as `set-frame-font' seem to work
properly if passed "Sans-Serif" without escaping the "-".  Perhaps some
part of emacs is already adding the backslash?

I think _if_ there are fonts with "-" in their name, requiring the dash
to be escaped will annoy and confuse users, and lead to bug reports.
I don't know how many such fonts there are, of course.

[I'd say just get rid of the old-style foundry-family names; do we
really care?]

-Miles

-- 
My books focus on timeless truths.  -- Donald Knuth




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

* Re: sans-serif name change
  2008-06-27  7:49             ` Miles Bader
@ 2008-06-27  8:12               ` Kenichi Handa
  0 siblings, 0 replies; 15+ messages in thread
From: Kenichi Handa @ 2008-06-27  8:12 UTC (permalink / raw)
  To: Miles Bader; +Cc: schwab, jasonr, monnier, emacs-devel

In article <buo7icb1fnp.fsf@dhapc248.dev.necel.com>, Miles Bader <miles.bader@necel.com> writes:

> Kenichi Handa <handa@m17n.org> writes:
> > And, fontconfig requires `-' in a family name to be escaped
> > by `\':
..
> > So, how about using the same rule for Emacs?
> >
> > (set-face-attribute 'variable-pitch nil :family "sans\\-serif")

> But currently other places, such as `set-frame-font' seem to work
> properly if passed "Sans-Serif" without escaping the "-".  Perhaps some
> part of emacs is already adding the backslash?

No.  In ftfont.c, these names:

  "mono", "monospace", "sans-serif", "sans serif", "sans", "serif"

are specially recognized as generic family names.  In
addition, fontconfig accepts the literal "sans-serif" when
used in the function FcPatternAddString (pat, FC_FAMILY, ...).
Fontconfig requires escaping only on parsing a font name,
and adds escaping on generating a font name.

> I think _if_ there are fonts with "-" in their name, requiring the dash
> to be escaped will annoy and confuse users, and lead to bug reports.
> I don't know how many such fonts there are, of course.

> [I'd say just get rid of the old-style foundry-family names; do we
> really care?]

As I wrote before, I tend to agree with breaking the
backward compatibility here.

---
Kenichi Handa
handa@ni.aist.go.jp




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

end of thread, other threads:[~2008-06-27  8:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25  1:06 sans-serif name change Miles Bader
2008-06-25  9:22 ` Andreas Schwab
2008-06-25  9:32   ` Miles Bader
2008-06-25  9:45     ` Andreas Schwab
2008-06-25 10:33       ` James Cloos
2008-06-25 13:19       ` Miles Bader
2008-06-25 13:26         ` Andreas Schwab
2008-06-25 13:35           ` Miles Bader
2008-06-25 13:54             ` Andreas Schwab
2008-06-25 10:10     ` Jason Rumney
2008-06-25 11:36       ` Kenichi Handa
2008-06-25 14:00         ` Stefan Monnier
2008-06-27  7:21           ` Kenichi Handa
2008-06-27  7:49             ` Miles Bader
2008-06-27  8:12               ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).