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