/
Hangul.h
132 lines (101 loc) · 2.9 KB
/
Hangul.h
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
#ifndef _HANGUL_H_
#define _HANGUL_H_
extern char _dml[4][22];
extern char _dfm[4][20][2];
extern char _dmf[4][22][2];
extern char sangyongtable[3][33];
#define WXDC 0
#define CONSOLE 1
/* font format */
#define HAN_8x4x4 0
#define HAN_6x2x1 1
#define HAN_10x4x4 2
#define HAN_2x1x2 3
#define ENG_256 0
#define SPECIAL_CODE 212
/* hangul type & english type */
typedef struct htype {
int firs;
int mids;
int lass;
} HTYPE;
typedef struct etype {
int engs;
} ETYPE;
typedef struct {
unsigned lasc :5;
unsigned midc :5; /* HAN CODE FORM */
unsigned firc :5;
unsigned dummy:1;
} hcode;
typedef struct {
unsigned char schar; /* HAN BYTE FORM */
unsigned char fchar;
} hchar;
class Hangul
{
public:
char *fir; /* first */
char *mid; /* mid */
char *las; /* las */
char *spe; /* special font */
char *eng; /* english */
HTYPE htypes;
ETYPE etypes;
union {
hcode c;
hchar b;
} han;
char *Dml; /* convert table ( middle-last ) */
char *Dfm; /* convert table ( first-middle ) */
char *Dmf; /* convert table ( middle-first ) */
char *code_table[3];
/* general x,y position */
int _xpos;
int _ypos;
int _totalwidth;
/* flags */
char engflag;
char specialenable; /* special character not enabled */
char graphokflag; /* graphic character not enabled */
char hanjaokflag; /* hanjaokflag not enabled */
char textattrflag; /* textattribute not enabled */
int putmodeflag;
wxColour _normalfg;
wxColour _normalbg;
wxColour _fg;
wxColour _bg;
int _from;
int _to;
wxColour _rangefg;
wxColour _rangebg;
public:
Hangul();
~Hangul();
void SetSpecialCharOn();
void SetSpecialCharOff();
void SetCtable(int method);
void SangYongCode();
bool LoadHanFont(wxString file, int htype);
void LoadEngFont(wxString file,int etype);
void LoadSpecialFont(wxString file,int stype);
void SetHanFontRoom(int htype);
void SetEngFontRoom(int etype);
void SetSpecialFontRoom(int stype);
void FreeHanRoom();
void FreeEngRoom();
void FreeSpecialRoom();
int GetFontType(wxString file);
void complete_hangul(int mode, char *dest, char *src);
void specialout_process(wxDC &dc, unsigned char *rgba, char *str,int pos);
void englishout_process(wxDC &dc, unsigned char *rgba, char *str,int pos);
void hangulout_process(wxDC &dc, unsigned char *rgba, char *str, int pos);
void OutTextXy(wxDC &dc, int x, int y, char *str, wxColour fg, wxColour bg);
int IsGraphic(char *str,int pos);
int IsHanja(char *str,int pos);
int IsSpecial(char *str,int pos);
void PutHan(wxDC &dc, unsigned char *rgba, char *buffer);
void PutEng(wxDC &dc, unsigned char *rgba, char *buffer);
void RangeColour(int from, int to, wxColour fg, wxColour bg);
};
#endif //__BNK_H_