summaryrefslogtreecommitdiff
path: root/gridP.h
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:49:22 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:49:22 +0000
commit7c4135cb4b16908b54a07ee14a7ef03727102c78 (patch)
treed941faa69a7da1ac3eff60f02f35e770aad60b73 /gridP.h
parent961d4493f519b5b093581e111997f894b1675d48 (diff)
Diffstat (limited to 'gridP.h')
-rw-r--r--gridP.h45
1 files changed, 39 insertions, 6 deletions
diff --git a/gridP.h b/gridP.h
index 9a4b8cb..1ed849b 100644
--- a/gridP.h
+++ b/gridP.h
@@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-
+/* $XFree86: xc/programs/xfd/gridP.h,v 1.4 2002/07/23 01:45:41 tsi Exp $ */
#ifndef _FontGridP_h_
#define _FontGridP_h_
@@ -46,18 +46,25 @@ typedef struct _FontGridPart {
XFontStruct * text_font; /* font to display */
int cell_cols, cell_rows; /* number of cells */
int cell_width, cell_height; /* size of cell */
+#ifndef XRENDER
Pixel foreground_pixel; /* color of text */
+#endif
Pixel box_pixel; /* for box_chars */
Boolean center_chars; /* center characters in grid */
Boolean box_chars; /* put box around logical width */
XtCallbackList callbacks; /* for notifying caller */
int internal_pad; /* extra padding inside grid */
- Dimension start_char; /* first character of grid */
+ long start_char; /* first character of grid */
int grid_width; /* width of grid lines */
/* private data */
GC text_gc; /* printing text */
GC box_gc; /* for box_chars */
int xoff, yoff; /* extra offsets within grid */
+#ifdef XRENDER
+ XftDraw *draw;
+ XftColor fg_color;
+ XftFont *text_face;
+#endif
} FontGridPart;
typedef struct _FontGridRec {
@@ -66,13 +73,39 @@ typedef struct _FontGridRec {
FontGridPart fontgrid;
} FontGridRec;
-#define DefaultCellWidth(fgw) (((fgw)->fontgrid.text_font->max_bounds.width) \
+#ifdef XRENDER
+
+#define GridFontHeight(g) ((g)->fontgrid.text_face ? \
+ (g)->fontgrid.text_face->height : \
+ (g)->fontgrid.text_font ? \
+ (g)->fontgrid.text_font->ascent + \
+ (g)->fontgrid.text_font->descent : 1)
+#define GridFontAscent(g) ((g)->fontgrid.text_face ? \
+ (g)->fontgrid.text_face->ascent : \
+ (g)->fontgrid.text_font ? \
+ (g)->fontgrid.text_font->ascent: 1)
+#define GridFontWidth(g) ((g)->fontgrid.text_face ? \
+ (g)->fontgrid.text_face->max_advance_width : \
+ (g)->fontgrid.text_font ? \
+ (g)->fontgrid.text_font->max_bounds.width : 1)
+#define GridForeground(g) ((g)->fontgrid.fg_color.pixel)
+
+#else /* XRENDER */
+
+#define GridFontHeight(g) ((g)->fontgrid.text_font->ascent + \
+ (g)->fontgrid.text_font->descent)
+#define GridFontAscent(g) ((g)->fontgrid.text_font ? \
+ (g)->fontgrid.text_font->ascent: 1)
+#define GridFontWidth(g) ((g)->fontgrid.text_font->max_bounds.width)
+#define GridForeground(g) ((g)->fontgrid.foreground_pixel)
+
+#endif /* else XRENDER */
+
+#define DefaultCellWidth(fgw) (GridFontWidth(fgw) \
+ ((fgw)->fontgrid.internal_pad * 2))
-#define DefaultCellHeight(fgw) ((fgw)->fontgrid.text_font->ascent + \
- (fgw)->fontgrid.text_font->descent + \
+#define DefaultCellHeight(fgw) (GridFontHeight(fgw) + \
((fgw)->fontgrid.internal_pad * 2))
-
#define CellWidth(fgw) (((int)(fgw)->core.width - (fgw)->fontgrid.grid_width) \
/ (fgw)->fontgrid.cell_cols \
- (fgw)->fontgrid.grid_width)