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