annotate lisp/font-mgr.el @ 5604:e9f58d024c3c

Disable ASLR on Mac OS X Lion. 2011-11-27 Marcus Crestani <crestani@informatik.uni-tuebingen.de> * configure.ac: Add "-Wl,-no_pie" to linker flags on Mac OS X Lion to disable ASLR that breaks pdump. * configure: Regenerate.
author Marcus Crestani <crestani@informatik.uni-tuebingen.de>
date Tue, 29 Nov 2011 16:19:53 +0100
parents 91b3aa59f49b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3354
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
1 ;;; font-mgr.el --- Lisp emulation of fontconfig for X fonts.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
2
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
3 ;; Copyright (C) 2006 Free Software Foundation, Inc.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
4
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
5 ;; Author: Stephen J. Turnbull <stephen@xemacs.org>
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
6 ;; Created: 12 Apr 2006 by Stephen J. Turnbull
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
7
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
8 ;; This file is part of XEmacs.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
9
5404
91b3aa59f49b Convert lisp/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3360
diff changeset
10 ;; XEmacs is free software: you can redistribute it and/or modify it
3354
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by the
5404
91b3aa59f49b Convert lisp/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3360
diff changeset
12 ;; Free Software Foundation, either version 3 of the License, or (at your
91b3aa59f49b Convert lisp/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3360
diff changeset
13 ;; option) any later version.
3354
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
14
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
18 ;; for more details.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
19
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
5404
91b3aa59f49b Convert lisp/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3360
diff changeset
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
3354
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
22
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
23 ;; Synched up with: Not in GNU Emacs.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
24
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
25 ;; Commentary
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
26 ;; This module provides the Lisp interface to fonts in X11, including Xft,
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
27 ;; but (at least at first) not GTK+ or Qt. It is a substitute for the
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
28 ;; C library fontconfig, whose interface is provided in ../src/font-mgr.c.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
29
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
30 ;; static FcChar8 *fc_standard_properties[] = {
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
31 ;; "antialias", "aspect", "autohint", "charset", "dpi", "family", "file",
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
32 ;; "foundry", "ftface", "globaladvance", "hinting", "index", "lang",
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
33 ;; "minspace", "outline", "pixelsize", "rasterizer", "rgba", "scalable",
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
34 ;; "scale", "size", "slant", "spacing", "style", "verticallayout", "weight",
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
35 ;; /* obsolete after Xft v. 1 */
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
36 ;; "charwidth", "charheight", "core", "encoding", "render"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
37
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
38 ;; #### should we wrap the world in `(unless (featurep 'font-mgr) ... )'?
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
39
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
40 (provide 'font-mgr)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
41
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
42 (defvar xft-xlfd-font-regexp
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
43 (concat
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
44 ;; XLFD specifies ISO 8859-1 encoding, but we can't handle non-ASCII
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
45 ;; in Mule when this function is called. So use HPC.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
46 ;; (xe_xlfd_prefix "\\(\\+[\040-\176\240-\377]*\\)?-")
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
47 ;; (xe_xlfd_opt_text "\\([\040-\044\046-\176\240-\377]*\\)")
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
48 ;; (xe_xlfd_text "\\([\040-\044\046-\176\240-\377]+\\)")
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
49 "\\`"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
50 "\\(\\+[\040-\176]*\\)?-" ; prefix
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
51 "\\([^-]+\\)" ; foundry
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
52 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
53 "\\([^-]+\\)" ; family
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
54 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
55 "\\([^-]+\\)" ; weight
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
56 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
57 "\\([0-9ior?*][iot]?\\)" ; slant
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
58 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
59 "\\([^-]+\\)" ; swidth
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
60 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
61 "\\([^-]*\\)" ; adstyle
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
62 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
63 "\\([0-9?*]+\\|\\[[ 0-9+~.e?*]+\\]\\)" ; pixelsize
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
64 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
65 "\\([0-9?*]+\\|\\[[ 0-9+~.e?*]+\\]\\)" ; pointsize
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
66 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
67 "\\([0-9?*]+\\)" ; resx
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
68 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
69 "\\([0-9?*]+\\)" ; resy
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
70 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
71 "\\([cmp?*]\\)" ; spacing
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
72 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
73 "~?" ; avgwidth
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
74 "\\([0-9?*]+\\)"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
75 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
76 "\\([^-]+\\)" ; registry
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
77 "-"
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
78 "\\([^-]+\\)" ; encoding
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
79 "\\'")
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
80 "The regular expression used to match XLFD font names.")
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
81
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
82 (defun fc-pattern-p (object)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
83 "Returns t if OBJECT is of type fc-pattern, nil otherwise."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
84 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
85
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
86 (defun fc-pattern-create ()
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
87 "Return a new, empty fc-pattern object."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
88 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
89
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
90 (defun fc-name-parse (fontname)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
91 "Parse an Fc font name and return its representation as a fc pattern object."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
92 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
93
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
94 (defun fc-name-unparse (pattern)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
95 "Unparse an fc pattern object to a string."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
96 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
97
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
98 (defun fc-pattern-duplicate (pattern)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
99 "Make a copy of the fc pattern object PATTERN and return it."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
100 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
101
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
102 (defun fc-pattern-add (pattern property value)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
103 "Add attributes to the pattern object PATTERN. PROPERTY is a string naming
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
104 the attribute to add, VALUE the value for this attribute.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
105
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
106 VALUE may be a string, integer, float, or symbol, in which case the value
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
107 will be added as an FcChar8[], int, double, or FcBool respectively."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
108 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
109
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
110 (defun fc-pattern-del (pattern property)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
111 "Remove attribute PROPERTY from fc pattern object PATTERN."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
112 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
113
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
114 ;; Generic interface to FcPatternGet()
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
115 ;; Don't support the losing symbol-for-property interface.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
116
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
117 (defun fc-pattern-get (pattern property &optional id type)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
118 "From PATTERN, extract PROPERTY for the ID'th member, of type TYPE.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
119
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
120 PATTERN is an Xft \(fontconfig) pattern object.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
121 PROPERTY is a string naming an fontconfig font property.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
122 Optional ID is a nonnegative integer indexing the list of values for PROPERTY
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
123 stored in PATTERN, defaulting to 0 (the first value).
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
124 Optional TYPE is a symbol, one of 'string, 'boolean, 'integer, 'float,
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
125 'double, 'matrix, 'charset, or 'void, corresponding to the FcValue types.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
126 \('float is an alias for 'double).
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
127
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
128 The Lisp types returned will conform to TYPE:
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
129 string string
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
130 boolean `t' or `nil'
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
131 integer integer
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
132 double \(float) float
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
133 matrix not implemented
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
134 charset not implemented
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
135 void not implemented
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
136
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
137 Symbols with names of the form \"fc-result-DESCRIPTION\" are returned when
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
138 the desired value is not available. These are
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
139
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
140 fc-result-type-mismatch the value found has an unexpected type
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
141 fc-result-no-match there is no such attribute
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
142 fc-result-no-id there is no value for the requested ID
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
143
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
144 The types of the following standard properties are predefined by fontconfig.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
145 The symbol 'fc-result-type-mismatch will be returned if the object exists but
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
146 TYPE does not match the predefined type. It is best not to specify a type
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
147 for predefined properties, as a mistake here ensures error returns on the
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
148 correct type.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
149
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
150 Each standard property has a convenience accessor defined in fontconfig.el,
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
151 named in the form \"fc-pattern-get-PROPERTY\". The convenience functions are
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
152 preferred to `fc-pattern-get' since a typo in the string naming a property
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
153 will result in a silent null return, while a typo in a function name will
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
154 usually result in a compiler or runtime \"not fboundp\" error. You may use
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
155 `defsubst' to define convenience functions for non-standard properties.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
156
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
157 family String Font family name
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
158 style String Font style. Overrides weight and slant
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
159 slant Int Italic, oblique or roman
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
160 weight Int Light, medium, demibold, bold or black
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
161 size Double Point size
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
162 aspect Double Stretches glyphs horizontally before hinting
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
163 pixelsize Double Pixel size
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
164 spacing Int Proportional, monospace or charcell
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
165 foundry String Font foundry name
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
166 antialias Bool Whether glyphs can be antialiased
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
167 hinting Bool Whether the rasterizer should use hinting
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
168 verticallayout Bool Use vertical layout
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
169 autohint Bool Use autohinter instead of normal hinter
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
170 globaladvance Bool Use font global advance data
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
171 file String The filename holding the font
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
172 index Int The index of the font within the file
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
173 ftface FT_Face Use the specified FreeType face object
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
174 rasterizer String Which rasterizer is in use
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
175 outline Bool Whether the glyphs are outlines
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
176 scalable Bool Whether glyphs can be scaled
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
177 scale Double Scale factor for point->pixel conversions
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
178 dpi Double Target dots per inch
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
179 rgba Int unknown, rgb, bgr, vrgb, vbgr, none - subpixel geometry
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
180 minspace Bool Eliminate leading from line spacing
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
181 charset CharSet Unicode chars encoded by the font
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
182 lang String List of RFC-3066-style languages this font supports
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
183
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
184 The FT_Face, Matrix, CharSet types are unimplemented, so the corresponding
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
185 properties are not accessible from Lisp at this time. If the value of a
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
186 property returned has type FT_Face, FcCharSet, or FcMatrix,
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
187 `fc-result-type-mismatch' is returned.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
188
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
189 The following properties which were standard in Xft v.1 are obsolete in
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
190 Xft v.2: encoding, charwidth, charheight, core, and render."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
191 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
192
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
193 (defun fc-font-match (device pattern)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
194 "Return the font on DEVICE that most closely matches PATTERN.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
195
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
196 DEVICE is an X11 device.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
197 PATTERN is a fontconfig pattern object.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
198 Returns a fontconfig pattern object representing the closest match to the
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
199 given pattern, or an error code. Possible error codes are
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
200 `fc-result-no-match' and `fc-result-no-id'."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
201 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
202
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
203 ;; #### fix this name to correspond to Ben's new nomenclature
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
204 (defun fc-list-fonts-pattern-objects (device pattern properties)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
205 "Return a list of fonts on DEVICE that match PATTERN for PROPERTIES.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
206 Each font is represented by a fontconfig pattern object.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
207
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
208 DEVICE is an X11 device.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
209 PATTERN is a fontconfig pattern to be matched.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
210 PROPERTIES is a list of property names (strings) that should match.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
211
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
212 #### DEVICE is unused, ignored, and may be removed if it's not needed to
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
213 match other font-listing APIs."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
214 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
215
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
216 ;; #### maybe this can/should be folded into fc-list-fonts-pattern-objects?
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
217 (defun fc-font-sort (device pattern &optional trim nosub)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
218 "Return a list of all fonts sorted by proximity to PATTERN.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
219 Each font is represented by a fontconfig pattern object.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
220
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
221 DEVICE is an X11 device.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
222 PATTERN is a fontconfig pattern to be matched.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
223 Optional argument TRIM, if non-nil, means to trim trailing fonts that do not
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
224 contribute new characters to the union repertoire.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
225
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
226 #### Optional argument NOSUB, if non-nil, suppresses some of the usual
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
227 property substitutions. DON'T USE THIS in production code, it is intended
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
228 for exploring behavior of fontconfig and will be removed when this code is
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
229 stable.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
230
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
231 #### DEVICE is unused, ignored, and may be removed if it's not needed to
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
232 match other font-listing APIs."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
233 (error 'unimplemented "font-mgr library is experimental and incomplete"))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
234
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
235 (defun xlfd-font-name-p (fontname)
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
236 "Check whether the string FONTNAME is a XLFD font name."
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
237 (save-match-data
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
238 (string-match xft-xlfd-font-regexp fontname)))
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
239
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
240 ;; FcPatternPrint: there is no point in having wrappers fc-pattern-print,
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
241 ;; Ffc_pattern_print since this function prints to stdout.
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
242
15fb91e3a115 [xemacs-hg @ 2006-04-23 16:11:16 by stephent]
stephent
parents:
diff changeset
243 ;;; end font-mgr.el