aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2003-01-10 07:25:31 +0000
committerKenichi Handa2003-01-10 07:25:31 +0000
commit5c117135d1746aa558c68da3eb55ca650c29afd3 (patch)
tree22506a7c428cfd7c8642e49dfd7cbea22ce0ba07
parentb94d3b355f3cb13512f84069fe41e3de24fe6427 (diff)
downloademacs-5c117135d1746aa558c68da3eb55ca650c29afd3.tar.gz
emacs-5c117135d1746aa558c68da3eb55ca650c29afd3.zip
(print-fontset-element): New
function. (print-fontset): Use print-fontset-element to print the elements of a fontset. Use it also to print fonts fallen back to the default fontsets.
-rw-r--r--lisp/international/mule-diag.el106
1 files changed, 55 insertions, 51 deletions
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index a128b28bad7..10332ed7810 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -971,62 +971,66 @@ but still contains full information about each coding system."
971 (with-output-to-temp-buffer "*Help*" 971 (with-output-to-temp-buffer "*Help*"
972 (describe-font-internal font-info 'verbose))))) 972 (describe-font-internal font-info 'verbose)))))
973 973
974(defun print-fontset (fontset &optional print-fonts) 974(defun print-fontset-element (val)
975 ;; VAL has this format:
976 ;; ((REQUESTED-FONT-NAME OPENED-FONT-NAME ...) ...)
977 ;; CHAR RANGE is already inserted. Get character codes from
978 ;; the current line.
979 (beginning-of-line)
980 (let ((from (following-char))
981 (to (if (looking-at "[^.]*[.]* ")
982 (char-after (match-end 0)))))
983 (if (re-search-forward "[ \t]*$" nil t)
984 (delete-region (match-beginning 0) (match-end 0)))
985
986 ;; For non-ASCII characters, insert also CODE RANGE.
987 (if (or (>= from 128) (and to (>= to 128)))
988 (if to
989 (insert (format " (#x%02X .. #x%02X)" from to))
990 (insert (format " (#x%02X)" from))))
991
992 ;; Insert a requested font name.
993 (dolist (elt val)
994 (let ((requested (car elt)))
995 (if (stringp requested)
996 (insert "\n " requested)
997 (let ((family (aref requested 0))
998 (registry (aref requested 5)))
999 (if (not family)
1000 (setq family "*-*")
1001 (or (string-match "-" family)
1002 (setq family (concat "*-" family))))
1003 (or (string-match "-" registry)
1004 (= (aref registry (1- (length registry))) ?*)
1005 (setq registry (concat registry "*")))
1006 (insert "\n -" family
1007 ?- (or (aref requested 1) ?*) ; weight
1008 ?- (or (aref requested 2) ?*) ; slant
1009 "-*-" (or (aref requested 3) ?*) ; width
1010 "-*-" (or (aref requested 4) ?*) ; adstyle
1011 "-*-*-*-*-*-*-" registry))))
1012
1013 ;; Insert opened font names (if any).
1014 (if (and (boundp 'print-opened) (symbol-value 'print-opened))
1015 (dolist (opened (cdr elt))
1016 (insert "\n\t[" opened "]"))))))
1017
1018(defun print-fontset (fontset &optional print-opened)
975 "Print information about FONTSET. 1019 "Print information about FONTSET.
976If optional arg PRINT-FONTS is non-nil, also print names of all opened 1020If optional arg PRINT-OPENED is non-nil, also print names of all opened
977fonts for FONTSET. This function actually inserts the information in 1021fonts for FONTSET. This function actually inserts the information in
978the current buffer." 1022the current buffer."
979 (beginning-of-line) 1023 (beginning-of-line)
980 (insert "Fontset: " fontset "\n") 1024 (insert "Fontset: " fontset "\n")
981 (insert "CHAR RANGE (CODE RANGE)\n") 1025 (insert (propertize "CHAR RANGE" 'face 'underline)
982 (insert "-----------------------\n") 1026 " (" (propertize "CODE RANGE" 'face 'underline) ")\n")
983 (insert " FONT NAME (REQUESTED and [OPENED])\n") 1027 (insert " " (propertize "FONT NAME" 'face 'underline)
984 (insert " ----------------------------------") 1028 " (" (propertize "REQUESTED" 'face 'underline)
985 (describe-vector 1029 " and [" (propertize "OPENED" 'face 'underline) "])")
986 (fontset-info fontset) 1030 (let ((info (fontset-info fontset)))
987 #'(lambda (val) 1031 (describe-vector info 'print-fontset-element)
988 ;; VAL has this format: 1032 (insert "\n ---<fallback to the default fontset>---")
989 ;; ((REQUESTED-FONT-NAME OPENED-FONT-NAME ...) ...) 1033 (describe-vector (char-table-extra-slot info 0) 'print-fontset-element)))
990
991 ;; CHAR RANGE is already inserted. Get character codes from
992 ;; the current line.
993 (beginning-of-line)
994 (let ((from (following-char))
995 (to (if (looking-at "[^.]*[.]* ")
996 (char-after (match-end 0)))))
997 (if (re-search-forward "[ \t]*$" nil t)
998 (delete-region (match-beginning 0) (match-end 0)))
999
1000 ;; For non-ASCII characters, insert also CODE RANGE.
1001 (if (>= from 128)
1002 (if to
1003 (insert (format "\t(#x%02X .. #x%02X)" from to))
1004 (insert (format "\t(#x%02X)" from))))
1005
1006 ;; Insert a requested font name.
1007 (dolist (elt val)
1008 (let ((requested (car elt)))
1009 (if (stringp requested)
1010 (insert "\n " requested)
1011 (let ((family (aref requested 0))
1012 (registry (aref requested 5)))
1013 (if (not family)
1014 (setq family "*-*")
1015 (or (string-match "-" family)
1016 (setq family (concat "*-" family))))
1017 (or (string-match "-" registry)
1018 (= (aref registry (1- (length registry))) ?*)
1019 (setq registry (concat registry "*")))
1020 (insert "\n -" family
1021 ?- (or (aref requested 1) ?*) ; weight
1022 ?- (or (aref requested 2) ?*) ; slant
1023 "-*-" (or (aref requested 3) ?*) ; width
1024 "-*-" (or (aref requested 4) ?*) ; adstyle
1025 "-*-*-*-*-*-*-" registry))))
1026
1027 ;; Insert opened font names (if any).
1028 (dolist (opened (cdr elt))
1029 (insert "\n\t[" opened "]")))))))
1030 1034
1031;;;###autoload 1035;;;###autoload
1032(defun describe-fontset (fontset) 1036(defun describe-fontset (fontset)