Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | |
| 3 | enum data_types {dfChar, dfShort, dfLong, dfString}; |
| 4 | |
| 5 | #define ERROR_DATA 1 |
| 6 | #define ERROR_VERSION 2 |
| 7 | #define ERROR_SIZE 3 |
| 8 | #define ERROR_MEMORY 4 |
| 9 | #define ERROR_FILE 5 |
| 10 | |
| 11 | typedef struct tagFontHeader |
| 12 | { |
| 13 | unsigned char dfVersion[2]; /* Version (always 0x3000) */ |
| 14 | unsigned char dfSize[4]; /* Total File Size */ |
| 15 | unsigned char dfCopyright[60]; /* Copyright notice */ |
| 16 | unsigned char dfType[2]; /* Vector or bitmap font */ |
| 17 | unsigned char dfPoints[2]; /* Nominal point size */ |
| 18 | unsigned char dfVertRes[2]; /* Vertical Resolution */ |
| 19 | unsigned char dfHorizRes[2]; /* Horizontal Resolutionchar */ |
| 20 | unsigned char dfAscent[2]; /* Character ascent in pixels */ |
| 21 | unsigned char dfInternalLeading[2]; /* Leading included in character defn */ |
| 22 | unsigned char dfExternalLeading[2]; /* Leading to be added by Windows */ |
| 23 | unsigned char dfItalic[1]; /* 1=Italic font */ |
| 24 | unsigned char dfUnderline[1]; /* 1=underlined font */ |
| 25 | unsigned char dfStrikeOut[1]; /* 1=strike-out font */ |
| 26 | unsigned char dfWeight[2]; /* Weight: 400=normal */ |
| 27 | unsigned char dfCharSet[1]; /* Character Set for this font */ |
| 28 | unsigned char dfPixWidth[2]; /* Character width (0 for proportional) */ |
| 29 | unsigned char dfPixHeight[2]; /* Character height */ |
| 30 | unsigned char dfPitchAndFamily[1]; /* Font Pitch and family */ |
| 31 | unsigned char dfAvgWidth[2]; /* Average character width */ |
| 32 | unsigned char dfMaxWidth[2]; /* Maximum character width */ |
| 33 | unsigned char dfFirstChar[1]; /* Firwst character of the font */ |
| 34 | unsigned char dfLastChar[1]; /* Last character of the font */ |
| 35 | unsigned char dfDefaultChar[1]; /* Missing character */ |
| 36 | unsigned char dfBreakChar[1]; /* Character to indicate word breaks */ |
| 37 | unsigned char dfWidthBytes[2]; /* Number of bytes in each row */ |
| 38 | unsigned char dfDevice[4]; /* Offset to device name */ |
| 39 | unsigned char dfFace[4]; /* Offset to type face name */ |
| 40 | unsigned char dfBitsPointer[4]; |
| 41 | unsigned char dfBitsOffset[4]; /* Offset to bitmaps */ |
| 42 | unsigned char dfReserved[1]; |
| 43 | unsigned char dfFlags[4]; /* Bitmapped flags */ |
| 44 | unsigned char dfAspace[2]; |
| 45 | unsigned char dfBspace[2]; |
| 46 | unsigned char dfCspace[2]; |
| 47 | unsigned char dfColorTable[2]; /* Offset to Color table */ |
| 48 | unsigned char dfReserved1[4]; |
| 49 | } fnt_hdrS; |
| 50 | |
| 51 | typedef struct WinCharStruct |
| 52 | { |
| 53 | unsigned int charWidth; |
| 54 | unsigned int charOffset; |
| 55 | } WinCharS; |
| 56 | |
| 57 | typedef struct fntFontStruct |
| 58 | { |
| 59 | fnt_hdrS hdr; |
| 60 | WinCharS *dfCharTable; |
| 61 | unsigned char *dfDeviceP; |
| 62 | unsigned char *dfFaceP; |
| 63 | unsigned char *dfBitsPointerP; |
| 64 | unsigned char *dfBitsOffsetP; |
| 65 | short *dfColorTableP; |
| 66 | } fnt_fontS; |
| 67 | |
| 68 | extern int return_data_value(enum data_types, void *); |
| 69 | |
| 70 | extern int dump_bdf(fnt_fontS*, unsigned char* ); |
| 71 | extern int dump_bdf_hdr(FILE* fp,fnt_fontS*, unsigned char* ); |
| 72 | |
| 73 | extern int parse_fnt_data(unsigned char* file_buffer, int length); |
| 74 | |