1 #ifndef MLVIEW_H
2 #define MLVIEW_H
3 
4 /*
5  * What is this?
6  *
7  *  It is a package to show multi-lingual text.
8  *
9  * How to use?
10  *
11  *  1. Call ml_set_screen(Screen *scr);
12  *	Tell this package the screen you use.
13  *
14  *  2. Call ml_set_charsets(struct char_spec spec[4], int gl, int gr);
15  *	Tell this package the initial charsets.
16  *	Gn is set to the charset specified by spec[n], respectively.
17  *	GL and GR are set to G[gl] and G[gr], respectively.
18  *	If first call, iso8859-1 font is loaded.
19  *
20  *  3. Call ml_draw_text(char *string);
21  *	It Creates a bitmap, and returns it to you.
22  *	If something goes wrong, it returns None.
23  *	DON'T free the returned pixmaps!!
24  *
25  * BUGS:
26  *  - Amharic and Tigrigna characters are strange.
27  *  - Big5 is not supported.
28  *  - Reverse direction is not supported.
29  *  - Composing is not supported.
30  *  - Cantonese can't be shown.
31  *  - Texts which have many lines are buggy.
32  *
33  * NOTE:
34  *  - Shifted JIS and Shifted GB must be converted to iso2022 in advance.
35  *
36  * Example of parameters to ml_set_charsets:
37  *  - EUC-Japan
38  *	spec = { {1, 94, 'B'},		G0 is US-ASCII
39  *		 {2, 94, 'B'},		G1 is JIS X0208
40  *		 {1, 94, 'J'},		G2 is (right-half of)JIS X0201
41  *		 {2, 94, 'D'} };	G3 is JIS X0212
42  *	gl = 0;				GL is G0
43  *	gr = 1;				GR is G1
44  *
45  *  - Compound Text
46  *	spec = { {1, 94, 'B'},		G0 is US-ASCII
47  *		 {1, 96, 'A'},		G1 is Latin-1
48  *		 {1, 94, 'B'},		G2 is US-ASCII (maybe unused)
49  *		 {1, 94, 'B'} };	G3 is US-ASCII (maybe unused)
50  *	gl = 0;				GL is G0
51  *	gr = 1;				GR is G1
52  *
53  *  - Korean Mail
54  *	spec = { {1, 94, 'B'},		G0 is US-ASCII
55  *		 {2, 94, 'C'},		G1 is KSC5601
56  *		 {1, 94, 'B'},		G2 is US-ASCII (maybe unused)
57  *		 {1, 94, 'B'} };	G3 is US-ASCII (maybe unused)
58  *	gl = 0;				GL is G0
59  *	gl = 1;				GR is G1
60  */
61 
62 struct coding_system {
63     struct design {
64 	int bpc;	/* byte per char if 1 or 2,
65 			   don't touch if 0, or
66 			   don't use if -1.*/
67 	int noc;	/* number of chars (94 or 96) */
68 	char des;	/* designator ('A', 'B', ...) */
69     } design[4];
70     int gl, gr;
71     int eol;
72     int short_form;
73     int lock_shift;
74 };
75 
76 struct ml_text {
77     int maxlines, nlines;
78     struct ml_line {
79 	int maxitems, nitems;
80 	int width, ascent, descent;
81 	XTextItem16 *items;
82     } *lines;
83     int width, height;
84 };
85 
86 struct context;
87 struct ml_text *ml_draw_text		PARM((struct context *, char *, int));
88 struct context *ml_create_context	PARM((Screen *));
89 int ml_set_charsets			PARM((struct context *,
90 					      struct coding_system *));
91 void get_monofont_size			PARM((int *, int *));
92 char *sjis_to_jis			PARM((char *, int, int *));
93 char *lookup_registry			PARM((struct design, int *));
94 struct design lookup_design		PARM((char *, int));
95 
96 #endif
97