1
/* $Xorg: fontstruct.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
2
/***********************************************************
3
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
7
Permission to use, copy, modify, and distribute this software and its
8
documentation for any purpose and without fee is hereby granted,
9
provided that the above copyright notice appear in all copies and that
10
both that copyright notice and this permission notice appear in
11
supporting documentation, and that the name of Digital not be
12
used in advertising or publicity pertaining to distribution of the
13
software without specific, written prior permission.
15
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23
******************************************************************/
24
/* $XFree86: xc/include/fonts/fontstruct.h,v 3.3 1999/08/21 13:47:34 dawes Exp $ */
29
#include <X11/Xproto.h>
31
#include <X11/Xfuncproto.h>
32
#include <X11/Xdefs.h>
35
* This version of the server font data strucutre is only for describing
36
* the in memory data structure. The file structure is not necessarily a
37
* copy of this. That is up to the compiler and the OS layer font loading
41
#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */
43
typedef struct _FontProp {
45
long value; /* assumes ATOM is not larger than INT32 */
48
typedef struct _FontResolution {
49
unsigned short x_resolution;
50
unsigned short y_resolution;
51
unsigned short point_size;
54
typedef struct _ExtentInfo {
55
DrawDirection drawDirection;
65
typedef struct _CharInfo {
66
xCharInfo metrics; /* info preformatted for Queries */
67
char *bits; /* pointer to glyph image */
71
* Font is created at font load time. It is specific to a single encoding.
72
* e.g. not all of the glyphs in a font may be part of a single encoding.
75
typedef struct _FontInfo {
76
unsigned short firstCol;
77
unsigned short lastCol;
78
unsigned short firstRow;
79
unsigned short lastRow;
80
unsigned short defaultCh;
81
unsigned int noOverlap:1;
82
unsigned int terminalFont:1;
83
unsigned int constantMetrics:1;
84
unsigned int constantWidth:1;
85
unsigned int inkInside:1;
86
unsigned int inkMetrics:1;
87
unsigned int allExist:1;
88
unsigned int drawDirection:2;
89
unsigned int cachable:1;
90
unsigned int anamorphic:1;
95
xCharInfo ink_maxbounds;
96
xCharInfo ink_minbounds;
104
typedef struct _Font {
111
fsBitmapFormat format;
112
int (*get_glyphs) (FontPtr /* font */,
113
unsigned long /* count */,
114
unsigned char * /* chars */,
115
FontEncoding /* encoding */,
116
unsigned long * /* count */,
117
CharInfoPtr * /* glyphs */);
118
int (*get_metrics) (FontPtr /* font */,
119
unsigned long /* count */,
120
unsigned char * /* chars */,
121
FontEncoding /* encoding */,
122
unsigned long * /* count */,
123
xCharInfo ** /* glyphs */);
124
void (*unload_font) (FontPtr /* font */);
125
void (*unload_glyphs) (FontPtr /* font */);
126
FontPathElementPtr fpe;
131
pointer *devPrivates;
134
#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (pointer) 0 : \
135
(pFont)->devPrivates[n])
137
#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \
138
_FontSetNewPrivate (pFont, n, ptr) : \
139
((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE))
141
typedef struct _FontNames {
148
/* External view of font paths */
149
typedef struct _FontPathElement {
155
} FontPathElementRec;
157
typedef Bool (*NameCheckFunc) (char *name);
158
typedef int (*InitFpeFunc) (FontPathElementPtr fpe);
159
typedef int (*FreeFpeFunc) (FontPathElementPtr fpe);
160
typedef int (*ResetFpeFunc) (FontPathElementPtr fpe);
161
typedef int (*OpenFontFunc) ( pointer client,
162
FontPathElementPtr fpe,
166
fsBitmapFormat format,
167
fsBitmapFormatMask fmask,
171
FontPtr non_cachable_font);
172
typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont);
173
typedef int (*ListFontsFunc) (pointer client,
174
FontPathElementPtr fpe,
180
typedef int (*StartLfwiFunc) (pointer client,
181
FontPathElementPtr fpe,
187
typedef int (*NextLfwiFunc) (pointer client,
188
FontPathElementPtr fpe,
195
typedef int (*WakeupFpeFunc) (FontPathElementPtr fpe,
196
unsigned long* LastSelectMask);
198
typedef void (*ClientDiedFunc) (pointer client,
199
FontPathElementPtr fpe);
201
typedef int (*LoadGlyphsFunc) (pointer client,
206
unsigned char* data);
208
typedef int (*StartLaFunc) (pointer client,
209
FontPathElementPtr fpe,
215
typedef int (*NextLaFunc) (pointer client,
216
FontPathElementPtr fpe,
223
typedef void (*SetPathFunc)(void);
225
typedef struct _FPEFunctions {
226
NameCheckFunc name_check;
227
InitFpeFunc init_fpe;
228
ResetFpeFunc reset_fpe;
229
FreeFpeFunc free_fpe;
230
OpenFontFunc open_font;
231
CloseFontFunc close_font;
232
ListFontsFunc list_fonts;
233
StartLaFunc start_list_fonts_and_aliases;
234
NextLaFunc list_next_font_or_alias;
235
StartLfwiFunc start_list_fonts_with_info;
236
NextLfwiFunc list_next_font_with_info;
237
WakeupFpeFunc wakeup_fpe;
238
ClientDiedFunc client_died;
239
/* for load_glyphs, range_flag = 0 ->
240
nchars = # of characters in data
241
item_size = bytes/char
242
data = list of characters
244
nchars = # of fsChar2b's in data
246
data = list of fsChar2b's */
247
LoadGlyphsFunc load_glyphs;
248
SetPathFunc set_path_hook;
249
} FPEFunctionsRec, FPEFunctions;
252
* Various macros for computing values based on contents of
253
* the above structures
256
#define GLYPHWIDTHPIXELS(pci) \
257
((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
259
#define GLYPHHEIGHTPIXELS(pci) \
260
((pci)->metrics.ascent + (pci)->metrics.descent)
262
#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
264
#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7)
266
#define BYTES_PER_ROW(bits, nbytes) \
267
((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
268
:(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
269
:(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
270
:(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
273
#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \
274
BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad))
276
* Macros for computing different bounding boxes for fonts; from
280
#define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \
281
(pi)->fontAscent : (pi)->ink_maxbounds.ascent)
282
#define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \
283
(pi)->fontDescent : (pi)->ink_maxbounds.descent)
284
#define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi))
285
#define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \
286
(pi)->ink_minbounds.leftSideBearing : 0)
287
#define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \
288
(pi)->ink_maxbounds.characterWidth ? \
289
(pi)->ink_maxbounds.rightSideBearing : \
290
(pi)->ink_maxbounds.characterWidth)
291
#define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi))
293
#include "fontproto.h"
295
#endif /* FONTSTR_H */