1 /***********************************************************
2 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
3 
4                         All Rights Reserved
5 
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any purpose and without fee is hereby granted,
8 provided that the above copyright notice appear in all copies and that
9 both that copyright notice and this permission notice appear in
10 supporting documentation, and that the name of Digital not be
11 used in advertising or publicity pertaining to distribution of the
12 software without specific, written prior permission.
13 
14 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 SOFTWARE.
21 
22 ******************************************************************/
23 
24 #ifndef FONT_H
25 #define FONT_H
26 
27 #include <X11/Xfuncproto.h>
28 
29 #ifndef BitmapFormatByteOrderMask
30 #include	"fsmasks.h"
31 #endif
32 
33 /* data structures */
34 #ifndef _XTYPEDEF_FONTPTR
35 typedef struct _Font *FontPtr;
36 #define _XTYPEDEF_FONTPTR
37 #endif
38 
39 typedef struct _FontInfo *FontInfoPtr;
40 typedef struct _FontProp *FontPropPtr;
41 typedef struct _ExtentInfo *ExtentInfoPtr;
42 typedef struct _FontPathElement *FontPathElementPtr;
43 
44 #ifndef _XTYPEDEF_CHARINFOPTR
45 typedef struct _CharInfo *CharInfoPtr;
46 #define _XTYPEDEF_CHARINFOPTR
47 #endif
48 
49 typedef struct _FontNames *FontNamesPtr;
50 typedef struct _FontResolution *FontResolutionPtr;
51 
52 #define NullCharInfo	((CharInfoPtr) 0)
53 #define NullFont	((FontPtr) 0)
54 #define NullFontInfo	((FontInfoPtr) 0)
55 
56  /* draw direction */
57 #define LeftToRight 0
58 #define RightToLeft 1
59 #define BottomToTop 2
60 #define TopToBottom 3
61 typedef int DrawDirection;
62 
63 #define NO_SUCH_CHAR	-1
64 
65 
66 #define	FontAliasType	0x1000
67 
68 #define	AllocError	80
69 #define	StillWorking	81
70 #define	FontNameAlias	82
71 #define	BadFontName	83
72 #define	Suspended	84
73 #define	Successful	85
74 #define	BadFontPath	86
75 #define	BadCharRange	87
76 #define	BadFontFormat	88
77 #define	FPEResetFailed	89	/* for when an FPE reset won't work */
78 
79 /* OpenFont flags */
80 #define FontLoadInfo	0x0001
81 #define FontLoadProps	0x0002
82 #define FontLoadMetrics	0x0004
83 #define FontLoadBitmaps	0x0008
84 #define FontLoadAll	0x000f
85 #define	FontOpenSync	0x0010
86 #define FontReopen	0x0020
87 
88 /* Query flags */
89 #define	LoadAll		0x1
90 #define	FinishRamge	0x2
91 #define       EightBitFont    0x4
92 #define       SixteenBitFont  0x8
93 
94 /* Glyph Caching Modes */
95 #define CACHING_OFF 0
96 #define CACHE_16_BIT_GLYPHS 1
97 #define CACHE_ALL_GLYPHS 2
98 #define DEFAULT_GLYPH_CACHING_MODE CACHE_16_BIT_GLYPHS
99 extern int glyphCachingMode;
100 
101 struct _Client;
102 
103 extern int StartListFontsWithInfo(
104     struct _Client * /*client*/,
105     int /*length*/,
106     unsigned char * /*pattern*/,
107     int /*max_names*/
108 );
109 
110 extern FontNamesPtr MakeFontNamesRecord(
111     unsigned /* size */
112 );
113 
114 extern void FreeFontNames(
115     FontNamesPtr /* pFN*/
116 );
117 
118 extern int  AddFontNamesName(
119     FontNamesPtr /* names */,
120     char * /* name */,
121     int /* length */
122 );
123 
124 #if 0 /* unused */
125 extern int  FontToFSError();
126 extern FontResolutionPtr GetClientResolution();
127 #endif
128 
129 typedef struct _FontPatternCache    *FontPatternCachePtr;
130 
131 extern FontPatternCachePtr  MakeFontPatternCache (
132     void
133 );
134 
135 extern void		    FreeFontPatternCache (
136     FontPatternCachePtr /* cache */
137 );
138 
139 extern void		    EmptyFontPatternCache (
140     FontPatternCachePtr /* cache */
141 );
142 
143 extern void		    CacheFontPattern (
144     FontPatternCachePtr /* cache */,
145     const char * /* pattern */,
146     int /* patlen */,
147     FontPtr /* pFont */
148 );
149 extern _X_EXPORT FontResolutionPtr GetClientResolutions(
150     int * /* num */
151 );
152 
153 extern FontPtr		    FindCachedFontPattern (
154     FontPatternCachePtr /* cache */,
155     const char * /* pattern */,
156     int /* patlen */
157 );
158 
159 extern void		    RemoveCachedFontPattern (
160     FontPatternCachePtr /* cache */,
161     FontPtr /* pFont */
162 );
163 
164 typedef enum {
165     Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit
166 }           FontEncoding;
167 
168 #endif				/* FONT_H */
169