summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoff Voelker <voelker@cs.washington.edu>1998-11-04 23:38:19 +0000
committerGeoff Voelker <voelker@cs.washington.edu>1998-11-04 23:38:19 +0000
commit396594fed9456408318f0df81e13ba35ca7ab766 (patch)
treeaeb9c0bb34109e5c75a41768055a6285f4165856
parent4664455c17f5a67c3a9638add7dfe2182a339717 (diff)
downloademacs-396594fed9456408318f0df81e13ba35ca7ab766.tar.gz
(w32_list_fonts): Report an error if a frame has not
been created yet.
-rw-r--r--src/w32fns.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index d269214b9ae..2765c7bbb03 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5125,6 +5125,24 @@ w32_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames )
Lisp_Object patterns, key, tem;
Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil;
+ /* If we don't have a frame, we can't use the Windows API to list
+ fonts, as it requires a device context for the Window. This will
+ only happen during startup if the user specifies a font on the
+ command line. Print a message on stderr and return nil. */
+ if (!f)
+ {
+ char buffer[256];
+
+ sprintf (buffer,
+ "Emacs cannot get a list of fonts before the initial frame "
+ "is created.\nThe font specified on the command line may not "
+ "be found.\n");
+ MessageBox (NULL, buffer, "Emacs Warning Dialog",
+ MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);
+ return Qnil;
+ }
+
+
patterns = Fassoc (pattern, Valternate_fontname_alist);
if (NILP (patterns))
patterns = Fcons (pattern, Qnil);