0
|
1 ;;; objects.el --- Lisp interface to C window-system objects
|
|
2 ;; Keywords: faces internal
|
|
3
|
|
4 ;; Copyright (C) 1994 Board of Trustees, University of Illinois
|
|
5 ;; Copyright (C) 1995 Ben Wing
|
|
6
|
|
7 ;; Author: Chuck Thompson <cthomp@cs.uiuc.edu>,
|
|
8 ;; Ben Wing <wing@666.com>
|
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
16
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the
|
70
|
24 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
16
|
25 ;; Boston, MA 02111-1307, USA.
|
0
|
26
|
|
27 ;;; Synched up with: Not in FSF.
|
|
28
|
|
29 (defun ws-object-property-1 (function object domain &optional matchspec)
|
|
30 (let ((instance (if matchspec
|
|
31 (specifier-matching-instance object matchspec domain)
|
|
32 (specifier-instance object domain))))
|
|
33 (and instance (funcall function instance))))
|
|
34
|
|
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; font specifiers
|
|
36
|
|
37 (defun make-font-specifier (spec-list)
|
|
38 "Create a new `font' specifier object with the given specification list.
|
|
39 SPEC-LIST can be a list of specifications (each of which is a cons of a
|
|
40 locale and a list of instantiators), a single instantiator, or a list
|
|
41 of instantiators. See `make-specifier' for more information about
|
|
42 specifiers."
|
|
43 (make-specifier-and-init 'font spec-list))
|
|
44
|
|
45 (defun font-name (font &optional domain charset)
|
|
46 "Return the name of the FONT in the specified DOMAIN, if any.
|
|
47 FONT should be a font specifier object and DOMAIN is normally a window
|
|
48 and defaults to the selected window if omitted. This is equivalent
|
|
49 to using `specifier-instance' and applying `font-instance-name' to
|
|
50 the result. See `make-specifier' for more information about specifiers."
|
|
51 (ws-object-property-1 'font-instance-name font domain charset))
|
|
52
|
|
53 (defun font-ascent (font &optional domain charset)
|
|
54 "Return the ascent of the FONT in the specified DOMAIN, if any.
|
|
55 FONT should be a font specifier object and DOMAIN is normally a window
|
|
56 and defaults to the selected window if omitted. This is equivalent
|
|
57 to using `specifier-instance' and applying `font-instance-ascent' to
|
|
58 the result. See `make-specifier' for more information about specifiers."
|
|
59 (ws-object-property-1 'font-instance-ascent font domain charset))
|
|
60
|
|
61 (defun font-descent (font &optional domain charset)
|
|
62 "Return the descent of the FONT in the specified DOMAIN, if any.
|
|
63 FONT should be a font specifier object and DOMAIN is normally a window
|
|
64 and defaults to the selected window if omitted. This is equivalent
|
|
65 to using `specifier-instance' and applying `font-instance-descent' to
|
|
66 the result. See `make-specifier' for more information about specifiers."
|
|
67 (ws-object-property-1 'font-instance-descent font domain charset))
|
|
68
|
|
69 (defun font-width (font &optional domain charset)
|
|
70 "Return the width of the FONT in the specified DOMAIN, if any.
|
|
71 FONT should be a font specifier object and DOMAIN is normally a window
|
|
72 and defaults to the selected window if omitted. This is equivalent
|
|
73 to using `specifier-instance' and applying `font-instance-width' to
|
|
74 the result. See `make-specifier' for more information about specifiers."
|
|
75 (ws-object-property-1 'font-instance-width font domain charset))
|
|
76
|
|
77 (defun font-height (font &optional domain charset)
|
|
78 "Return the height of the FONT in the specified DOMAIN, if any.
|
|
79 FONT should be a font specifier object and DOMAIN is normally a window
|
|
80 and defaults to the selected window if omitted. This is equivalent
|
|
81 to using `specifier-instance' and applying `font-instance-height' to
|
|
82 the result. See `make-specifier' for more information about specifiers."
|
|
83 (ws-object-property-1 'font-instance-height font domain charset))
|
|
84
|
|
85 (defun font-proportional-p (font &optional domain charset)
|
|
86 "Return whether FONT is proportional in the specified DOMAIN, if known.
|
|
87 FONT should be a font specifier object and DOMAIN is normally a window
|
|
88 and defaults to the selected window if omitted. This is equivalent
|
|
89 to using `specifier-instance' and applying `font-instance-proportional-p' to
|
|
90 the result. See `make-specifier' for more information about specifiers."
|
|
91 (ws-object-property-1 'font-instance-proportional-p font domain charset))
|
|
92
|
|
93 (defun font-properties (font &optional domain charset)
|
|
94 "Return the properties of the FONT in the specified DOMAIN, if any.
|
|
95 FONT should be a font specifier object and DOMAIN is normally a window
|
|
96 and defaults to the selected window if omitted. This is equivalent
|
|
97 to using `specifier-instance' and applying `font-instance-properties'
|
|
98 to the result. See `make-specifier' for more information about specifiers."
|
|
99 (ws-object-property-1 'font-instance-properties font domain charset))
|
|
100
|
|
101 (defun font-truename (font &optional domain charset)
|
|
102 "Return the truename of the FONT in the specified DOMAIN, if any.
|
|
103 FONT should be a font specifier object and DOMAIN is normally a window
|
|
104 and defaults to the selected window if omitted. This is equivalent
|
|
105 to using `specifier-instance' and applying `font-instance-truename'
|
|
106 to the result. See `make-specifier' for more information about specifiers."
|
|
107 (ws-object-property-1 'font-instance-truename font domain charset))
|
|
108
|
|
109 (defun font-instance-height (font-instance)
|
|
110 "Return the height in pixels of FONT-INSTANCE.
|
|
111 The returned value is the maximum height for all characters in the font,\n\
|
|
112 and is equivalent to the sum of the font instance's ascent and descent."
|
|
113 (+ (font-instance-ascent font-instance)
|
|
114 (font-instance-descent font-instance)))
|
|
115
|
|
116 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; color specifiers
|
|
117
|
|
118 (defun make-color-specifier (spec-list)
|
|
119 "Create a new `color' specifier object with the given specification list.
|
|
120 SPEC-LIST can be a list of specifications (each of which is a cons of a
|
|
121 locale and a list of instantiators), a single instantiator, or a list
|
|
122 of instantiators. See `make-specifier' for a detailed description of
|
|
123 how specifiers work."
|
|
124 (make-specifier-and-init 'color spec-list))
|
|
125
|
|
126 (defun color-name (color &optional domain)
|
|
127 "Return the name of the COLOR in the specified DOMAIN, if any.
|
|
128 COLOR should be a color specifier object and DOMAIN is normally a window
|
|
129 and defaults to the selected window if omitted. This is equivalent
|
|
130 to using `specifier-instance' and applying `color-instance-name' to
|
|
131 the result. See `make-specifier' for more information about specifiers."
|
|
132 (ws-object-property-1 'color-instance-name color domain))
|
|
133
|
|
134 (defun color-rgb-components (color &optional domain)
|
|
135 "Return the RGB components of the COLOR in the specified DOMAIN, if any.
|
|
136 COLOR should be a color specifier object and DOMAIN is normally a window
|
|
137 and defaults to the selected window if omitted. This is equivalent
|
|
138 to using `specifier-instance' and applying `color-instance-rgb-components'
|
|
139 to the result. See `make-specifier' for more information about specifiers."
|
|
140 (ws-object-property-1 'color-instance-rgb-components color domain))
|
|
141
|
|
142 ;;; objects.el ends here.
|
|
143
|