summaryrefslogtreecommitdiff
path: root/tools/bdf2ajf.h
blob: 6367fae00bd6267cd553a3fe6a1f171181e3c062 (plain)
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
/**
* Copyright (C) 2002 Alex Gitelman
*
*/
#ifndef __BDF2AJF__
#define __BDF2AJF__

#include "../firmware/ajf.h"


#define STARTFONT "STARTFONT"
#define ENDFONT "ENDFONT"
#define COMMENT  "COMMENT"
#define FONT "FONT"
#define SIZE "SIZE"
#define FONTBOUNDINGBOX  "FONTBOUNDINGBOX"
#define STARTPROPERTIES   "STARTPROPERTIES"
#define ENDPROPERTIES   "ENDPROPERTIES"
#define CHARS   "CHARS"
#define STARTCHAR   "STARTCHAR"
#define ENDCHAR   "ENDCHAR"
#define ENCODING   "ENCODING"
#define SWIDTH   "SWIDTH"
#define DWIDTH   "DWIDTH"
#define BBX   "BBX"
#define BITMAP   "BITMAP"

typedef struct 
{
    char *glyph_name;
    int encoding;
    int swidth_x;
    int swidth_y;
    int dwidth_x;
    int dwidth_y;
    int bbx_width;
    int bbx_height;
    int bbx_disp_x;
    int bbx_disp_y;
    unsigned char *bitmap;
    short bitmap_len;
} BDF_GLYPH;

typedef struct 
{
    char *bdf_ver;
    char *name;
    int point_size;
    int x_res;
    int y_res;
    int bound_width;
    int bound_height;
    int bound_disp_x;
    int bound_disp_y;
    int prop_count;
    char **prop_name;
    char **prop_value;
    int char_count;
    BDF_GLYPH** glyph;
    BDF_GLYPH* enc_table[256];
} BDF;

typedef union
{
    unsigned char db[2];
    unsigned short sval;
} DOUBLE_BYTE;

BDF* readFont(const char *name);
BDF_GLYPH* getGlyph(unsigned char c, BDF* bdf, short* enc_map);
void getBitmap(BDF_GLYPH* g, unsigned char* src);

void test_print(unsigned char c, BDF* font, short *map);
void test_print2(unsigned char *src, int height, int len);


extern short win_koi_map[];

extern int _font_error_code;
extern char _font_error_msg[];
void report_error(int code, const char *msg);
void writeAJF(BDF* bdf, const char* fname);






#endif