1/*
2
3Copyright 1990, 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
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26
27*/
28
29/*
30 * Author:  Keith Packard, MIT X Consortium
31 */
32
33#ifndef _BITMAP_H_
34#define _BITMAP_H_
35
36#include <X11/fonts/fntfilio.h>
37#include <stdio.h>  /* just for NULL */
38
39/*
40 * Internal format used to store bitmap fonts
41 */
42
43/* number of encoding entries in one segment */
44#define BITMAP_FONT_SEGMENT_SIZE 128
45
46typedef struct _BitmapExtra {
47    Atom       *glyphNames;
48    int        *sWidths;
49    CARD32      bitmapsSizes[GLYPHPADOPTIONS];
50    FontInfoRec info;
51}           BitmapExtraRec, *BitmapExtraPtr;
52
53typedef struct _BitmapFont {
54    unsigned    version_num;
55    int         num_chars;
56    int         num_tables;
57    CharInfoPtr metrics;	/* font metrics, including glyph pointers */
58    xCharInfo  *ink_metrics;	/* ink metrics */
59    char       *bitmaps;	/* base of bitmaps, useful only to free */
60    CharInfoPtr **encoding;	/* array of arrays of char info pointers */
61    CharInfoPtr pDefault;	/* default character */
62    BitmapExtraPtr bitmapExtra;	/* stuff not used by X server */
63}           BitmapFontRec, *BitmapFontPtr;
64
65#define ACCESSENCODING(enc,i) \
66(enc[(i)/BITMAP_FONT_SEGMENT_SIZE]?\
67(enc[(i)/BITMAP_FONT_SEGMENT_SIZE][(i)%BITMAP_FONT_SEGMENT_SIZE]):\
680)
69#define ACCESSENCODINGL(enc,i) \
70(enc[(i)/BITMAP_FONT_SEGMENT_SIZE][(i)%BITMAP_FONT_SEGMENT_SIZE])
71
72#define SEGMENT_MAJOR(n) ((n)/BITMAP_FONT_SEGMENT_SIZE)
73#define SEGMENT_MINOR(n) ((n)%BITMAP_FONT_SEGMENT_SIZE)
74#define NUM_SEGMENTS(n) \
75  (((n)+BITMAP_FONT_SEGMENT_SIZE-1)/BITMAP_FONT_SEGMENT_SIZE)
76
77extern int bitmapGetGlyphs ( FontPtr pFont, unsigned long count,
78			     unsigned char *chars, FontEncoding charEncoding,
79			     unsigned long *glyphCount, CharInfoPtr *glyphs );
80extern int bitmapGetMetrics ( FontPtr pFont, unsigned long count,
81			      unsigned char *chars, FontEncoding charEncoding,
82			      unsigned long *glyphCount, xCharInfo **glyphs );
83
84extern void bitmapComputeFontBounds ( FontPtr pFont );
85extern void bitmapComputeFontInkBounds ( FontPtr pFont );
86extern Bool bitmapAddInkMetrics ( FontPtr pFont );
87extern int bitmapComputeWeight ( FontPtr pFont );
88
89extern void BitmapRegisterFontFileFunctions ( void );
90
91extern int BitmapOpenScalable ( FontPathElementPtr fpe, FontPtr *pFont,
92				int flags, FontEntryPtr entry, char *fileName,
93				FontScalablePtr vals, fsBitmapFormat format,
94				fsBitmapFormatMask fmask,
95				FontPtr non_cachable_font );
96extern int BitmapGetInfoScalable ( FontPathElementPtr fpe,
97				   FontInfoPtr pFontInfo, FontEntryPtr entry,
98				   FontNamePtr fontName, char *fileName,
99				   FontScalablePtr vals );
100
101#endif				/* _BITMAP_H_ */
102