VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.5/X11/fonts/fontstruct.h@ 17240

Last change on this file since 17240 was 17240, checked in by vboxsync, 16 years ago

Additions/x11/x11include: blast! Done it again. Reverted r43561.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 9.3 KB
Line 
1/* $Xorg: fontstruct.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
2/***********************************************************
3Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
4
5 All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the name of Digital not be
12used in advertising or publicity pertaining to distribution of the
13software without specific, written prior permission.
14
15DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21SOFTWARE.
22
23******************************************************************/
24/* $XFree86: xc/include/fonts/fontstruct.h,v 3.3 1999/08/21 13:47:34 dawes Exp $ */
25
26#ifndef FONTSTR_H
27#define FONTSTR_H
28
29#include <X11/Xproto.h>
30#include "font.h"
31#include <X11/Xfuncproto.h>
32#include <X11/Xdefs.h>
33
34/*
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
38 * machinery.
39 */
40
41#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */
42
43typedef struct _FontProp {
44 long name;
45 long value; /* assumes ATOM is not larger than INT32 */
46} FontPropRec;
47
48typedef struct _FontResolution {
49 unsigned short x_resolution;
50 unsigned short y_resolution;
51 unsigned short point_size;
52} FontResolutionRec;
53
54typedef struct _ExtentInfo {
55 DrawDirection drawDirection;
56 int fontAscent;
57 int fontDescent;
58 int overallAscent;
59 int overallDescent;
60 int overallWidth;
61 int overallLeft;
62 int overallRight;
63} ExtentInfoRec;
64
65typedef struct _CharInfo {
66 xCharInfo metrics; /* info preformatted for Queries */
67 char *bits; /* pointer to glyph image */
68} CharInfoRec;
69
70/*
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.
73 */
74
75typedef 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;
91 short maxOverlap;
92 short pad;
93 xCharInfo maxbounds;
94 xCharInfo minbounds;
95 xCharInfo ink_maxbounds;
96 xCharInfo ink_minbounds;
97 short fontAscent;
98 short fontDescent;
99 int nprops;
100 FontPropPtr props;
101 char *isStringProp;
102} FontInfoRec;
103
104typedef struct _Font {
105 int refcnt;
106 FontInfoRec info;
107 char bit;
108 char byte;
109 char glyph;
110 char scan;
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;
127 pointer svrPrivate;
128 pointer fontPrivate;
129 pointer fpePrivate;
130 int maxPrivate;
131 pointer *devPrivates;
132} FontRec;
133
134#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (pointer) 0 : \
135 (pFont)->devPrivates[n])
136
137#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \
138 _FontSetNewPrivate (pFont, n, ptr) : \
139 ((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE))
140
141typedef struct _FontNames {
142 int nnames;
143 int size;
144 int *length;
145 char **names;
146} FontNamesRec;
147
148/* External view of font paths */
149typedef struct _FontPathElement {
150 int name_length;
151 char *name;
152 int type;
153 int refcount;
154 pointer private;
155} FontPathElementRec;
156
157typedef Bool (*NameCheckFunc) (char *name);
158typedef int (*InitFpeFunc) (FontPathElementPtr fpe);
159typedef int (*FreeFpeFunc) (FontPathElementPtr fpe);
160typedef int (*ResetFpeFunc) (FontPathElementPtr fpe);
161typedef int (*OpenFontFunc) ( pointer client,
162 FontPathElementPtr fpe,
163 Mask flags,
164 char* name,
165 int namelen,
166 fsBitmapFormat format,
167 fsBitmapFormatMask fmask,
168 XID id,
169 FontPtr* pFont,
170 char** aliasName,
171 FontPtr non_cachable_font);
172typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont);
173typedef int (*ListFontsFunc) (pointer client,
174 FontPathElementPtr fpe,
175 char* pat,
176 int len,
177 int max,
178 FontNamesPtr names);
179
180typedef int (*StartLfwiFunc) (pointer client,
181 FontPathElementPtr fpe,
182 char* pat,
183 int len,
184 int max,
185 pointer* privatep);
186
187typedef int (*NextLfwiFunc) (pointer client,
188 FontPathElementPtr fpe,
189 char** name,
190 int* namelen,
191 FontInfoPtr* info,
192 int* numFonts,
193 pointer private);
194
195typedef int (*WakeupFpeFunc) (FontPathElementPtr fpe,
196 unsigned long* LastSelectMask);
197
198typedef void (*ClientDiedFunc) (pointer client,
199 FontPathElementPtr fpe);
200
201typedef int (*LoadGlyphsFunc) (pointer client,
202 FontPtr pfont,
203 Bool range_flag,
204 unsigned int nchars,
205 int item_size,
206 unsigned char* data);
207
208typedef int (*StartLaFunc) (pointer client,
209 FontPathElementPtr fpe,
210 char* pat,
211 int len,
212 int max,
213 pointer* privatep);
214
215typedef int (*NextLaFunc) (pointer client,
216 FontPathElementPtr fpe,
217 char** namep,
218 int* namelenp,
219 char** resolvedp,
220 int* resolvedlenp,
221 pointer private);
222
223typedef void (*SetPathFunc)(void);
224
225typedef 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
243 range_flag = 1 ->
244 nchars = # of fsChar2b's in data
245 item_size is ignored
246 data = list of fsChar2b's */
247 LoadGlyphsFunc load_glyphs;
248 SetPathFunc set_path_hook;
249} FPEFunctionsRec, FPEFunctions;
250
251/*
252 * Various macros for computing values based on contents of
253 * the above structures
254 */
255
256#define GLYPHWIDTHPIXELS(pci) \
257 ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
258
259#define GLYPHHEIGHTPIXELS(pci) \
260 ((pci)->metrics.ascent + (pci)->metrics.descent)
261
262#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
263
264#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7)
265
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 */ \
271 : 0)
272
273#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \
274 BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad))
275/*
276 * Macros for computing different bounding boxes for fonts; from
277 * the font protocol
278 */
279
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))
292
293#include "fontproto.h"
294
295#endif /* FONTSTR_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette