diff options
| author | Lars Ingebrigtsen | 2019-11-03 16:33:15 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-11-03 16:33:15 +0100 |
| commit | 5c8375bd681a7819e536dda84d63fb950595967d (patch) | |
| tree | dd06b92d4f99b6c22075ca9c70a76e0bf532abe9 | |
| parent | ba8a7882de5bbdb39c9c1d74297a9613aa28463f (diff) | |
| download | emacs-5c8375bd681a7819e536dda84d63fb950595967d.tar.gz emacs-5c8375bd681a7819e536dda84d63fb950595967d.zip | |
describe-font/font-info works with unloaded fonts
* lisp/international/mule-diag.el (describe-font): This function
can be used on unloaded fonts, so remove that restriction from the
doc string (bug#16815). Also allow completion over all fonts on
the system.
* src/font.c (Ffont_info): Ditto for the doc string.
| -rw-r--r-- | lisp/international/mule-diag.el | 18 | ||||
| -rw-r--r-- | src/font.c | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index dcdcafcea77..c4122c92716 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el | |||
| @@ -835,9 +835,16 @@ The IGNORED argument is ignored." | |||
| 835 | 835 | ||
| 836 | ;;;###autoload | 836 | ;;;###autoload |
| 837 | (defun describe-font (fontname) | 837 | (defun describe-font (fontname) |
| 838 | "Display information about a font whose name is FONTNAME. | 838 | "Display information about a font whose name is FONTNAME." |
| 839 | The font must be already used by Emacs." | 839 | (interactive |
| 840 | (interactive "sFont name (default current choice for ASCII chars): ") | 840 | (list (completing-read |
| 841 | "Font name (default current choice for ASCII chars): " | ||
| 842 | (and window-system | ||
| 843 | (fboundp 'fontset-list) | ||
| 844 | ;; The final element in `fontset-list' is a default | ||
| 845 | ;; (generic) one, so don't include that. | ||
| 846 | (nconc (butlast (fontset-list)) | ||
| 847 | (x-list-fonts "*")))))) | ||
| 841 | (or (and window-system (fboundp 'fontset-list)) | 848 | (or (and window-system (fboundp 'fontset-list)) |
| 842 | (error "No fonts being used")) | 849 | (error "No fonts being used")) |
| 843 | (let ((xref-item (list #'describe-font fontname)) | 850 | (let ((xref-item (list #'describe-font fontname)) |
| @@ -847,9 +854,8 @@ The font must be already used by Emacs." | |||
| 847 | (setq font-info (font-info fontname)) | 854 | (setq font-info (font-info fontname)) |
| 848 | (if (null font-info) | 855 | (if (null font-info) |
| 849 | (if (fontp fontname 'font-object) | 856 | (if (fontp fontname 'font-object) |
| 850 | ;; The font should be surely used. So, there's some | 857 | ;; If there's some problem with getting information about |
| 851 | ;; problem about getting information about it. It is | 858 | ;; the font, print the font name to show which font has |
| 852 | ;; better to print the fontname to show which font has | ||
| 853 | ;; this problem. | 859 | ;; this problem. |
| 854 | (message "No information about \"%s\"" (font-xlfd-name fontname)) | 860 | (message "No information about \"%s\"" (font-xlfd-name fontname)) |
| 855 | (message "No matching font found")) | 861 | (message "No matching font found")) |
diff --git a/src/font.c b/src/font.c index 7fdadb17c14..156107e5897 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -5127,9 +5127,7 @@ where | |||
| 5127 | FEATURE is a symbol representing OpenType feature tag. | 5127 | FEATURE is a symbol representing OpenType feature tag. |
| 5128 | 5128 | ||
| 5129 | If the font is not an OpenType font, there are no elements | 5129 | If the font is not an OpenType font, there are no elements |
| 5130 | in CAPABILITY except the font format symbol. | 5130 | in CAPABILITY except the font format symbol. */) |
| 5131 | |||
| 5132 | If the named font is not yet loaded, return nil. */) | ||
| 5133 | (Lisp_Object name, Lisp_Object frame) | 5131 | (Lisp_Object name, Lisp_Object frame) |
| 5134 | { | 5132 | { |
| 5135 | struct frame *f; | 5133 | struct frame *f; |