1 /* $XConsortium: VirtFuncs.c /main/8 1995/12/18 16:24:06 cde-hp $ */
2 /************************************<+>*************************************
3 ****************************************************************************
11 ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
13 ** (c) Copyright 1993, 1994 Hewlett-Packard Company
14 ** (c) Copyright 1993, 1994 International Business Machines Corp.
15 ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
16 ** (c) Copyright 1993, 1994 Novell, Inc.
20 ****************************************************************************
21 ************************************<+>*************************************/
30 * Canvas Engine includes
33 #include "CanvasSegP.h"
39 #include "VirtFuncsI.h"
44 /******** Private Function Declarations ********/
45 /******** End Private Function Declarations ********/
47 /*****************************************************************************
49 *****************************************************************************/
50 /*****************************************************************************
52 *****************************************************************************/
53 /*****************************************************************************
54 * Semi-Private Variables
55 *****************************************************************************/
56 /*****************************************************************************
58 *****************************************************************************/
59 /*****************************************************************************
60 * Semi-Public Functions
61 *****************************************************************************/
62 /******************************************************************************
63 * Function: _DtCvUnit _DtCvGetStringWidth (_DtCanvasStruct *canvas,
64 * _DtCvSegment *segment, char *string, int len)
70 *****************************************************************************/
73 _DtCanvasStruct *canvas,
74 _DtCvSegment *segment,
78 _DtCvUnit result = -1;
79 _DtCvStringInfo strInfo;
81 strInfo.string = string;
82 strInfo.byte_len = len;
83 strInfo.wc = _DtCvIsSegWideChar(segment);
84 strInfo.font_ptr = _DtCvFontOfStringSeg(segment);
86 if (canvas->virt_functions.get_width != NULL)
87 result = (*(canvas->virt_functions.get_width)) (
88 canvas->client_data, _DtCvSTRING_TYPE,
89 (_DtCvPointer) &strInfo);
95 } /* End _DtCvGetStringWidth */
97 /******************************************************************************
98 * Function: void _DtCvFontMetrics (_DtCanvasStruct canvas,
106 ******************************************************************************/
109 _DtCanvasStruct *canvas,
110 _DtCvPointer font_handle,
111 _DtCvUnit *ret_ascent,
112 _DtCvUnit *ret_descent,
114 _DtCvUnit *ret_super_y,
115 _DtCvUnit *ret_sub_y)
117 if (ret_ascent != NULL)
119 if (ret_descent != NULL)
123 if (ret_super_y != NULL)
125 if (ret_sub_y != NULL)
128 if (canvas->virt_functions.get_font_metrics != NULL)
129 (*(canvas->virt_functions.get_font_metrics))(
130 canvas->client_data, font_handle,
131 ret_ascent, ret_descent, ret_ave, ret_super_y, ret_sub_y);
133 } /* End _DtCvFontMetrics */