upload tizen2.0 source
[framework/uifw/xorg/lib/libxfont.git] / include / X11 / fonts / bitmap.h
1 /*
2
3 Copyright 1990, 1998  The Open Group
4
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of The Open Group shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
25 from 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
46 typedef struct _BitmapExtra {
47     Atom       *glyphNames;
48     int        *sWidths;
49     CARD32      bitmapsSizes[GLYPHPADOPTIONS];
50     FontInfoRec info;
51 }           BitmapExtraRec, *BitmapExtraPtr;
52
53 typedef 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]):\
68 0)
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
77 extern int bitmapGetGlyphs ( FontPtr pFont, unsigned long count,
78                              unsigned char *chars, FontEncoding charEncoding,
79                              unsigned long *glyphCount, CharInfoPtr *glyphs );
80 extern int bitmapGetMetrics ( FontPtr pFont, unsigned long count,
81                               unsigned char *chars, FontEncoding charEncoding,
82                               unsigned long *glyphCount, xCharInfo **glyphs );
83
84 extern void bitmapComputeFontBounds ( FontPtr pFont );
85 extern void bitmapComputeFontInkBounds ( FontPtr pFont );
86 extern Bool bitmapAddInkMetrics ( FontPtr pFont );
87 extern int bitmapComputeWeight ( FontPtr pFont );
88
89 extern void BitmapRegisterFontFileFunctions ( void );
90
91 extern 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 );
96 extern int BitmapGetInfoScalable ( FontPathElementPtr fpe,
97                                    FontInfoPtr pFontInfo, FontEntryPtr entry,
98                                    FontNamePtr fontName, char *fileName,
99                                    FontScalablePtr vals );
100
101 #endif                          /* _BITMAP_H_ */