Subject: bug#14648: 24.3.50; `font' frame parameter bizarreness

From: Drew Adams <[email-masked]>
Date: Mon, 17 Jun 2013 22:49:09 -0700 (PDT)

emacs -Q

(modify-frame-parameters
  (selected-frame)
  '((font . "-outline-Gabriola-normal-normal-normal-decorative")))

Note that the font string here is not a valid XFLD, but it has the first
6 fields of a valid XFLD.  If it were suffixed by "-*-*-*-*-*-*-*-*"
then the value would be a valid XFLD (and the bug described below would
not be realized - things work correctly).

The font of the frame is indeed changed, but not to the font specified,
and not to the default font either (e.g., the font for face `default').

(frame-parameter nil 'font) =>
"-outline-Arial-normal-normal-normal-sans-20-*-*-*-p-*-iso8859-1"

What's that?  The doc says nothing about this bizarre behavior.
Where did this font come from?

The doc ((elisp) `Font and Color Parameters') says that the `font'
parameter value:

 "is a string, either a valid font name for your system or the name of
  an Emacs fontset (*note Fontsets::).  It is equivalent to the `font'
  attribute of the `default' face."

IOW, it must be valid.  The doc does not specify what happens if it is
not valid, but it should.

And if you provide an invalid string such as just "foobar" as the `font'
parameter value (e.g., in the `modify-frame-parameters' above) then you
do get an Emacs error stating that the font name is not valid.  That
presumably is the right behavior for any invalid font name, including
the "...Gabriola..." one used above.

Why do you not get such an error with that invalid font name?
Shouldn't you?  And why do you get the particular (undocumented) font
that you do get.

Why should Emacs modify the frame to give you something other than what
you asked for?  And if it should, then this odd "defaulting" behavior
should be documented.

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-06-17 on ODIEONE
Bzr revision: 113024 [email-masked]
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 CFLAGS=-O0 -g3 LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'