fntfilst.h revision 23a0898a
1/* $Xorg: fntfilst.h,v 1.5 2001/02/09 02:04:04 xorgcvs Exp $ */
2
3/*
4
5Copyright 1991, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26
27*/
28/* $XFree86: xc/lib/font/include/fntfilst.h,v 3.8 2002/12/09 17:30:00 dawes Exp $ */
29
30/*
31 * Author:  Keith Packard, MIT X Consortium
32 */
33
34#ifndef _FONTFILEST_H_
35#define _FONTFILEST_H_
36
37#ifndef FONTMODULE
38#include <X11/Xos.h>
39#endif
40#ifndef XP_PSTEXT
41#include <X11/fonts/fontmisc.h>
42#endif
43#include <X11/fonts/fontstruct.h>
44#include <X11/fonts/fontxlfd.h>
45#include <X11/fonts/fntfil.h>
46
47typedef struct _FontName {
48    char	*name;
49    short	length;
50    short	ndashes;
51} FontNameRec;
52
53typedef struct _FontScaled {
54    FontScalableRec	vals;
55    FontEntryPtr	bitmap;
56    FontPtr		pFont;
57} FontScaledRec;
58
59typedef struct _FontScalableExtra {
60    FontScalableRec	defaults;
61    int			numScaled;
62    int			sizeScaled;
63    FontScaledPtr	scaled;
64    pointer		private;
65} FontScalableExtraRec;
66
67typedef struct _FontScalableEntry {
68    FontRendererPtr	    renderer;
69    char		    *fileName;
70    FontScalableExtraPtr   extra;
71} FontScalableEntryRec;
72
73/*
74 * This "can't" work yet - the returned alias string must be permanent,
75 * but this layer would need to generate the appropriate name from the
76 * resolved scalable + the XLFD values passed in.  XXX
77 */
78
79typedef struct _FontScaleAliasEntry {
80    char		*resolved;
81} FontScaleAliasEntryRec;
82
83typedef struct _FontBitmapEntry {
84    FontRendererPtr	renderer;
85    char		*fileName;
86    FontPtr		pFont;
87} FontBitmapEntryRec;
88
89typedef struct _FontAliasEntry {
90    char	*resolved;
91} FontAliasEntryRec;
92
93typedef struct _FontBCEntry {
94    FontScalableRec	    vals;
95    FontEntryPtr	    entry;
96} FontBCEntryRec;
97
98typedef struct _FontEntry {
99    FontNameRec	name;
100    int		type;
101    union _FontEntryParts {
102	FontScalableEntryRec	scalable;
103	FontBitmapEntryRec	bitmap;
104	FontAliasEntryRec	alias;
105	FontBCEntryRec		bc;
106    } u;
107} FontEntryRec;
108
109typedef struct _FontTable {
110    int		    used;
111    int		    size;
112    FontEntryPtr    entries;
113    Bool	    sorted;
114} FontTableRec;
115
116typedef struct _FontDirectory {
117    char	    *directory;
118    unsigned long   dir_mtime;
119    unsigned long   alias_mtime;
120    FontTableRec    scalable;
121    FontTableRec    nonScalable;
122    char	    *attributes;
123} FontDirectoryRec;
124
125/* Capability bits: for definition of capabilities bitmap in the
126   FontRendererRec to indicate support of XLFD enhancements */
127
128#define CAP_MATRIX		0x1
129#define CAP_CHARSUBSETTING	0x2
130
131typedef struct _FontRenderer {
132    char    *fileSuffix;
133    int	    fileSuffixLen;
134    int	    (*OpenBitmap)(FontPathElementPtr /* fpe */,
135			  FontPtr * /* pFont */,
136			  int /* flags */,
137			  FontEntryPtr /* entry */,
138			  char * /* fileName */,
139			  fsBitmapFormat /* format */,
140			  fsBitmapFormatMask /* mask */,
141			  FontPtr /* non_cachable_font */);
142    int	    (*OpenScalable)(FontPathElementPtr /* fpe */,
143			    FontPtr * /* pFont */,
144			    int /* flags */,
145			    FontEntryPtr /* entry */,
146			    char * /* fileName */,
147			    FontScalablePtr /* vals */,
148			    fsBitmapFormat /* format */,
149			    fsBitmapFormatMask /* fmask */,
150			    FontPtr /* non_cachable_font */);
151    int	    (*GetInfoBitmap)(FontPathElementPtr /* fpe */,
152			     FontInfoPtr /* pFontInfo */,
153			     FontEntryPtr /* entry */,
154			     char * /*fileName */);
155    int	    (*GetInfoScalable)(FontPathElementPtr /* fpe */,
156			       FontInfoPtr /* pFontInfo */,
157			       FontEntryPtr /* entry */,
158			       FontNamePtr /* fontName */,
159			       char * /* fileName */,
160			       FontScalablePtr /* vals */);
161    int	    number;
162    int     capabilities;	/* Bitmap components defined above */
163} FontRendererRec;
164
165typedef struct _FontRenders {
166    int		    number;
167    struct _FontRenderersElement {
168        /* In order to preserve backward compatibility, the
169           priority field is made invisible to renderers */
170        FontRendererPtr renderer;
171        int priority;
172    } *renderers;
173} FontRenderersRec, *FontRenderersPtr;
174
175typedef struct _BitmapInstance {
176    FontScalableRec	vals;
177    FontBitmapEntryPtr	bitmap;
178} BitmapInstanceRec, *BitmapInstancePtr;
179
180typedef struct _BitmapScalablePrivate {
181    int			numInstances;
182    BitmapInstancePtr	instances;
183} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr;
184
185typedef struct _BitmapSources {
186    FontPathElementPtr	*fpe;
187    int			size;
188    int			count;
189} BitmapSourcesRec, *BitmapSourcesPtr;
190
191extern BitmapSourcesRec	FontFileBitmapSources;
192
193/* Defines for FontFileFindNamesInScalableDir() behavior */
194#define NORMAL_ALIAS_BEHAVIOR		0
195#define LIST_ALIASES_AND_TARGET_NAMES   (1<<0)
196#define IGNORE_SCALABLE_ALIASES		(1<<1)
197
198#endif /* _FONTFILEST_H_ */
199