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