bitmap.h revision 41c30155
123a0898aSmrg/*
223a0898aSmrg
323a0898aSmrgCopyright 1990, 1998  The Open Group
423a0898aSmrg
523a0898aSmrgPermission to use, copy, modify, distribute, and sell this software and its
623a0898aSmrgdocumentation for any purpose is hereby granted without fee, provided that
723a0898aSmrgthe above copyright notice appear in all copies and that both that
823a0898aSmrgcopyright notice and this permission notice appear in supporting
923a0898aSmrgdocumentation.
1023a0898aSmrg
1123a0898aSmrgThe above copyright notice and this permission notice shall be included
1223a0898aSmrgin all copies or substantial portions of the Software.
1323a0898aSmrg
1423a0898aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1523a0898aSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1623a0898aSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1723a0898aSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1823a0898aSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1923a0898aSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2023a0898aSmrgOTHER DEALINGS IN THE SOFTWARE.
2123a0898aSmrg
2223a0898aSmrgExcept as contained in this notice, the name of The Open Group shall
2323a0898aSmrgnot be used in advertising or otherwise to promote the sale, use or
2423a0898aSmrgother dealings in this Software without prior written authorization
2523a0898aSmrgfrom The Open Group.
2623a0898aSmrg
2723a0898aSmrg*/
2823a0898aSmrg
2923a0898aSmrg/*
3023a0898aSmrg * Author:  Keith Packard, MIT X Consortium
3123a0898aSmrg */
3223a0898aSmrg
3323a0898aSmrg#ifndef _BITMAP_H_
3423a0898aSmrg#define _BITMAP_H_
3523a0898aSmrg
3623a0898aSmrg#include <X11/fonts/fntfilio.h>
3723a0898aSmrg#include <stdio.h>  /* just for NULL */
3823a0898aSmrg
3923a0898aSmrg/*
4023a0898aSmrg * Internal format used to store bitmap fonts
4123a0898aSmrg */
4223a0898aSmrg
4323a0898aSmrg/* number of encoding entries in one segment */
4423a0898aSmrg#define BITMAP_FONT_SEGMENT_SIZE 128
4523a0898aSmrg
4623a0898aSmrgtypedef struct _BitmapExtra {
4723a0898aSmrg    Atom       *glyphNames;
4823a0898aSmrg    int        *sWidths;
4923a0898aSmrg    CARD32      bitmapsSizes[GLYPHPADOPTIONS];
5023a0898aSmrg    FontInfoRec info;
5123a0898aSmrg}           BitmapExtraRec, *BitmapExtraPtr;
5223a0898aSmrg
5323a0898aSmrgtypedef struct _BitmapFont {
5423a0898aSmrg    unsigned    version_num;
5523a0898aSmrg    int         num_chars;
5623a0898aSmrg    int         num_tables;
5723a0898aSmrg    CharInfoPtr metrics;	/* font metrics, including glyph pointers */
5823a0898aSmrg    xCharInfo  *ink_metrics;	/* ink metrics */
5923a0898aSmrg    char       *bitmaps;	/* base of bitmaps, useful only to free */
6023a0898aSmrg    CharInfoPtr **encoding;	/* array of arrays of char info pointers */
6123a0898aSmrg    CharInfoPtr pDefault;	/* default character */
6223a0898aSmrg    BitmapExtraPtr bitmapExtra;	/* stuff not used by X server */
6323a0898aSmrg}           BitmapFontRec, *BitmapFontPtr;
6423a0898aSmrg
6523a0898aSmrg#define ACCESSENCODING(enc,i) \
6623a0898aSmrg(enc[(i)/BITMAP_FONT_SEGMENT_SIZE]?\
6723a0898aSmrg(enc[(i)/BITMAP_FONT_SEGMENT_SIZE][(i)%BITMAP_FONT_SEGMENT_SIZE]):\
6823a0898aSmrg0)
6923a0898aSmrg#define ACCESSENCODINGL(enc,i) \
7023a0898aSmrg(enc[(i)/BITMAP_FONT_SEGMENT_SIZE][(i)%BITMAP_FONT_SEGMENT_SIZE])
7123a0898aSmrg
7223a0898aSmrg#define SEGMENT_MAJOR(n) ((n)/BITMAP_FONT_SEGMENT_SIZE)
7323a0898aSmrg#define SEGMENT_MINOR(n) ((n)%BITMAP_FONT_SEGMENT_SIZE)
7423a0898aSmrg#define NUM_SEGMENTS(n) \
7523a0898aSmrg  (((n)+BITMAP_FONT_SEGMENT_SIZE-1)/BITMAP_FONT_SEGMENT_SIZE)
7623a0898aSmrg
7741c30155Smrgextern int bitmapGetGlyphs ( FontPtr pFont, unsigned long count,
7841c30155Smrg			     unsigned char *chars, FontEncoding charEncoding,
7923a0898aSmrg			     unsigned long *glyphCount, CharInfoPtr *glyphs );
8041c30155Smrgextern int bitmapGetMetrics ( FontPtr pFont, unsigned long count,
8123a0898aSmrg			      unsigned char *chars, FontEncoding charEncoding,
8223a0898aSmrg			      unsigned long *glyphCount, xCharInfo **glyphs );
8323a0898aSmrg
8423a0898aSmrgextern void bitmapComputeFontBounds ( FontPtr pFont );
8523a0898aSmrgextern void bitmapComputeFontInkBounds ( FontPtr pFont );
8623a0898aSmrgextern Bool bitmapAddInkMetrics ( FontPtr pFont );
8723a0898aSmrgextern int bitmapComputeWeight ( FontPtr pFont );
8823a0898aSmrg
8923a0898aSmrgextern void BitmapRegisterFontFileFunctions ( void );
9023a0898aSmrg
9141c30155Smrgextern int BitmapOpenScalable ( FontPathElementPtr fpe, FontPtr *pFont,
9223a0898aSmrg				int flags, FontEntryPtr entry, char *fileName,
9341c30155Smrg				FontScalablePtr vals, fsBitmapFormat format,
9441c30155Smrg				fsBitmapFormatMask fmask,
9523a0898aSmrg				FontPtr non_cachable_font );
9641c30155Smrgextern int BitmapGetInfoScalable ( FontPathElementPtr fpe,
9741c30155Smrg				   FontInfoPtr pFontInfo, FontEntryPtr entry,
9841c30155Smrg				   FontNamePtr fontName, char *fileName,
9923a0898aSmrg				   FontScalablePtr vals );
10023a0898aSmrg
10123a0898aSmrg#endif				/* _BITMAP_H_ */
102