2 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
3 * Copyright (C) 2004-2007 Kim Woelders
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies of the Software, its documentation and marketing & publicity
14 * materials, and acknowledgment shall be given in the documentation, materials
15 * and software packages that this Software was used.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #define MODE_VERBATIM 0
32 #define MODE_WRAP_CHAR 1
33 #define MODE_WRAP_WORD 2
35 #define FONT_TO_RIGHT 0
36 #define FONT_TO_DOWN 1
38 #define FONT_TO_LEFT 3
40 #define FONT_TYPE_UNKNOWN 0
41 #define FONT_TYPE_XFONT 0 /* XFontStruct */
42 #define FONT_TYPE_XFS 2 /* XFontSet */
43 #define FONT_TYPE_IFT 3 /* Imlib2/FreeType */
45 #define FONT_TYPE_XFT 4 /* Xft */
48 #define FONT_TYPE_PANGO_XFT 5 /* Pango-Xft */
52 int (*Load) (TextState * ts, const char *name);
53 void (*Destroy) (TextState * ts);
54 void (*TextSize) (TextState * ts, const char *text, int len,
55 int *width, int *height, int *ascent);
56 void (*TextFit) (TextState * ts, char **ptext,
57 int *pwidth, int textwidth_limit);
58 void (*TextDraw) (TextState * ts, int x, int y,
59 const char *text, int len);
60 int (*FdcInit) (TextState * ts, Win win, Drawable draw);
61 void (*FdcFini) (TextState * ts);
62 void (*FdcSetDrawable) (TextState * ts, unsigned long draw);
63 void (*FdcSetColor) (TextState * ts, EColor * xc);
88 } norm , active, sticky, sticky_active;
90 unsigned int ref_count;
94 int TextclassConfigLoad(FILE * fs);
95 TextClass *TextclassFind(const char *name, int fallback);
96 TextClass *TextclassAlloc(const char *name, int fallback);
97 void TextclassFree(TextClass * tc);
98 int TextclassGetJustification(TextClass * tc);
99 void TextclassSetJustification(TextClass * tc, int just);
102 TextState *TextclassGetTextState(TextClass * tclass, int state,
103 int active, int sticky);
104 __EXPORT__ void TextstateTextFit(TextState * ts, char **ptext, int *pw,
105 int textwidth_limit);
106 void TextstateTextDraw(TextState * ts, Win win, Drawable draw,
107 const char *text, int x, int y, int w,
108 int h, const EImageBorder * pad,
109 int fsize, int justh, int justv);
110 void TextSize(TextClass * tclass, int active, int sticky,
111 int state, const char *text, int *width,
112 int *height, int fsize);
113 void TextDraw(TextClass * tclass, Win win, Drawable draw,
114 int active, int sticky, int state,
115 const char *text, int x, int y, int w, int h,
116 int fsize, int justification);
118 __EXPORT__ int _xft_FdcInit(TextState * ts, Win win, Drawable draw);
119 __EXPORT__ void _xft_FdcFini(TextState * ts);
120 __EXPORT__ void _xft_FdcSetDrawable(TextState * ts, unsigned long draw);
121 __EXPORT__ void _xft_FdcSetColor(TextState * ts, EColor * xc);
123 #endif /* _TCLASS_H */