XomGeneric.h revision b4ee4795
1/*
2 * Copyright 1992, 1993 by TOSHIBA Corp.
3 *
4 * Permission to use, copy, modify, and distribute this software and its
5 * documentation for any purpose and without fee is hereby granted, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of TOSHIBA not be used in advertising
9 * or publicity pertaining to distribution of the software without specific,
10 * written prior permission. TOSHIBA make no representations about the
11 * suitability of this software for any purpose.  It is provided "as is"
12 * without express or implied warranty.
13 *
14 * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 * SOFTWARE.
21 *
22 * Author: Katsuhisa Yano	TOSHIBA Corp.
23 *			   	mopi@osa.ilab.toshiba.co.jp
24 */
25/*
26 * Copyright 1995 by FUJITSU LIMITED
27 * This is source code modified by FUJITSU LIMITED under the Joint
28 * Development Agreement for the CDE/Motif PST.
29 *
30 * Modifier: Takanori Tateno   FUJITSU LIMITED
31 *
32 */
33
34#ifndef _XOMGENERIC_H_
35#define _XOMGENERIC_H_
36
37#include "XlcPublic.h"
38
39#define XOM_GENERIC(om)		(&((XOMGeneric) om)->gen)
40#define XOC_GENERIC(font_set)	(&((XOCGeneric) font_set)->gen)
41
42/* For VW/UDC */
43typedef struct _CodeRangeRec {
44    unsigned long       start;
45    unsigned long       end;
46    unsigned long       dmy1;
47    unsigned long       dmy2;
48} CodeRangeRec, *CodeRange;
49
50typedef struct _VRotateRec {
51    char        *charset_name;  /* Charset name                         */
52    XlcSide     side;           /* Encoding side                        */
53    int         num_cr;
54    CodeRange   code_range;
55    char        *xlfd_name;
56    XFontStruct *font;
57} VRotateRec, *VRotate;
58
59typedef enum {
60    XOMMultiByte,
61    XOMWideChar,
62    XOMUtf8String
63} XOMTextType;
64
65typedef struct _FontDataRec {
66    char 	*name;
67    XlcSide 	side;
68    /* For VW/UDC */
69    int       	scopes_num;
70    FontScope 	scopes;
71    char      	*xlfd_name;
72    XFontStruct *font;
73} FontDataRec, *FontData;
74
75#define VROTATE_NONE   0
76#define VROTATE_PART   1
77#define VROTATE_ALL    2
78
79typedef struct _OMDataRec {
80    int 	charset_count;
81    XlcCharSet 	*charset_list;
82    int 	font_data_count;
83    FontData 	font_data;
84    /* For VW/UDC */
85    int substitute_num;
86    FontData substitute;
87    /* Vertical Writing */
88    int         vmap_num;
89    FontData    vmap;
90    int		vrotate_type;
91    int         vrotate_num;
92    CodeRange   vrotate;
93} OMDataRec, *OMData;
94
95typedef struct _XOMGenericPart {
96    int 	data_num;
97    OMData 	data;
98    Bool 	on_demand_loading;
99    char 	*object_name;
100} XOMGenericPart;
101
102typedef struct _XOMGenericRec {
103    XOMMethods 		methods;
104    XOMCoreRec 		core;
105    XOMGenericPart 	gen;
106} XOMGenericRec, *XOMGeneric;
107
108/*
109 * XOC dependent data
110 */
111
112typedef struct _FontSetRec {
113    int 		id;
114    int 		charset_count;
115    XlcCharSet 		*charset_list;
116    int 		font_data_count;
117    FontData 		font_data;
118    char 		*font_name;
119    XFontStruct 	*info;
120    XFontStruct 	*font;
121    XlcSide 		side;
122    Bool 		is_xchar2b;
123    /* For VW/UDC */
124    int 		substitute_num;
125    FontData 		substitute;
126    /* Vertical Writing */
127    int		vpart_initialize;
128    int         vmap_num;
129    FontData    vmap;
130    int         vrotate_num;
131    VRotate     vrotate;
132} FontSetRec, *FontSet;
133
134typedef struct _XOCGenericPart {
135    XlcConv 		mbs_to_cs;
136    XlcConv 		wcs_to_cs;
137    XlcConv 		utf8_to_cs;
138    int 		font_set_num;
139    FontSet 		font_set;
140} XOCGenericPart;
141
142typedef struct _XOCGenericRec {
143    XOCMethods 		methods;
144    XOCCoreRec 		core;
145    XOCGenericPart 	gen;
146} XOCGenericRec, *XOCGeneric;
147
148_XFUNCPROTOBEGIN
149
150extern XOM _XomGenericOpenOM(
151    XLCd		/* lcd */,
152    Display*		/* dpy */,
153    XrmDatabase		/* rdb */,
154    _Xconst char*	/* res_name */,
155    _Xconst char*	/* res_class */
156);
157
158extern XlcConv _XomInitConverter(
159    XOC			/* oc */,
160    XOMTextType		/* type */
161);
162
163extern int _XomConvert(
164    XOC			/* oc */,
165    XlcConv		/* conv */,
166    XPointer*		/* from */,
167    int*		/* from_left */,
168    XPointer*		/* to */,
169    int*		/* to_left */,
170    XPointer*		/* args */,
171    int			/* num_args */
172);
173
174extern int
175_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length);
176extern int
177_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length);
178extern int
179_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length);
180extern int
181_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length,
182    XRectangle *overall_ink, XRectangle *overall_logical);
183extern int
184_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length,
185    XRectangle *overall_ink, XRectangle *overall_logical);
186extern int
187_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length,
188    XRectangle *overall_ink, XRectangle *overall_logical);
189extern Status
190_XmbDefaultTextPerCharExtents(
191    XOC oc, _Xconst char *text, int length,
192    XRectangle *ink_buf, XRectangle *logical_buf,
193    int buf_size, int *num_chars,
194    XRectangle *overall_ink,
195    XRectangle *overall_logical);
196extern Status
197_XwcDefaultTextPerCharExtents(
198    XOC oc, _Xconst wchar_t *text, int length,
199    XRectangle *ink_buf, XRectangle *logical_buf,
200    int buf_size, int *num_chars,
201    XRectangle *overall_ink,
202    XRectangle *overall_logical);
203extern Status
204_Xutf8DefaultTextPerCharExtents(
205    XOC oc, _Xconst char *text, int length,
206    XRectangle *ink_buf, XRectangle *logical_buf,
207    int buf_size, int *num_chars,
208    XRectangle *overall_ink,
209    XRectangle *overall_logical);
210extern int
211_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
212    _Xconst char *text, int length);
213extern int
214_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
215    _Xconst wchar_t *text, int length);
216extern int
217_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
218    _Xconst char *text, int length);
219extern void
220_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
221    int y, _Xconst char *text, int length);
222extern void
223_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
224    int y, _Xconst wchar_t *text, int length);
225extern void
226_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
227    int y, _Xconst char *text, int length);
228
229extern int
230_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length);
231extern int
232_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length,
233    XRectangle *overall_ink, XRectangle *overall_logical);
234extern int
235_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
236    _Xconst char *text, int length);
237extern void
238_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
239    int y, _Xconst char *text, int length);
240extern Status
241_Xutf8GenericTextPerCharExtents(
242    XOC oc, _Xconst char *text, int length,
243    XRectangle *ink_buf, XRectangle *logical_buf,
244    int buf_size, int *num_chars,
245    XRectangle *overall_ink,
246    XRectangle *overall_logical);
247extern int
248_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length,
249    XRectangle *overall_ink, XRectangle *overall_logical);
250extern int
251_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length);
252extern void
253_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
254    int y, _Xconst wchar_t *text, int length);
255extern int
256_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
257    _Xconst wchar_t *text, int length);
258extern Status
259_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length,
260    XRectangle *ink_buf, XRectangle *logical_buf,
261    int buf_size, int *num_chars,
262    XRectangle *overall_ink,
263    XRectangle *overall_logical);
264extern int
265_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length,
266    XRectangle *overall_ink, XRectangle *overall_logical);
267extern int
268_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length);
269extern void
270_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
271    int y, _Xconst char *text, int length);
272extern int
273_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
274    _Xconst char *text, int length);
275extern Status
276_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length,
277    XRectangle *ink_buf, XRectangle *logical_buf,
278    int buf_size, int *num_chars,
279    XRectangle *overall_ink,
280    XRectangle *overall_logical);
281
282extern FontData
283read_EncodingInfo(
284    int count,
285    char **value);
286
287extern int
288_XomGenericDrawString(
289    Display *dpy,
290    Drawable d,
291    XOC oc,
292    GC gc,
293    int x, int y,
294    XOMTextType type,
295    XPointer text,
296    int length);
297extern int
298_XomGenericTextExtents(
299    XOC oc,
300    XOMTextType type,
301    XPointer text,
302    int length,
303    XRectangle *overall_ink,
304    XRectangle *overall_logical);
305extern FontData
306_XomGetFontDataFromFontSet(
307    FontSet fs,
308    unsigned char *str,
309    int len,
310    int *len_ret,
311    int is2b,
312    int type);
313
314_XFUNCPROTOEND
315
316#endif  /* _XOMGENERIC_H_ */
317