1/*
2
3Copyright 1991, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in 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 _FONTFILE_H_
32#define _FONTFILE_H_
33
34#include <X11/fonts/fontxlfd.h>
35
36typedef struct _FontEntry	    *FontEntryPtr;
37typedef struct _FontTable	    *FontTablePtr;
38typedef struct _FontName	    *FontNamePtr;
39typedef struct _FontScaled	    *FontScaledPtr;
40typedef struct _FontScalableExtra   *FontScalableExtraPtr;
41typedef struct _FontScalableEntry   *FontScalableEntryPtr;
42typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr;
43typedef struct _FontBitmapEntry	    *FontBitmapEntryPtr;
44typedef struct _FontAliasEntry	    *FontAliasEntryPtr;
45typedef struct _FontBCEntry	    *FontBCEntryPtr;
46typedef struct _FontDirectory	    *FontDirectoryPtr;
47typedef struct _FontRenderer	    *FontRendererPtr;
48
49#define NullFontEntry		    ((FontEntryPtr) 0)
50#define NullFontTable		    ((FontTablePtr) 0)
51#define NullFontName		    ((FontNamePtr) 0)
52#define NullFontScaled		    ((FontScaled) 0)
53#define NullFontScalableExtra	    ((FontScalableExtra) 0)
54#define NullFontscalableEntry	    ((FontScalableEntry) 0)
55#define NullFontScaleAliasEntry	    ((FontScaleAliasEntry) 0)
56#define NullFontBitmapEntry	    ((FontBitmapEntry) 0)
57#define NullFontAliasEntry	    ((FontAliasEntry) 0)
58#define NullFontBCEntry		    ((FontBCEntry) 0)
59#define NullFontDirectory	    ((FontDirectoryPtr) 0)
60#define NullFontRenderer	    ((FontRendererPtr) 0)
61
62#define FONT_ENTRY_SCALABLE	0
63#define FONT_ENTRY_SCALE_ALIAS	1
64#define FONT_ENTRY_BITMAP	2
65#define FONT_ENTRY_ALIAS	3
66#define FONT_ENTRY_BC		4
67
68#define MAXFONTNAMELEN	    1024
69#define MAXFONTFILENAMELEN  1024
70
71#define FontDirFile	    "fonts.dir"
72#define FontAliasFile	    "fonts.alias"
73#define FontScalableFile    "fonts.scale"
74
75extern int FontFileNameCheck ( const char *name );
76extern int FontFileInitFPE ( FontPathElementPtr fpe );
77extern int FontFileResetFPE ( FontPathElementPtr fpe );
78extern int FontFileFreeFPE ( FontPathElementPtr fpe );
79extern int FontFileOpenFont ( pointer client, FontPathElementPtr fpe,
80			      Mask flags, const char *name, int namelen,
81			      fsBitmapFormat format, fsBitmapFormatMask fmask,
82			      XID id, FontPtr *pFont, char **aliasName,
83			      FontPtr non_cachable_font );
84extern void FontFileCloseFont ( FontPathElementPtr fpe, FontPtr pFont );
85extern int FontFileOpenBitmap ( FontPathElementPtr fpe, FontPtr *pFont,
86				int flags, FontEntryPtr entry,
87				fsBitmapFormat format,
88				fsBitmapFormatMask fmask );
89extern int FontFileListFonts ( pointer client, FontPathElementPtr fpe,
90			       const char *pat, int len, int max,
91			       FontNamesPtr names );
92extern int FontFileStartListFonts ( pointer client, FontPathElementPtr fpe,
93				    const char *pat, int len, int max,
94				    pointer *privatep, int mark_aliases );
95extern int FontFileStartListFontsWithInfo ( pointer client,
96					    FontPathElementPtr fpe,
97					    const char *pat, int len, int max,
98					    pointer *privatep );
99extern int FontFileListNextFontWithInfo ( pointer client,
100					  FontPathElementPtr fpe,
101					  char **namep, int *namelenp,
102					  FontInfoPtr *pFontInfo,
103					  int *numFonts, pointer private );
104extern int FontFileStartListFontsAndAliases ( pointer client,
105					      FontPathElementPtr fpe,
106					      const char *pat, int len, int max,
107					      pointer *privatep );
108extern int FontFileListNextFontOrAlias ( pointer client,
109					 FontPathElementPtr fpe,
110					 char **namep, int *namelenp,
111					 char **resolvedp, int *resolvedlenp,
112					 pointer private );
113extern void FontFileRegisterLocalFpeFunctions ( void );
114extern void CatalogueRegisterLocalFpeFunctions ( void );
115
116
117extern FontEntryPtr FontFileAddEntry ( FontTablePtr table,
118				       FontEntryPtr prototype );
119extern Bool FontFileAddFontAlias ( FontDirectoryPtr dir, char *aliasName,
120				   char *fontName );
121extern Bool FontFileAddFontFile ( FontDirectoryPtr dir, char *fontName,
122				  char *fileName );
123extern int FontFileCountDashes ( char *name, int namelen );
124extern FontEntryPtr FontFileFindNameInDir ( FontTablePtr table,
125					    FontNamePtr pat );
126extern FontEntryPtr FontFileFindNameInScalableDir ( FontTablePtr table,
127						    FontNamePtr pat,
128						    FontScalablePtr vals );
129extern int FontFileFindNamesInDir ( FontTablePtr table, FontNamePtr pat,
130				    int max, FontNamesPtr names );
131extern int FontFileFindNamesInScalableDir ( FontTablePtr table,
132					    FontNamePtr pat, int max,
133					    FontNamesPtr names,
134					    FontScalablePtr vals,
135					    int alias_behavior, int *newmax );
136
137extern void FontFileFreeDir ( FontDirectoryPtr dir );
138extern void FontFileFreeEntry ( FontEntryPtr entry );
139extern void FontFileFreeTable ( FontTablePtr table );
140extern Bool FontFileInitTable ( FontTablePtr table, int size );
141extern FontDirectoryPtr FontFileMakeDir ( const char *dirName, int size );
142extern Bool FontFileMatchName ( char *name, int length, FontNamePtr pat );
143extern char * FontFileSaveString ( char *s );
144extern void FontFileSortDir ( FontDirectoryPtr dir );
145extern void FontFileSortTable ( FontTablePtr table );
146
147extern void FontDefaultFormat ( int *bit, int *byte, int *glyph, int *scan );
148
149extern Bool FontFileRegisterRenderer ( FontRendererPtr renderer );
150extern Bool FontFilePriorityRegisterRenderer ( FontRendererPtr renderer,
151                                               int priority );
152extern FontRendererPtr FontFileMatchRenderer ( char *fileName );
153
154extern Bool FontFileAddScaledInstance ( FontEntryPtr entry,
155					FontScalablePtr vals, FontPtr pFont,
156					char *bitmapName );
157extern void FontFileSwitchStringsToBitmapPointers ( FontDirectoryPtr dir );
158extern void FontFileRemoveScaledInstance ( FontEntryPtr entry, FontPtr pFont );
159extern Bool FontFileCompleteXLFD ( FontScalablePtr vals, FontScalablePtr def );
160extern FontScaledPtr FontFileFindScaledInstance ( FontEntryPtr entry,
161						  FontScalablePtr vals,
162						  int noSpecificSize );
163
164extern Bool FontFileRegisterBitmapSource ( FontPathElementPtr fpe );
165extern void FontFileUnregisterBitmapSource ( FontPathElementPtr fpe );
166extern void FontFileEmptyBitmapSource ( void );
167extern int FontFileMatchBitmapSource ( FontPathElementPtr fpe,
168				       FontPtr *pFont, int flags,
169				       FontEntryPtr entry,
170				       FontNamePtr zeroPat,
171				       FontScalablePtr vals,
172				       fsBitmapFormat format,
173				       fsBitmapFormatMask fmask,
174				       Bool noSpecificSize );
175
176extern int FontFileReadDirectory ( const char *directory, FontDirectoryPtr *pdir );
177extern Bool FontFileDirectoryChanged ( FontDirectoryPtr dir );
178
179#endif /* _FONTFILE_H_ */
180