comparison lisp/font-menu.el @ 1102:30118fdc4f1f

[xemacs-hg @ 2002-11-12 03:52:23 by stephent] font-menu.el 21.4 synch <87y97zwiof.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Tue, 12 Nov 2002 03:52:24 +0000
parents 79c6ff3eef26
children a1e328407366
comparison
equal deleted inserted replaced
1101:e30625c17fc0 1102:30118fdc4f1f
135 (defvaralias 'font-menu-max-items 'menu-max-items) 135 (defvaralias 'font-menu-max-items 'menu-max-items)
136 (defvaralias 'font-menu-submenu-name-format 'menu-submenu-name-format) 136 (defvaralias 'font-menu-submenu-name-format 'menu-submenu-name-format)
137 137
138 (defvar font-menu-preferred-resolution 138 (defvar font-menu-preferred-resolution
139 (make-specifier-and-init 'generic '((global ((mswindows) . ":") 139 (make-specifier-and-init 'generic '((global ((mswindows) . ":")
140 ((gtk) . "*-*")
140 ((x) . "*-*"))) t) 141 ((x) . "*-*"))) t)
141 "Preferred horizontal and vertical font menu resolution (e.g. \"75:75\").") 142 "Preferred horizontal and vertical font menu resolution (e.g. \"75:75\").")
142 143
143 (defvar font-menu-size-scaling 144 (defvar font-menu-size-scaling
144 (make-specifier-and-init 'integer '((global ((mswindows) . 1) 145 (make-specifier-and-init 'integer '((global ((mswindows) . 1)
146 ((gtk) . 10)
145 ((x) . 10))) t) 147 ((x) . 10))) t)
146 "Scale factor used in defining font sizes.") 148 "Scale factor used in defining font sizes.")
147 149
148 ;; only call XListFonts (and parse) once per device. 150 ;; only call XListFonts (and parse) once per device.
149 ;; ( (device . [parsed-list-fonts family-menu size-menu weight-menu]) ...) 151 ;; ( (device . [parsed-list-fonts family-menu size-menu weight-menu]) ...)
282 ;; (size is measured in 10ths of points.) 284 ;; (size is measured in 10ths of points.)
283 (let* ((dcache (device-fonts-cache)) 285 (let* ((dcache (device-fonts-cache))
284 (font-data (font-menu-font-data 'default dcache)) 286 (font-data (font-menu-font-data 'default dcache))
285 (from-family (aref font-data 1)) 287 (from-family (aref font-data 1))
286 (from-size (aref font-data 2)) 288 (from-size (aref font-data 2))
287 (from-weight (aref font-data 3)) 289 (from-weight (aref font-data 3))
288 (from-slant (aref font-data 4)) 290 (from-slant (aref font-data 4))
289 (face-list-to-change (delq 'default (face-list))) 291 (face-list-to-change (delq 'default (face-list)))
290 new-default-face-font) 292 new-default-face-font)
291 (unless from-family 293 (unless from-family
292 (signal 'error '("couldn't parse font name for default face"))) 294 (signal 'error '("couldn't parse font name for default face")))
313 (when (face-font-instance face) 315 (when (face-font-instance face)
314 (message "Changing font of `%s'..." face) 316 (message "Changing font of `%s'..." face)
315 (condition-case c 317 (condition-case c
316 (font-menu-change-face face 318 (font-menu-change-face face
317 from-family from-weight from-size 319 from-family from-weight from-size
318 family weight size) 320 (or family from-family)
321 (or weight from-weight)
322 (or size from-size))
319 (error 323 (error
320 (display-error c nil) 324 (display-error c nil)
321 (sit-for 1))))) 325 (sit-for 1)))))
322 ;; Set the default face's font after hacking the other faces, so that 326 ;; Set the default face's font after hacking the other faces, so that
323 ;; the frame size doesn't change until we are all done. 327 ;; the frame size doesn't change until we are all done.
328 (set-face-font 'default new-default-face-font 332 (set-face-font 'default new-default-face-font
329 (and font-menu-this-frame-only-p (selected-frame))) 333 (and font-menu-this-frame-only-p (selected-frame)))
330 ;; OK Let Customize do it. 334 ;; OK Let Customize do it.
331 (custom-set-face-update-spec 'default 335 (custom-set-face-update-spec 'default
332 (list (list 'type (device-type))) 336 (list (list 'type (device-type)))
333 (list :family family 337 (list :family (or family from-family)
334 :size (concat 338 :size (concat
335 (int-to-string 339 (int-to-string
336 (/ (or size from-size) 340 (/ (or size from-size)
337 (specifier-instance font-menu-size-scaling 341 (specifier-instance font-menu-size-scaling
338 (selected-device)))) 342 (selected-device))))