| 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 |
#ifndef _BLT_TEXT_H |
| 26 |
#define _BLT_TEXT_H |
| 27 |
|
| 28 |
#if (TK_MAJOR_VERSION == 4) |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
typedef struct { |
| 35 |
int ascent; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
int descent; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
int linespace; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
} Tk_FontMetrics; |
| 49 |
|
| 50 |
typedef XFontStruct *Tk_Font; |
| 51 |
|
| 52 |
#define Tk_FontId(font) ((font)->fid) |
| 53 |
#define Tk_TextWidth(font, str, len) (XTextWidth((font),(str),(len))) |
| 54 |
#define Tk_GetFontMetrics(font, fmPtr) \ |
| 55 |
((fmPtr)->ascent = (font)->ascent, \ |
| 56 |
(fmPtr)->descent = (font)->descent, \ |
| 57 |
(fmPtr)->linespace = (font)->ascent + (font)->descent) |
| 58 |
|
| 59 |
#define Tk_NameOfFont(font) (Tk_NameOfFontStruct(font)) |
| 60 |
#define Tk_DrawChars(dpy, draw, gc, font, str, len, x, y) \ |
| 61 |
TkDisplayChars((dpy),(draw),(gc),(font),(str),(len),(x),(y), 0, DEF_TEXT_FLAGS) |
| 62 |
|
| 63 |
#define Tk_MeasureChars(font, text, len, maxPixels, flags, lenPtr) \ |
| 64 |
TkMeasureChars((font),(text), (len), 0, maxPixels, 0,(flags), (lenPtr)) |
| 65 |
|
| 66 |
extern int TkMeasureChars _ANSI_ARGS_((Tk_Font font, char *source, |
| 67 |
int maxChars, int startX, int maxX, int tabOrigin, int flags, |
| 68 |
int *nextXPtr)); |
| 69 |
extern void TkDisplayChars _ANSI_ARGS_((Display *display, Drawable drawable, |
| 70 |
GC gc, Tk_Font font, char *string, int length, int x, int y, |
| 71 |
int tabOrigin, int flags)); |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
#define TK_WHOLE_WORDS (1<<0) |
| 76 |
#define TK_AT_LEAST_ONE (1<<1) |
| 77 |
#define TK_PARTIAL_OK (1<<2) |
| 78 |
#define TK_IGNORE_NEWLINES (1<<3) |
| 79 |
#define TK_IGNORE_TABS (1<<4) |
| 80 |
#define NO_FLAGS 0 |
| 81 |
|
| 82 |
#endif |
| 83 |
|
| 84 |
#define DEF_TEXT_FLAGS (TK_PARTIAL_OK | TK_IGNORE_NEWLINES) |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
typedef struct { |
| 96 |
char *text; |
| 97 |
|
| 98 |
short int x, y; |
| 99 |
|
| 100 |
|
| 101 |
short int sx, sy; |
| 102 |
|
| 103 |
short int count; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
short int width; |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
} TextFragment; |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
typedef struct { |
| 121 |
int nFrags; |
| 122 |
short int width, height; |
| 123 |
TextFragment fragArr[1]; |
| 124 |
int rotated; |
| 125 |
} TextLayout; |
| 126 |
|
| 127 |
typedef struct { |
| 128 |
XColor *color; |
| 129 |
int offset; |
| 130 |
} Shadow; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
typedef struct { |
| 147 |
unsigned int state; |
| 148 |
|
| 149 |
short int width, height; |
| 150 |
|
| 151 |
XColor *color; |
| 152 |
XColor *activeColor; |
| 153 |
Tk_Font font; |
| 154 |
Tk_3DBorder border; |
| 155 |
|
| 156 |
Shadow shadow; |
| 157 |
Tk_Justify justify; |
| 158 |
|
| 159 |
|
| 160 |
GC gc; |
| 161 |
double theta; |
| 162 |
Tk_Anchor anchor; |
| 163 |
|
| 164 |
Blt_Pad padX, padY; |
| 165 |
short int leader; |
| 166 |
int underline; |
| 167 |
|
| 168 |
} TextStyle; |
| 169 |
|
| 170 |
|
| 171 |
typedef struct { |
| 172 |
XColor *color; |
| 173 |
XColor *color2; |
| 174 |
int width; |
| 175 |
XColor **grads; |
| 176 |
XColor *origColor; |
| 177 |
XColor *origColor2; |
| 178 |
int origWidth; |
| 179 |
} Gradient; |
| 180 |
|
| 181 |
|
| 182 |
extern TextLayout *Blt_GetTextLayout _ANSI_ARGS_((char *string, |
| 183 |
TextStyle *stylePtr)); |
| 184 |
extern TextLayout *Blt_GetTextLayoutStr _ANSI_ARGS_((char *string, |
| 185 |
TextStyle *stylePtr)); |
| 186 |
|
| 187 |
extern void Blt_GetTextExtents _ANSI_ARGS_((TextStyle *stylePtr, |
| 188 |
char *text, int *widthPtr, int *heightPtr)); |
| 189 |
|
| 190 |
extern void Blt_InitTextStyle _ANSI_ARGS_((TextStyle *stylePtr)); |
| 191 |
|
| 192 |
extern void Blt_ResetTextStyle _ANSI_ARGS_((Tk_Window tkwin, |
| 193 |
TextStyle *stylePtr)); |
| 194 |
|
| 195 |
extern void Blt_FreeTextStyle _ANSI_ARGS_((Display *display, |
| 196 |
TextStyle *stylePtr)); |
| 197 |
|
| 198 |
extern void Blt_SetDrawTextStyle _ANSI_ARGS_((TextStyle *stylePtr, |
| 199 |
Tk_Font font, GC gc, XColor *normalColor, XColor *activeColor, |
| 200 |
XColor *shadowColor, double theta, Tk_Anchor anchor, Tk_Justify justify, |
| 201 |
int leader, int shadowOffset)); |
| 202 |
|
| 203 |
extern void Blt_SetPrintTextStyle _ANSI_ARGS_((TextStyle *stylePtr, |
| 204 |
Tk_Font font, XColor *fgColor, XColor *bgColor, XColor *shadowColor, |
| 205 |
double theta, Tk_Anchor anchor, Tk_Justify justify, int leader, |
| 206 |
int shadowOffset)); |
| 207 |
|
| 208 |
extern void Blt_DrawText _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, |
| 209 |
char *string, TextStyle *stylePtr, int x, int y)); |
| 210 |
|
| 211 |
extern void Blt_DrawTextLayout _ANSI_ARGS_((Tk_Window tkwin, |
| 212 |
Drawable drawable, TextLayout *textPtr, TextStyle *stylePtr, |
| 213 |
int x, int y)); |
| 214 |
|
| 215 |
extern int Blt_TextLayoutValue _ANSI_ARGS_(( TextLayout *textPtr, Tcl_DString *dStr)); |
| 216 |
|
| 217 |
extern void Blt_DrawText2 _ANSI_ARGS_((Tk_Window tkwin, Drawable drawable, |
| 218 |
char *string, TextStyle *stylePtr, int x, int y, |
| 219 |
Dim2D * dimPtr)); |
| 220 |
|
| 221 |
extern Pixmap Blt_CreateTextBitmap _ANSI_ARGS_((Tk_Window tkwin, |
| 222 |
TextLayout *textPtr, TextStyle *stylePtr, int *widthPtr, |
| 223 |
int *heightPtr)); |
| 224 |
|
| 225 |
extern int Blt_DrawRotatedText _ANSI_ARGS_((Display *display, |
| 226 |
Drawable drawable, int x, int y, double theta, |
| 227 |
TextStyle *stylePtr, TextLayout *textPtr)); |
| 228 |
|
| 229 |
extern void Blt_DeleteAxisLabelsGC _ANSI_ARGS_((Tk_Window tkwin)); |
| 230 |
|
| 231 |
extern int Blt_GetGradient(Tcl_Interp *interp, Tk_Window tkwin, Gradient *gradPtr); |
| 232 |
|
| 233 |
extern int Blt_FreeGradient(Gradient *gradPtr); |
| 234 |
|
| 235 |
|
| 236 |
#endif |