1 /* 2 * Motif 3 * 4 * Copyright (c) 1987-2012, The Open Group. All rights reserved. 5 * 6 * These libraries and programs are free software; you can 7 * redistribute them and/or modify them under the terms of the GNU 8 * Lesser General Public License as published by the Free Software 9 * Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * These libraries and programs are distributed in the hope that 13 * they will be useful, but WITHOUT ANY WARRANTY; without even the 14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 15 * PURPOSE. See the GNU Lesser General Public License for more 16 * details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with these librararies and programs; if not, write 20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 21 * Floor, Boston, MA 02110-1301 USA 22 * 23 */ 24 /* 25 * HISTORY 26 */ 27 /* $XConsortium: XmRenderTI.h /main/5 1995/07/13 18:24:12 drk $ */ 28 #ifndef _XmRenderTI_h 29 #define _XmRenderTI_h 30 31 #include <Xm/XmP.h> 32 #ifdef USE_XFT 33 #include <X11/Xft/Xft.h> 34 #endif 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /* Internal types for XmRenderTable.c */ 41 42 #define REND_OPTIMIZED_BITS 1 43 #define REND_MARK_BITS REND_OPTIMIZED_BITS 44 #define REND_REFCOUNT_BITS (16 - REND_OPTIMIZED_BITS) 45 46 /* 47 * Macros for Rendition data structure access 48 */ 49 50 #define _XmRendRefcount(r) ((_XmRendition)*(r))->refcount 51 #define _XmRendFontOnly(r) ((_XmRendition)*(r))->fontOnly 52 #define _XmRendLoadModel(r) ((_XmRendition)*(r))->loadModel 53 #define _XmRendTag(r) ((_XmRendition)*(r))->tag 54 #define _XmRendFontName(r) ((_XmRendition)*(r))->fontName 55 #define _XmRendFontType(r) ((_XmRendition)*(r))->fontType 56 #define _XmRendFont(r) ((_XmRendition)*(r))->font 57 #define _XmRendDisplay(r) ((_XmRendition)*(r))->display 58 #define _XmRendTabs(r) ((_XmRendition)*(r))->tabs 59 #if USE_XFT 60 #define _XmRendBG(r) ((_XmRendition)*(r))->xftBackground.pixel 61 #define _XmRendFG(r) ((_XmRendition)*(r))->xftForeground.pixel 62 #define _XmRendXftFont(r) ((_XmRendition)*(r))->xftFont 63 #define _XmRendXftFG(r) ((_XmRendition)*(r))->xftForeground 64 #define _XmRendXftBG(r) ((_XmRendition)*(r))->xftBackground 65 #define _XmRendPattern(r) ((_XmRendition)*(r))->pattern 66 #define _XmRendFontStyle(r) ((_XmRendition)*(r))->fontStyle 67 #define _XmRendFontFoundry(r) ((_XmRendition)*(r))->fontFoundry 68 #define _XmRendFontEncoding(r) ((_XmRendition)*(r))->fontEncoding 69 #define _XmRendFontSize(r) ((_XmRendition)*(r))->fontSize 70 #define _XmRendPixelSize(r) ((_XmRendition)*(r))->pixelSize 71 #define _XmRendFontSlant(r) ((_XmRendition)*(r))->fontSlant 72 #define _XmRendFontSpacing(r) ((_XmRendition)*(r))->fontSpacing 73 #define _XmRendFontWeight(r) ((_XmRendition)*(r))->fontWeight 74 #else 75 #define _XmRendBG(r) ((_XmRendition)*(r))->background 76 #define _XmRendFG(r) ((_XmRendition)*(r))->foreground 77 #define _XmRendXftFont(r) (NULL) 78 #endif 79 #define _XmRendBGState(r) ((_XmRendition)*(r))->backgroundState 80 #define _XmRendFGState(r) ((_XmRendition)*(r))->foregroundState 81 #define _XmRendUnderlineType(r) ((_XmRendition)*(r))->underlineType 82 #define _XmRendStrikethruType(r)((_XmRendition)*(r))->strikethruType 83 #define _XmRendGC(r) ((_XmRendition)*(r))->gc 84 #define _XmRendTags(r) ((_XmRendition)*(r))->tags 85 #define _XmRendTagCount(r) ((_XmRendition)*(r))->count 86 #define _XmRendHadEnds(r) ((_XmRendition)*(r))->hadEnds 87 #define _XmRendRefcountInc(r) ++(((_XmRendition)*(r))->refcount) 88 #define _XmRendRefcountDec(r) --(((_XmRendition)*(r))->refcount) 89 90 91 #define FIX_1415 92 typedef struct __XmRenditionRec 93 { 94 /* flag indicating _XmFontRenditionRec */ 95 unsigned int fontOnly : REND_OPTIMIZED_BITS; 96 unsigned int refcount : REND_REFCOUNT_BITS; 97 98 unsigned char loadModel; 99 XmStringTag tag; 100 String fontName; 101 XmFontType fontType; 102 XtPointer font; 103 Display *display; 104 GC gc; 105 XmStringTag *tags; 106 unsigned int count; 107 Boolean hadEnds; 108 109 XmTabList tabs; 110 Pixel background; 111 Pixel foreground; 112 unsigned char underlineType; 113 unsigned char strikethruType; 114 unsigned char backgroundState; 115 unsigned char foregroundState; 116 117 #ifdef USE_XFT 118 char *fontStyle, 119 /* *family, Use font_name instead. */ 120 *fontFoundry, *fontEncoding; 121 int fontSize, pixelSize, fontSlant, fontSpacing, fontWeight; 122 XftPattern *pattern; 123 XftFont *xftFont; 124 XftColor xftForeground, xftBackground; 125 #endif 126 } _XmRenditionRec, *_XmRendition; 127 128 typedef struct __XmFontRenditionRec 129 { 130 /* flag indicating _XmFontRenditionRec */ 131 unsigned int fontOnly : REND_OPTIMIZED_BITS; 132 unsigned int refcount : REND_REFCOUNT_BITS; 133 134 unsigned char loadModel; 135 XmStringTag tag; 136 String fontName; 137 XmFontType fontType; 138 XtPointer font; 139 Display *display; 140 GC *gc; 141 XmStringTag *tags; 142 unsigned int count; 143 } _XmFontRenditionRec, *_XmFontRendition; 144 145 /* Accessor macros. */ 146 147 #define _XmRTCount(rt) ((_XmRenderTable)*(rt))->count 148 #define _XmRTRenditions(rt) ((_XmRenderTable)*(rt))->renditions 149 #define _XmRTDisplay(rt) ((_XmRenderTable)*(rt))->display 150 #define _XmRTMark(rt) ((_XmRenderTable)*(rt))->mark 151 #define _XmRTRefcount(rt) ((_XmRenderTable)*(rt))->refcount 152 #define _XmRTRefcountInc(rt) ++(((_XmRenderTable)*(rt))->refcount) 153 #define _XmRTRefcountDec(rt) --(((_XmRenderTable)*(rt))->refcount) 154 155 #define RENDITIONS_IN_STRUCT 1 156 157 typedef struct __XmRenderTableRec 158 { 159 unsigned int mark : REND_MARK_BITS; 160 unsigned int refcount : REND_REFCOUNT_BITS; 161 unsigned short count; 162 Display *display; 163 XmRendition renditions[RENDITIONS_IN_STRUCT]; 164 } _XmRenderTableRec, *_XmRenderTable; 165 166 167 /******** Private Function Declarations for XmRenderTable.c ********/ 168 169 extern XmRendition _XmRenderTableFindRendition(XmRenderTable table, 170 XmStringTag tag, 171 #if NeedWidePrototypes 172 int cached_tag, 173 int need_font, 174 int call, 175 #else 176 Boolean cached_tag, 177 Boolean need_font, 178 Boolean call, 179 #endif /* NeedWidePrototypes */ 180 short *index); 181 extern XmRendition _XmRenditionCreate(Display *display, 182 Widget widget, 183 String resname, 184 String resclass, 185 XmStringTag tag, 186 ArgList arglist, 187 Cardinal argcount, 188 Boolean *in_db); 189 extern XmRendition _XmRenderTableGetMerged(XmRenderTable rt, 190 XmStringTag base, 191 XmStringTag *tags, 192 #if NeedWidePrototypes 193 unsigned int tag_count 194 #else 195 unsigned short tag_count 196 #endif /* NeedWidePrototypes */ 197 ); 198 extern XmRendition _XmRenditionMerge(Display *d, 199 XmRendition *scr, 200 XmRendition base_rend, 201 XmRenderTable rt, 202 XmStringTag base_tag, 203 XmStringTag *tags, 204 #if NeedWidePrototypes 205 unsigned int tag_count, 206 unsigned int copy 207 #else 208 unsigned short tag_count, 209 Boolean copy 210 #endif /* NeedWidePrototypes */ 211 ); 212 extern Widget _XmCreateRenderTable(Widget parent, 213 String name, 214 ArgList arglist, 215 Cardinal argcount); 216 extern Widget _XmCreateRendition(Widget parent, 217 String name, 218 ArgList arglist, 219 Cardinal argcount); 220 extern Display *_XmRenderTableDisplay(XmRenderTable table); 221 extern XmRendition _XmRenditionCopy(XmRendition rend, 222 Boolean shared); 223 extern Boolean _XmRenderTableFindFallback(XmRenderTable , 224 XmStringTag tag, 225 #if NeedWidePrototypes 226 int cached_tag, 227 #else 228 Boolean cached_tag, 229 #endif /* NeedWidePrototypes */ 230 short *indx, 231 XmRendition *rend_ptr) ; 232 extern Boolean _XmRenderTableFindFirstFont(XmRenderTable rendertable, 233 short *indx, 234 XmRendition *rend_ptr); 235 extern XmRenderTable _XmRenderTableRemoveRenditions(XmRenderTable oldtable, 236 XmStringTag *tags, 237 int tag_count, 238 #if NeedWidePrototypes 239 int chk_font, 240 #else 241 Boolean chk_font, 242 #endif /* NeedWidePrototypes */ 243 XmFontType type, 244 XtPointer font); 245 246 #ifdef USE_XFT 247 /* 248 * XftDraw cache functions, implemented in lib/Xm/FontList.c 249 */ 250 XftDraw * _XmXftDrawCreate(Display *display, Window window); 251 252 void _XmXftDrawDestroy(Display *display, Window window, XftDraw *d); 253 254 void _XmXftDrawString(Display *display, Window window, XmRendition rend, int bpc, 255 #if NeedWidePrototypes 256 int x, int y, 257 #else 258 Position x, Position y, 259 #endif /* NeedWidePrototypes */ 260 char *s, int len, 261 #if NeedWidePrototypes 262 int image 263 #else 264 Boolean image 265 #endif /* NeedWidePrototypes */ 266 ); 267 268 void _XmXftDrawString2(Display *display, Window window, GC gc, XftFont *font, int bpc, 269 #if NeedWidePrototypes 270 int x, int y, 271 #else 272 Position x, Position y, 273 #endif 274 char *s, int len); 275 276 void _XmXftSetClipRectangles(Display *display, Window window, Position x, Position y, XRectangle *rects, int n); 277 278 XftColor _XmXftGetXftColor(Display *display, Pixel color); 279 280 #ifdef FIX_1415 281 void _XmXftFontAverageWidth(Widget w, XtPointer f, int *width); 282 #endif 283 284 #endif 285 286 /******** End Private Function Declarations ********/ 287 288 #ifdef __cplusplus 289 } /* Close scope of 'extern "C"' declaration which encloses file. */ 290 #endif 291 292 #endif /* _XmRenderTI_h */ 293 /* DON'T ADD ANYTHING AFTER THIS #endif */ 294