aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorStefan Monnier2019-11-05 15:05:38 -0500
committerStefan Monnier2019-11-05 15:05:38 -0500
commitedec35aa9472dca3a80966c62131f00e5288ee49 (patch)
tree99b9f798ac5d92a75a3fec5fa4b1879713e7437b /admin
parentec5433f676035a5ad3ad8fcb22884cf0e0c290f6 (diff)
downloademacs-edec35aa9472dca3a80966c62131f00e5288ee49.tar.gz
emacs-edec35aa9472dca3a80966c62131f00e5288ee49.zip
* admin/unidata/uvs.el: Use lexical-binding
Diffstat (limited to 'admin')
-rw-r--r--admin/unidata/uvs.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/admin/unidata/uvs.el b/admin/unidata/uvs.el
index dfea4796528..2d0f92422bb 100644
--- a/admin/unidata/uvs.el
+++ b/admin/unidata/uvs.el
@@ -1,4 +1,4 @@
1;;; uvs.el --- utility for UVS (format 14) cmap subtables in OpenType fonts. 1;;; uvs.el --- utility for UVS (format 14) cmap subtables in OpenType fonts -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2014-2019 Free Software Foundation, Inc. 3;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
4 4
@@ -30,7 +30,7 @@
30;;; Code: 30;;; Code:
31 31
32(defun uvs-fields-total-size (fields) 32(defun uvs-fields-total-size (fields)
33 (apply '+ (mapcar (lambda (field) (get field 'uvs-field-size)) fields))) 33 (apply #'+ (mapcar (lambda (field) (get field 'uvs-field-size)) fields)))
34 34
35;;; Fields in Format 14 header. 35;;; Fields in Format 14 header.
36(defconst uvs-format-14-header-fields 36(defconst uvs-format-14-header-fields
@@ -85,7 +85,8 @@ where selectors and bases are sorted in ascending order."
85 "\\(?:" (regexp-quote collection-id) "\\)" 85 "\\(?:" (regexp-quote collection-id) "\\)"
86 "[[:blank:]]*;[[:blank:]]*" 86 "[[:blank:]]*;[[:blank:]]*"
87 "\\([^\n[:blank:]]+\\)" 87 "\\([^\n[:blank:]]+\\)"
88 "[[:blank:]]*$") nil t) 88 "[[:blank:]]*$")
89 nil t)
89 (let* ((base (string-to-number (match-string 1) 16)) 90 (let* ((base (string-to-number (match-string 1) 16))
90 (selector (string-to-number (match-string 2) 16)) 91 (selector (string-to-number (match-string 2) 16))
91 (sequence-id (match-string 3)) 92 (sequence-id (match-string 3))
@@ -105,7 +106,7 @@ where selectors and bases are sorted in ascending order."
105 "Convert integer VALUE to a list of SIZE bytes. 106 "Convert integer VALUE to a list of SIZE bytes.
106The most significant byte comes first." 107The most significant byte comes first."
107 (let (result) 108 (let (result)
108 (dotimes (i size) 109 (dotimes (_ size)
109 (push (logand value #xff) result) 110 (push (logand value #xff) result)
110 (setq value (ash value -8))) 111 (setq value (ash value -8)))
111 result)) 112 result))
@@ -118,7 +119,7 @@ respectively. Byte length of each value is determined by the
118 (while fields 119 (while fields
119 (let ((field (car fields)) 120 (let ((field (car fields))
120 (value (car values))) 121 (value (car values)))
121 (insert (apply 'unibyte-string 122 (insert (apply #'unibyte-string
122 (uvs-int-to-bytes value (get field 'uvs-field-size)))) 123 (uvs-int-to-bytes value (get field 'uvs-field-size))))
123 (setq fields (cdr fields) values (cdr values))))) 124 (setq fields (cdr fields) values (cdr values)))))
124 125
@@ -126,9 +127,9 @@ respectively. Byte length of each value is determined by the
126 "Insert UVS-ALIST as a sequence of bytes to the current buffer." 127 "Insert UVS-ALIST as a sequence of bytes to the current buffer."
127 (let* ((nrecords (length uvs-alist)) ; # of selectors 128 (let* ((nrecords (length uvs-alist)) ; # of selectors
128 (total-nmappings 129 (total-nmappings
129 (apply '+ (mapcar 130 (apply #'+ (mapcar
130 (lambda (selector-bgs) (length (cdr selector-bgs))) 131 (lambda (selector-bgs) (length (cdr selector-bgs)))
131 uvs-alist))) 132 uvs-alist)))
132 (non-default-offset 133 (non-default-offset
133 (+ uvs-format-14-header-size 134 (+ uvs-format-14-header-size
134 (* uvs-variation-selector-record-size nrecords)))) 135 (* uvs-variation-selector-record-size nrecords))))
@@ -158,15 +159,15 @@ respectively. Byte length of each value is determined by the
158 (car base-glyph) 159 (car base-glyph)
159 (cdr base-glyph)))))) 160 (cdr base-glyph))))))
160 161
161(defun uvs-dump (&optional bytes-per-line separator separator-eol line-prefix) 162(defun uvs-dump (&optional bytes-per-line separator separator-eol bol-prefix)
162 "Print the current buffer as in representation of C array contents." 163 "Print the current buffer as in representation of C array contents."
163 (or bytes-per-line (setq bytes-per-line 8)) 164 (or bytes-per-line (setq bytes-per-line 8))
164 (or separator (setq separator ", ")) 165 (or separator (setq separator ", "))
165 (or separator-eol (setq separator-eol ",")) 166 (or separator-eol (setq separator-eol ","))
166 (or line-prefix (setq line-prefix " ")) 167 (or bol-prefix (setq bol-prefix " "))
167 (goto-char (point-min)) 168 (goto-char (point-min))
168 (while (> (- (point-max) (point)) bytes-per-line) 169 (while (> (- (point-max) (point)) bytes-per-line)
169 (princ line-prefix) 170 (princ bol-prefix)
170 (princ (mapconcat (lambda (byte) (format "0x%02x" byte)) 171 (princ (mapconcat (lambda (byte) (format "0x%02x" byte))
171 (string-to-unibyte 172 (string-to-unibyte
172 (buffer-substring (point) (+ (point) bytes-per-line))) 173 (buffer-substring (point) (+ (point) bytes-per-line)))
@@ -174,7 +175,7 @@ respectively. Byte length of each value is determined by the
174 (princ separator-eol) 175 (princ separator-eol)
175 (terpri) 176 (terpri)
176 (forward-char bytes-per-line)) 177 (forward-char bytes-per-line))
177 (princ line-prefix) 178 (princ bol-prefix)
178 (princ (mapconcat (lambda (byte) (format "0x%02x" byte)) 179 (princ (mapconcat (lambda (byte) (format "0x%02x" byte))
179 (string-to-unibyte 180 (string-to-unibyte
180 (buffer-substring (point) (point-max))) 181 (buffer-substring (point) (point-max)))