2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: VirtFuncs.c /main/8 1995/12/18 16:24:06 cde-hp $ */
24 /************************************<+>*************************************
25 ****************************************************************************
33 ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
35 ** (c) Copyright 1993, 1994 Hewlett-Packard Company
36 ** (c) Copyright 1993, 1994 International Business Machines Corp.
37 ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
38 ** (c) Copyright 1993, 1994 Novell, Inc.
42 ****************************************************************************
43 ************************************<+>*************************************/
52 * Canvas Engine includes
55 #include "CanvasSegP.h"
61 #include "VirtFuncsI.h"
66 /******** Private Function Declarations ********/
67 /******** End Private Function Declarations ********/
69 /*****************************************************************************
71 *****************************************************************************/
72 /*****************************************************************************
74 *****************************************************************************/
75 /*****************************************************************************
76 * Semi-Private Variables
77 *****************************************************************************/
78 /*****************************************************************************
80 *****************************************************************************/
81 /*****************************************************************************
82 * Semi-Public Functions
83 *****************************************************************************/
84 /******************************************************************************
85 * Function: _DtCvUnit _DtCvGetStringWidth (_DtCanvasStruct *canvas,
86 * _DtCvSegment *segment, char *string, int len)
92 *****************************************************************************/
95 _DtCanvasStruct *canvas,
96 _DtCvSegment *segment,
100 _DtCvUnit result = -1;
101 _DtCvStringInfo strInfo;
103 strInfo.string = string;
104 strInfo.byte_len = len;
105 strInfo.wc = _DtCvIsSegWideChar(segment);
106 strInfo.font_ptr = _DtCvFontOfStringSeg(segment);
108 if (canvas->virt_functions.get_width != NULL)
109 result = (*(canvas->virt_functions.get_width)) (
110 canvas->client_data, _DtCvSTRING_TYPE,
111 (_DtCvPointer) &strInfo);
117 } /* End _DtCvGetStringWidth */
119 /******************************************************************************
120 * Function: void _DtCvFontMetrics (_DtCanvasStruct canvas,
128 ******************************************************************************/
131 _DtCanvasStruct *canvas,
132 _DtCvPointer font_handle,
133 _DtCvUnit *ret_ascent,
134 _DtCvUnit *ret_descent,
136 _DtCvUnit *ret_super_y,
137 _DtCvUnit *ret_sub_y)
139 if (ret_ascent != NULL)
141 if (ret_descent != NULL)
145 if (ret_super_y != NULL)
147 if (ret_sub_y != NULL)
150 if (canvas->virt_functions.get_font_metrics != NULL)
151 (*(canvas->virt_functions.get_font_metrics))(
152 canvas->client_data, font_handle,
153 ret_ascent, ret_descent, ret_ave, ret_super_y, ret_sub_y);
155 } /* End _DtCvFontMetrics */