Mercurial > hg > xemacs-beta
comparison lisp/font.el @ 502:7039e6323819
[xemacs-hg @ 2001-05-04 22:41:46 by ben]
----------------------- byte-comp warning fixes -----------------
New functions for cleanly eliminating byte-compiler warnings.
Their definitions require no changes at all in bytecomp.el,
meaning that any package that wants to use them and be compatible
with older versions of XEmacs need only copy the code and rename
the functions (i.e. prefix them with the package name).
Eliminate byte-compiler warnings using the new functions in
bytecomp-runtime.el.
Move coding-system-put,get,category, since they're not
Mule-specific and are used in prefer-coding-system.
font.el was incredibly ugly. Clean it up. Avoid using defsubst
for any exported functions, to avoid possible compatibility
problems if we later change the internal interface. (It happened
before, with face accessors, between 19.8 and 19.9). Fix tons
of warnings.
Clean up (new function gpm-is-supported-p eliminates duplicate
code in gpm-create/delete-device-hook) and eliminate warnings.
---------- make byte-recompile-directory work in the ---------
core `lisp' dir, even in the absence of
a Mule XEmacs (i.e. make it skip the Mule
files rather than trying to compile them).
now you should be able to do `touch *.el'
in the `lisp' dir, then
M-x byte-recompile-directory, and get no
warnings.
Avoid trying to compile Mule files in byte-recompile-directory
when we're not in a Mule XEmacs, since we're highly likely to get
syntax errors.
Add a coding-system cookie to all Mule files so that
byte-recompile-directory ignores them.
Magic cookie function moved to files.el from code-files.el (for
use by bytecomp even in a non-coding-system XEmacs), and changed
names and semantics for use by bytecomp. NOTE: IMO this is an
internal function that we can change as we like (and there is
absolutely no code anywhere else using the function).
---------------- GUI improvements: menus, help -------------------
Rearrange order of keymap declarations to be alphabetical.
Improve help on help to include all bindings, and group by
category. Add bindings for new Info commands. Remove
warnings. Use command-hyper-apropos in place of command-apropos.
Add a function to do the equivalent of command-apropos.
Evals its help-text argument so you can put expressions there.
Used now by help-for-help.
Add binding to continue text searches. Expand index searches to
work over multiple info documents. Add commands to search
text/index in User and Lispref.
Add new entry, "Uncomment Region" (parallels "Comment Out Region").
Redo Help menu; add bindings for new Info commands to search the
index or text of the User and Lispref manuals. Add command for
mark-paragraph, activate-region. Make Edit->R accelerator be
rectangle, not register (more commonly used), and put rectangle
first. Fix the Edit Init File entry to never load the .elc file.
Simplify the default-popup-menu. Add Cmds->Tabs menu.
Use kp-left not kp_left, etc.
---------------- Miscellaneous bug fixes/cleanup -------------------
byte-compiler-options: Correct doc string.
easy-menu-do-define: fix extra quote.
fill-paragraph-or-region:Rewrite to be more correct -- use
call-interactively so that we always get exactly the same
behavior as if the functions were called directly.
No need to fiddle with zmacs-region-stays, now that bogus
clearing of it (2001-04-28 src/ChangeLog) is removed.
Put dialog titles back in -- this time correctly. Fix various
other problems with leaks and such.
key-sequence-list-description:
Clean up fun to always correctly canonicalize.
Clean up Kinsoku comments, synch comment-region with FSF 20.7.
* simple.el (region-exists-p):
* simple.el (region-active-p):
Add comment about which one is correct to use in menu specs.
* sound.el (load-sound-file):
Minor code clean up.
* startup.el:
* startup.el (command-line-early):
* startup.el (initial-scratch-message):
Comment changes. Add info about sample.init.el to splash screen.
Improve initial-scratch-message and clarify purpose of Scratch
buffer. Fix byte-compile warning.
------------------------ Added features -------------------------
Add new variable to control whether etags checks all parent
directories for tag files. (On by default.)
* hash-table.el: New file, useful utility functions.
* dumped-lisp.el (preloaded-file-list): Dump hash-table.el.
------------ notable bug fix: Windows event code --------------
Get critical quit working.
------------ notable bug fix and new feature: regex code --------------
Shy groups were implemented in a horrible, half-assed way that
would cause them to screw up regex searching in most cases.
Fixed to work correctly.
Also extended back-reference syntax past 9. Only is recognized
as such if there are at least that many non-shy groups; and
optionally will warn about such uses, to catch old code that
might be using them differently. (Added variable to control
this in search.c -- `warn-about-possibly-incompatible-back-
references', on by default for the moment. Declared in lisp.h.
---------------- process/SIGIO improvements -------------------
define USE_GETADDRINFO to replace more complex conditional,
and use it. the code conditionalized on this in
unix_open_network_stream had *serious* problems handling errors.
it's now fixed, and major amounts of duplicate code between
the two versions were combined.
don't disable SIGIO and other interrupts unless
CONNECT_NEEDS_SLOWED_INTERRUPTS is defined -- don't penalize OS's
without bugs. similarly for a freebsd bug that was affecting all
OS's.
* s\ultrix.h:
define CONNECT_NEEDS_SLOWED_INTERRUPTS, since that's the OS
mentioned as having a kernel bug.
* sysdep.c (request_sigio_on_device):
* sysdep.c (unrequest_sigio_on_device):
fix SIGIO problems on Linux. add check for O_ASYNC in case it's
defined and FASYNC isn't. add comment about other ways to do
SIGIO on Linux.
* callproc.c (Fold_call_process_internal):
* process.c (Fstart_process_internal):
Deal with the possibility that `default-directory' doesn't
have terminating slash. Correct comments about vfork.
---------------- Miscellaneous bug fixes/cleanup -------------------
* callint.c (Finteractive):
Add lots of documentation -- exactly what the Lisp equivalents of
all the interactive specs are.
* console.h (struct console): change type of quit_char to Emchar.
* event-msw.c (lstream_type_create_mswindows_selectable): spacing
change.
Eliminate events-mod.h and combine into events.h.
* emacs.c:
* emacs.c (make_arg_list_1):
* emacs.c (main_1):
A couple of char->Extbyte changes, add a comment.
* glyphs-msw.c:
Correct indentation of function defns to not exceed 80 cols.
Try (sort of) to fix some code that sets the colors of the
progress gauge. (Commented out)
* keymap.c (syms_of_keymap):
use DEFSYMBOL.
* process.c (read_process_output):
No need to fiddle with zmacs_region_stays, now that bogus
clearing of it (see below) is removed.
* search.c (Freplace_match): warning fix.
author | ben |
---|---|
date | Fri, 04 May 2001 22:42:35 +0000 |
parents | 576fb035e263 |
children | cd662ad69f40 |
comparison
equal
deleted
inserted
replaced
501:0a255b32b157 | 502:7039e6323819 |
---|---|
1 ;;; font.el --- New font model | 1 ;;; font.el --- New font model |
2 | |
3 ;; Copyright (c) 1995, 1996 by William M. Perry (wmperry@cs.indiana.edu) | |
4 ;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. | |
5 | |
2 ;; Author: wmperry | 6 ;; Author: wmperry |
7 ;; Maintainer: XEmacs Development Team | |
3 ;; Created: 1997/09/05 15:44:37 | 8 ;; Created: 1997/09/05 15:44:37 |
9 ;; Keywords: faces | |
4 ;; Version: 1.52 | 10 ;; Version: 1.52 |
5 ;; Keywords: faces | 11 |
6 | 12 ;; XEmacs is free software; you can redistribute it and/or modify it |
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 13 ;; under the terms of the GNU General Public License as published by |
8 ;;; Copyright (c) 1995, 1996 by William M. Perry (wmperry@cs.indiana.edu) | 14 ;; the Free Software Foundation; either version 1, or (at your option) |
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. | 15 ;; any later version. |
10 ;;; | 16 |
11 ;;; This file is part of GNU Emacs. | 17 ;; XEmacs is distributed in the hope that it will be useful, but |
12 ;;; | 18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify | 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 ;;; it under the terms of the GNU General Public License as published by | 20 ;; General Public License for more details. |
15 ;;; the Free Software Foundation; either version 2, or (at your option) | 21 |
16 ;;; any later version. | 22 ;; You should have received a copy of the GNU General Public License |
17 ;;; | 23 ;; along with XEmacs; see the file COPYING. If not, write to the Free |
18 ;;; GNU Emacs is distributed in the hope that it will be useful, | 24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 25 ;; 02111-1307, USA. |
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 26 |
21 ;;; GNU General Public License for more details. | 27 ;;; Synched up with: Not in FSF |
22 ;;; | 28 |
23 ;;; You should have received a copy of the GNU General Public License | 29 ;;; Commentary: |
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the | 30 |
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 31 ;;; Code: |
26 ;;; Boston, MA 02111-1307, USA. | 32 |
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 33 (globally-declare-fboundp |
28 | 34 '(x-list-fonts |
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 35 mswindows-list-fonts ns-list-fonts internal-facep fontsetp get-font-info |
30 ;;; The emacsen compatibility package - load it up before anything else | 36 get-fontset-info mswindows-define-rgb-color cancel-function-timers)) |
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 37 |
38 (globally-declare-boundp | |
39 '(global-face-data | |
40 x-font-regexp x-font-regexp-foundry-and-family)) | |
41 | |
32 (require 'cl) | 42 (require 'cl) |
33 | 43 |
34 (eval-and-compile | 44 (eval-and-compile |
35 (defvar device-fonts-cache) | 45 (defvar device-fonts-cache) |
36 (condition-case () | 46 (condition-case () |
72 (defun face-property (face property &optional locale tag-set exact-p) | 82 (defun face-property (face property &optional locale tag-set exact-p) |
73 "Return FACE's value of the given PROPERTY." | 83 "Return FACE's value of the given PROPERTY." |
74 (and (symbolp face) (get face property)))) | 84 (and (symbolp face) (get face property)))) |
75 | 85 |
76 (require 'disp-table) | 86 (require 'disp-table) |
77 | |
78 (if (not (fboundp '<<)) (fset '<< 'lsh)) | |
79 (if (not (fboundp '&)) (fset '& 'logand)) | |
80 (if (not (fboundp '|)) (fset '| 'logior)) | |
81 (if (not (fboundp '~)) (fset '~ 'lognot)) | |
82 (if (not (fboundp '>>)) (defun >> (value count) (<< value (- count)))) | |
83 | 87 |
84 | 88 |
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 89 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
86 ;;; Lots of variables / keywords for use later in the program | 90 ;;; Lots of variables / keywords for use later in the program |
87 ;;; Not much should need to be modified | 91 ;;; Not much should need to be modified |
147 :weight :extra-light :light :demi-light :medium :normal :demi-bold | 151 :weight :extra-light :light :demi-light :medium :normal :demi-bold |
148 :bold :extra-bold) | 152 :bold :extra-bold) |
149 | 153 |
150 (defvar font-style-keywords nil) | 154 (defvar font-style-keywords nil) |
151 | 155 |
152 (defsubst set-font-family (fontobj family) | 156 (defun set-font-family (fontobj family) |
153 (aset fontobj 1 family)) | 157 (aset fontobj 1 family)) |
154 | 158 |
155 (defsubst set-font-weight (fontobj weight) | 159 (defun set-font-weight (fontobj weight) |
156 (aset fontobj 3 weight)) | 160 (aset fontobj 3 weight)) |
157 | 161 |
158 (defsubst set-font-style (fontobj style) | 162 (defun set-font-style (fontobj style) |
159 (aset fontobj 5 style)) | 163 (aset fontobj 5 style)) |
160 | 164 |
161 (defsubst set-font-size (fontobj size) | 165 (defun set-font-size (fontobj size) |
162 (aset fontobj 7 size)) | 166 (aset fontobj 7 size)) |
163 | 167 |
164 (defsubst set-font-registry (fontobj reg) | 168 (defun set-font-registry (fontobj reg) |
165 (aset fontobj 9 reg)) | 169 (aset fontobj 9 reg)) |
166 | 170 |
167 (defsubst set-font-encoding (fontobj enc) | 171 (defun set-font-encoding (fontobj enc) |
168 (aset fontobj 11 enc)) | 172 (aset fontobj 11 enc)) |
169 | 173 |
170 (defsubst font-family (fontobj) | 174 (defun font-family (fontobj) |
171 (aref fontobj 1)) | 175 (aref fontobj 1)) |
172 | 176 |
173 (defsubst font-weight (fontobj) | 177 (defun font-weight (fontobj) |
174 (aref fontobj 3)) | 178 (aref fontobj 3)) |
175 | 179 |
176 (defsubst font-style (fontobj) | 180 (defun font-style (fontobj) |
177 (aref fontobj 5)) | 181 (aref fontobj 5)) |
178 | 182 |
179 (defsubst font-size (fontobj) | 183 (defun font-size (fontobj) |
180 (aref fontobj 7)) | 184 (aref fontobj 7)) |
181 | 185 |
182 (defsubst font-registry (fontobj) | 186 (defun font-registry (fontobj) |
183 (aref fontobj 9)) | 187 (aref fontobj 9)) |
184 | 188 |
185 (defsubst font-encoding (fontobj) | 189 (defun font-encoding (fontobj) |
186 (aref fontobj 11)) | 190 (aref fontobj 11)) |
187 | 191 |
188 (eval-when-compile | 192 (eval-when-compile |
189 (defmacro define-new-mask (attr mask) | 193 (defmacro define-new-mask (attr mask) |
190 `(progn | 194 `(progn |
192 (cons (cons (quote ,attr) | 196 (cons (cons (quote ,attr) |
193 (cons | 197 (cons |
194 (quote ,(intern (format "set-font-%s-p" attr))) | 198 (quote ,(intern (format "set-font-%s-p" attr))) |
195 (quote ,(intern (format "font-%s-p" attr))))) | 199 (quote ,(intern (format "font-%s-p" attr))))) |
196 font-style-keywords)) | 200 font-style-keywords)) |
197 (defconst ,(intern (format "font-%s-mask" attr)) (<< 1 ,mask) | 201 (defconst ,(intern (format "font-%s-mask" attr)) (lsh 1 ,mask) |
198 ,(format | 202 ,(format |
199 "Bitmask for whether a font is to be rendered in %s or not." | 203 "Bitmask for whether a font is to be rendered in %s or not." |
200 attr)) | 204 attr)) |
201 (defun ,(intern (format "font-%s-p" attr)) (fontobj) | 205 (defun ,(intern (format "font-%s-p" attr)) (fontobj) |
202 ,(format "Whether FONTOBJ will be renderd in `%s' or not." attr) | 206 ,(format "Whether FONTOBJ will be renderd in `%s' or not." attr) |
203 (if (/= 0 (& (font-style fontobj) | 207 (if (/= 0 (logand (font-style fontobj) |
204 ,(intern (format "font-%s-mask" attr)))) | 208 ,(intern (format "font-%s-mask" attr)))) |
205 t | 209 t |
206 nil)) | 210 nil)) |
207 (defun ,(intern (format "set-font-%s-p" attr)) (fontobj val) | 211 (defun ,(intern (format "set-font-%s-p" attr)) (fontobj val) |
208 ,(format "Set whether FONTOBJ will be renderd in `%s' or not." | 212 ,(format "Set whether FONTOBJ will be renderd in `%s' or not." |
209 attr) | 213 attr) |
210 (cond | 214 (cond |
211 (val | 215 (val |
212 (set-font-style fontobj (| (font-style fontobj) | 216 (set-font-style fontobj (logior (font-style fontobj) |
213 ,(intern | 217 ,(intern |
214 (format "font-%s-mask" attr))))) | 218 (format "font-%s-mask" attr))))) |
215 ((,(intern (format "font-%s-p" attr)) fontobj) | 219 ((,(intern (format "font-%s-p" attr)) fontobj) |
216 (set-font-style fontobj (- (font-style fontobj) | 220 (set-font-style fontobj (- (font-style fontobj) |
217 ,(intern | 221 ,(intern |
218 (format "font-%s-mask" attr))))))) | 222 (format "font-%s-mask" attr))))))) |
219 ))) | 223 ))) |
252 table)) | 256 table)) |
253 | 257 |
254 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 258 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
255 ;;; Utility functions | 259 ;;; Utility functions |
256 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 260 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
257 (defsubst set-font-style-by-keywords (fontobj styles) | 261 (defun set-font-style-by-keywords (fontobj styles) |
258 (make-local-variable 'font-func) | 262 (make-local-variable 'font-func) |
259 (declare (special font-func)) | 263 (declare (special font-func)) |
260 (if (listp styles) | 264 (if (listp styles) |
261 (while styles | 265 (while styles |
262 (setq font-func (car-safe (cdr-safe (assq (car styles) font-style-keywords))) | 266 (setq font-func (car-safe (cdr-safe (assq (car styles) font-style-keywords))) |
263 styles (cdr styles)) | 267 styles (cdr styles)) |
264 (and (fboundp font-func) (funcall font-func fontobj t))) | 268 (and (fboundp font-func) (funcall font-func fontobj t))) |
265 (setq font-func (car-safe (cdr-safe (assq styles font-style-keywords)))) | 269 (setq font-func (car-safe (cdr-safe (assq styles font-style-keywords)))) |
266 (and (fboundp font-func) (funcall font-func fontobj t)))) | 270 (and (fboundp font-func) (funcall font-func fontobj t)))) |
267 | 271 |
268 (defsubst font-properties-from-style (fontobj) | 272 (defun font-properties-from-style (fontobj) |
269 (let ((style (font-style fontobj)) | 273 (let ((todo font-style-keywords) |
270 (todo font-style-keywords) | |
271 type func retval) | 274 type func retval) |
272 (while todo | 275 (while todo |
273 (setq func (cdr (cdr (car todo))) | 276 (setq func (cdr (cdr (car todo))) |
274 type (car (pop todo))) | 277 type (car (pop todo))) |
275 (if (funcall func fontobj) | 278 (if (funcall func fontobj) |
392 (font-spatial-to-canonical (font-size fontobj-2))))) | 395 (font-spatial-to-canonical (font-size fontobj-2))))) |
393 (set-font-weight retval (font-higher-weight (font-weight fontobj-1) | 396 (set-font-weight retval (font-higher-weight (font-weight fontobj-1) |
394 (font-weight fontobj-2))) | 397 (font-weight fontobj-2))) |
395 (set-font-family retval (font-unique (append (font-family fontobj-1) | 398 (set-font-family retval (font-unique (append (font-family fontobj-1) |
396 (font-family fontobj-2)))) | 399 (font-family fontobj-2)))) |
397 (set-font-style retval (| (font-style fontobj-1) (font-style fontobj-2))) | 400 (set-font-style retval (logior (font-style fontobj-1) |
401 (font-style fontobj-2))) | |
398 (set-font-registry retval (or (font-registry fontobj-1) | 402 (set-font-registry retval (or (font-registry fontobj-1) |
399 (font-registry fontobj-2))) | 403 (font-registry fontobj-2))) |
400 (set-font-encoding retval (or (font-encoding fontobj-1) | 404 (set-font-encoding retval (or (font-encoding fontobj-1) |
401 (font-encoding fontobj-2))) | 405 (font-encoding fontobj-2))) |
402 (set-font-size retval (cond | 406 (set-font-size retval (cond |
452 x-font-regexp) | 456 x-font-regexp) |
453 (let | 457 (let |
454 ((- "[-?]") | 458 ((- "[-?]") |
455 (foundry "[^-]*") | 459 (foundry "[^-]*") |
456 (family "[^-]*") | 460 (family "[^-]*") |
457 (weight "\\(bold\\|demibold\\|medium\\|black\\)") | 461 ;(weight "\\(bold\\|demibold\\|medium\\|black\\)") |
458 (weight\? "\\([^-]*\\)") | 462 (weight\? "\\([^-]*\\)") |
459 (slant "\\([ior]\\)") | 463 ;(slant "\\([ior]\\)") |
460 (slant\? "\\([^-]?\\)") | 464 (slant\? "\\([^-]?\\)") |
461 (swidth "\\([^-]*\\)") | 465 (swidth "\\([^-]*\\)") |
462 (adstyle "\\([^-]*\\)") | 466 (adstyle "\\([^-]*\\)") |
463 (pixelsize "\\(\\*\\|[0-9]+\\)") | 467 (pixelsize "\\(\\*\\|[0-9]+\\)") |
464 (pointsize "\\(\\*\\|0\\|[0-9][0-9]+\\)") | 468 (pointsize "\\(\\*\\|0\\|[0-9][0-9]+\\)") |
521 (let ((case-fold-search t)) | 525 (let ((case-fold-search t)) |
522 (if (or (not (stringp fontname)) | 526 (if (or (not (stringp fontname)) |
523 (not (string-match font-x-font-regexp fontname))) | 527 (not (string-match font-x-font-regexp fontname))) |
524 (make-font) | 528 (make-font) |
525 (let ((family nil) | 529 (let ((family nil) |
526 (style nil) | |
527 (size nil) | 530 (size nil) |
528 (weight (match-string 1 fontname)) | 531 (weight (match-string 1 fontname)) |
529 (slant (match-string 2 fontname)) | 532 (slant (match-string 2 fontname)) |
530 (swidth (match-string 3 fontname)) | 533 (swidth (match-string 3 fontname)) |
531 (adstyle (match-string 4 fontname)) | 534 (adstyle (match-string 4 fontname)) |
632 (let* ((default (font-default-object-for-device device)) | 635 (let* ((default (font-default-object-for-device device)) |
633 (family (or (font-family fontobj) | 636 (family (or (font-family fontobj) |
634 (font-family default) | 637 (font-family default) |
635 (x-font-families-for-device device))) | 638 (x-font-families-for-device device))) |
636 (weight (or (font-weight fontobj) :medium)) | 639 (weight (or (font-weight fontobj) :medium)) |
637 (style (font-style fontobj)) | |
638 (size (or (if font-running-xemacs | 640 (size (or (if font-running-xemacs |
639 (font-size fontobj)) | 641 (font-size fontobj)) |
640 (font-size default))) | 642 (font-size default))) |
641 (registry (or (font-registry fontobj) | 643 (registry (or (font-registry fontobj) |
642 (font-registry default) | 644 (font-registry default) |
715 (defun ns-font-create-name (fontobj &optional device) | 717 (defun ns-font-create-name (fontobj &optional device) |
716 (let ((family (or (font-family fontobj) | 718 (let ((family (or (font-family fontobj) |
717 (ns-font-families-for-device device))) | 719 (ns-font-families-for-device device))) |
718 (weight (or (font-weight fontobj) :medium)) | 720 (weight (or (font-weight fontobj) :medium)) |
719 (style (or (font-style fontobj) (list :normal))) | 721 (style (or (font-style fontobj) (list :normal))) |
720 (size (font-size fontobj)) | 722 (size (font-size fontobj))) |
721 (registry (or (font-registry fontobj) "*")) | |
722 (encoding (or (font-encoding fontobj) "*"))) | |
723 ;; Create a font, wow! | 723 ;; Create a font, wow! |
724 (if (stringp family) | 724 (if (stringp family) |
725 (setq family (list family))) | 725 (setq family (list family))) |
726 (if (or (symbolp style) (numberp style)) | 726 (if (or (symbolp style) (numberp style)) |
727 (setq style (list style))) | 727 (setq style (list style))) |
861 (or device (setq device (selected-device))) | 861 (or device (setq device (selected-device))) |
862 (let* ((default (font-default-object-for-device device)) | 862 (let* ((default (font-default-object-for-device device)) |
863 (family (or (font-family fontobj) | 863 (family (or (font-family fontobj) |
864 (font-family default))) | 864 (font-family default))) |
865 (weight (or (font-weight fontobj) :regular)) | 865 (weight (or (font-weight fontobj) :regular)) |
866 (style (font-style fontobj)) | |
867 (size (or (if font-running-xemacs | 866 (size (or (if font-running-xemacs |
868 (font-size fontobj)) | 867 (font-size fontobj)) |
869 (font-size default))) | 868 (font-size default))) |
870 (underline-p (font-underline-p fontobj)) | 869 (underline-p (font-underline-p fontobj)) |
871 (strikeout-p (font-strikethru-p fontobj)) | 870 (strikeout-p (font-strikethru-p fontobj)) |
994 ;; Update all faces that were created with the 'font' package | 993 ;; Update all faces that were created with the 'font' package |
995 ;; to appear correctly on the new device. This should be in the | 994 ;; to appear correctly on the new device. This should be in the |
996 ;; create-device-hook. This is XEmacs 19.12+ specific | 995 ;; create-device-hook. This is XEmacs 19.12+ specific |
997 (let ((faces (face-list 2)) | 996 (let ((faces (face-list 2)) |
998 (cur nil) | 997 (cur nil) |
999 (font nil) | |
1000 (font-spec nil)) | 998 (font-spec nil)) |
1001 (while faces | 999 (while faces |
1002 (setq cur (car faces) | 1000 (setq cur (car faces) |
1003 faces (cdr faces) | 1001 faces (cdr faces) |
1004 font-spec (face-property cur 'font-specification)) | 1002 font-spec (face-property cur 'font-specification)) |
1010 ;; DEVICE_LIST defaults to a list of all active devices | 1008 ;; DEVICE_LIST defaults to a list of all active devices |
1011 (setq device-list (or device-list (device-list))) | 1009 (setq device-list (or device-list (device-list))) |
1012 (if (devicep device-list) | 1010 (if (devicep device-list) |
1013 (setq device-list (list device-list))) | 1011 (setq device-list (list device-list))) |
1014 (let* ((cur-device nil) | 1012 (let* ((cur-device nil) |
1015 (font-spec (face-property face 'font-specification)) | 1013 (font-spec (face-property face 'font-specification))) |
1016 (font nil)) | |
1017 (if (not font-spec) | 1014 (if (not font-spec) |
1018 ;; Hey! Don't mess with fonts we didn't create in the | 1015 ;; Hey! Don't mess with fonts we didn't create in the |
1019 ;; first place. | 1016 ;; first place. |
1020 nil | 1017 nil |
1021 (while device-list | 1018 (while device-list |
1187 (setq r 0 | 1184 (setq r 0 |
1188 g 0 | 1185 g 0 |
1189 b 0))) | 1186 b 0))) |
1190 (list r g b) )) | 1187 (list r g b) )) |
1191 | 1188 |
1192 (defsubst font-rgb-color-p (obj) | 1189 (defun font-rgb-color-p (obj) |
1193 (or (and (vectorp obj) | 1190 (or (and (vectorp obj) |
1194 (= (length obj) 4) | 1191 (= (length obj) 4) |
1195 (eq (aref obj 0) 'rgb)))) | 1192 (eq (aref obj 0) 'rgb)))) |
1196 | 1193 |
1197 (defsubst font-rgb-color-red (obj) (aref obj 1)) | 1194 (defun font-rgb-color-red (obj) (aref obj 1)) |
1198 (defsubst font-rgb-color-green (obj) (aref obj 2)) | 1195 (defun font-rgb-color-green (obj) (aref obj 2)) |
1199 (defsubst font-rgb-color-blue (obj) (aref obj 3)) | 1196 (defun font-rgb-color-blue (obj) (aref obj 3)) |
1200 | 1197 |
1201 (defun font-color-rgb-components (color) | 1198 (defun font-color-rgb-components (color) |
1202 "Return the RGB components of COLOR as a list of integers (R G B). | 1199 "Return the RGB components of COLOR as a list of integers (R G B). |
1203 16-bit values are always returned. | 1200 16-bit values are always returned. |
1204 #FEFEFE and rgb:fe/fe/fe style color specifications are parsed directly | 1201 #FEFEFE and rgb:fe/fe/fe style color specifications are parsed directly |
1235 b (round (* 255 b)))) | 1232 b (round (* 255 b)))) |
1236 (font-parse-rgb-components (format "#%02x%02x%02x" r g b)))) | 1233 (font-parse-rgb-components (format "#%02x%02x%02x" r g b)))) |
1237 (t | 1234 (t |
1238 (font-lookup-rgb-components color))))) | 1235 (font-lookup-rgb-components color))))) |
1239 | 1236 |
1240 (defsubst font-tty-compute-color-delta (col1 col2) | 1237 (defun font-tty-compute-color-delta (col1 col2) |
1241 (+ | 1238 (+ |
1242 (* (- (aref col1 0) (aref col2 0)) | 1239 (* (- (aref col1 0) (aref col2 0)) |
1243 (- (aref col1 0) (aref col2 0))) | 1240 (- (aref col1 0) (aref col2 0))) |
1244 (* (- (aref col1 1) (aref col2 1)) | 1241 (* (- (aref col1 1) (aref col2 1)) |
1245 (- (aref col1 1) (aref col2 1))) | 1242 (- (aref col1 1) (aref col2 1))) |
1293 (mswindows-define-rgb-color (nth 0 rgb) (nth 1 rgb) (nth 2 rgb) color) | 1290 (mswindows-define-rgb-color (nth 0 rgb) (nth 1 rgb) (nth 2 rgb) color) |
1294 color)) | 1291 color)) |
1295 (tty | 1292 (tty |
1296 (apply 'font-tty-find-closest-color (font-color-rgb-components color))) | 1293 (apply 'font-tty-find-closest-color (font-color-rgb-components color))) |
1297 (ns | 1294 (ns |
1298 (let ((vals (mapcar #'(lambda (x) (>> x 8)) | 1295 (let ((vals (mapcar #'(lambda (x) (lsh x -8)) |
1299 (font-color-rgb-components color)))) | 1296 (font-color-rgb-components color)))) |
1300 (apply 'format "RGB%02x%02x%02xff" vals))) | 1297 (apply 'format "RGB%02x%02x%02xff" vals))) |
1301 (otherwise | 1298 (otherwise |
1302 color))) | 1299 color))) |
1303 | 1300 |