1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
/*
* Two interfaces to HBF files -- take your pick.
*
* Ross Paterson <rap@doc.ic.ac.uk>
*/
#ifndef _HBF_
#define _HBF_
/*
* $Id: hbf.h,v 1.1 1998/07/24 16:12:27 mleisher Exp $
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* $Id: HBF.PATCH,v 1.1 1998/07/24 16:12:11 mleisher Exp $
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __STDC__
# ifndef const
# define const
# endif
#endif
/*
* #1: a lightweight C interface.
*/
typedef unsigned int HBF_CHAR;
typedef struct {
unsigned short hbf_width;
unsigned short hbf_height;
short hbf_xDisplacement;
short hbf_yDisplacement;
} HBF_BBOX;
typedef struct {
/* fields corresponding to the definition */
HBF_BBOX hbf_bitmap_bbox; /* HBF_BITMAP_BOUNDING_BOX */
HBF_BBOX hbf_font_bbox; /* FONTBOUNDINGBOX */
} HBF;
extern HBF *hbfOpen(
#ifdef __STDC__
const char *filename
#endif
);
extern void hbfClose(
#ifdef __STDC__
HBF *hbf
#endif
);
extern const char *hbfProperty(
#ifdef __STDC__
HBF *hbf,
const char *propName
#endif
);
extern const unsigned char *hbfGetBitmap(
#ifdef __STDC__
HBF *hbf,
HBF_CHAR code
#endif
);
extern void hbfForEach(
#ifdef __STDC__
HBF *hbf,
void (*func)(HBF *sameHbf, HBF_CHAR code,
void *callback_data),
void *callback_data
#endif
);
extern const char *hbfFileName(
#ifdef __STDC__
HBF *hbf
#endif
);
extern long hbfChars(
#ifdef __STDC__
HBF *hbf
#endif
);
extern HBF_BBOX *hbfBitmapBBox(
#ifdef __STDC__
HBF *hbf
#endif
);
/* but defined here as a macro */
#define hbfBitmapBBox(hbf) (&((hbf)->hbf_bitmap_bbox))
extern HBF_BBOX *hbfFontBBox(
#ifdef __STDC__
HBF *hbf
#endif
);
/* but defined here as a macro */
#define hbfFontBBox(hbf) (&((hbf)->hbf_font_bbox))
#define HBF_RowSize(hbf)\
((hbfBitmapBBox(hbf)->hbf_width + 7)/8)
#define HBF_BitmapSize(hbf)\
(HBF_RowSize(hbf) * hbfBitmapBBox(hbf)->hbf_height)
#define HBF_GetBit(hbf,bitmap,x,y)\
(((bitmap)[(y)*HBF_RowSize(hbf) + (x)/8]>>(7 - (x)%8))&01)
extern int hbfDebug; /* set non-zero for error reporting */
/*
* #2: taken from Appendix 2 of the HBF draft.
*/
typedef unsigned int HBF_HzCode;
typedef unsigned char HBF_Byte ;
typedef HBF_Byte * HBF_BytePtr ;
typedef HBF * HBF_Handle ;
typedef HBF_Handle * HBF_HandlePtr ;
typedef char * String ;
extern int HBF_OpenFont(
#ifdef __STDC__
const char * filename,
HBF_HandlePtr ptrHandleStorage
#endif
);
extern int HBF_CloseFont(
#ifdef __STDC__
HBF_Handle handle
#endif
);
extern const char * HBF_GetProperty(
#ifdef __STDC__
HBF_Handle handle,
const char * propertyName
#endif
);
extern int HBF_GetFontBoundingBox(
#ifdef __STDC__
HBF_Handle handle,
unsigned int *width,
unsigned int *height,
int *xDisplacement,
int *yDisplacement
#endif
);
extern int HBF_GetBitmapBoundingBox(
#ifdef __STDC__
HBF_Handle handle,
unsigned int *width,
unsigned int *height,
int *xDisplacement,
int *yDisplacement
#endif
);
extern int HBF_GetBitmap(
#ifdef __STDC__
HBF_Handle handle,
HBF_HzCode hanziCode,
HBF_BytePtr ptrBitmapBuffer
#endif
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* ! _HBF_ */
|