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