diff options
| author | Eli Zaretskii | 2014-12-18 18:07:26 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2014-12-18 18:07:26 +0200 |
| commit | b1978229162b0d4c3b14d8ad8bff383eb3511969 (patch) | |
| tree | d441fe077f75d8b962a24536edcc09f7af65a26d /lisp | |
| parent | 687ae680bd12b0353e313808253e7a07c0828ebe (diff) | |
| download | emacs-b1978229162b0d4c3b14d8ad8bff383eb3511969.tar.gz emacs-b1978229162b0d4c3b14d8ad8bff383eb3511969.zip | |
Allow querying font by name for its height and other info. (Bug#19395)
src/font.c (Ffont_info): Add more font information to the vector
returned by the function, inspired by query-font. Doc fix.
doc/lispref/display.texi (Low-Level Font): Document font-info and query-font.
lisp/international/mule-diag.el (describe-font-internal): Display
additional info returned by font-info.
lisp/linum.el (linum--face-width): Rename from linum--face-height,
and use the new functionality of font-info.
(linum-update-window): Use linum--face-width and frame-char-width,
instead of approximating with height.
etc/NEWS: Mention the enhancement in font-info.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/international/mule-diag.el | 10 | ||||
| -rw-r--r-- | lisp/linum.el | 15 |
3 files changed, 28 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 89a92f6454f..cb8348e1d51 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-12-18 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * international/mule-diag.el (describe-font-internal): Display | ||
| 4 | additional info returned by font-info. | ||
| 5 | |||
| 6 | * linum.el (linum--face-width): Rename from linum--face-height, | ||
| 7 | and use the new functionality of font-info. | ||
| 8 | (linum-update-window): Use linum--face-width and frame-char-width, | ||
| 9 | instead of approximating with height. | ||
| 10 | |||
| 1 | 2014-12-18 Dmitry Gutov <dgutov@yandex.ru> | 11 | 2014-12-18 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 12 | ||
| 3 | * vc/vc-svn.el (vc-svn-dir-status-files): Revert the 2014-12-02 | 13 | * vc/vc-svn.el (vc-svn-dir-status-files): Revert the 2014-12-02 |
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 13a178531bc..ead2decb771 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el | |||
| @@ -825,10 +825,18 @@ but still contains full information about each coding system." | |||
| 825 | The IGNORED argument is ignored." | 825 | The IGNORED argument is ignored." |
| 826 | (print-list "name (opened by):" (aref font-info 0)) | 826 | (print-list "name (opened by):" (aref font-info 0)) |
| 827 | (print-list " full name:" (aref font-info 1)) | 827 | (print-list " full name:" (aref font-info 1)) |
| 828 | (and (aref font-info 12) | ||
| 829 | (print-list " file name:" (aref font-info 12))) | ||
| 828 | (print-list " size:" (format "%2d" (aref font-info 2))) | 830 | (print-list " size:" (format "%2d" (aref font-info 2))) |
| 829 | (print-list " height:" (format "%2d" (aref font-info 3))) | 831 | (print-list " height:" (format "%2d" (aref font-info 3))) |
| 830 | (print-list " baseline-offset:" (format "%2d" (aref font-info 4))) | 832 | (print-list " baseline-offset:" (format "%2d" (aref font-info 4))) |
| 831 | (print-list "relative-compose:" (format "%2d" (aref font-info 5)))) | 833 | (print-list "relative-compose:" (format "%2d" (aref font-info 5))) |
| 834 | (print-list " default-ascent:" (format "%2d" (aref font-info 6))) | ||
| 835 | (print-list " ascent:" (format "%2d" (aref font-info 8))) | ||
| 836 | (print-list " descent:" (format "%2d" (aref font-info 9))) | ||
| 837 | (print-list " average-width:" (format "%2d" (aref font-info 11))) | ||
| 838 | (print-list " space-width:" (format "%2d" (aref font-info 10))) | ||
| 839 | (print-list " max-width:" (format "%2d" (aref font-info 7)))) | ||
| 832 | 840 | ||
| 833 | ;;;###autoload | 841 | ;;;###autoload |
| 834 | (defun describe-font (fontname) | 842 | (defun describe-font (fontname) |
diff --git a/lisp/linum.el b/lisp/linum.el index b13bd8dbbb6..fb2cda6c506 100644 --- a/lisp/linum.el +++ b/lisp/linum.el | |||
| @@ -138,8 +138,13 @@ Linum mode is a buffer-local minor mode." | |||
| 138 | (mapc #'delete-overlay linum-available) | 138 | (mapc #'delete-overlay linum-available) |
| 139 | (setq linum-available nil)))) | 139 | (setq linum-available nil)))) |
| 140 | 140 | ||
| 141 | (defun linum--face-height (face) | 141 | (defun linum--face-width (face) |
| 142 | (aref (font-info (face-font face)) 2)) | 142 | (let ((info (font-info (face-font face))) |
| 143 | width) | ||
| 144 | (setq width (aref info 11)) | ||
| 145 | (if (<= width 0) | ||
| 146 | (setq width (aref info 10))) | ||
| 147 | width)) | ||
| 143 | 148 | ||
| 144 | (defun linum-update-window (win) | 149 | (defun linum-update-window (win) |
| 145 | "Update line numbers for the portion visible in window WIN." | 150 | "Update line numbers for the portion visible in window WIN." |
| @@ -183,10 +188,8 @@ Linum mode is a buffer-local minor mode." | |||
| 183 | (setq line (1+ line))) | 188 | (setq line (1+ line))) |
| 184 | (when (display-graphic-p) | 189 | (when (display-graphic-p) |
| 185 | (setq width (ceiling | 190 | (setq width (ceiling |
| 186 | ;; We'd really want to check the widths rather than the | 191 | (/ (* width 1.0 (linum--face-width 'linum)) |
| 187 | ;; heights, but it's a start. | 192 | (frame-char-width))))) |
| 188 | (/ (* width 1.0 (linum--face-height 'linum)) | ||
| 189 | (frame-char-height))))) | ||
| 190 | (set-window-margins win width (cdr (window-margins win))))) | 193 | (set-window-margins win width (cdr (window-margins win))))) |
| 191 | 194 | ||
| 192 | (defun linum-after-change (beg end _len) | 195 | (defun linum-after-change (beg end _len) |