---
name: "mdraw_text_extents"
section: "3m17n"
platform: "linux"
package: "m17n-docs"
version: "1.8.4-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mdraw_text_extents"
---

# mdraw\_text\_extents(3m17n)

## NAME

mdraw\_text\_extents -

## SYNOPSIS

int **mdraw\_text\_extents** (**MFrame** \* *frame*, **MText** \* *mt*, int *from*, int *to*, **MDrawControl** \* *control*, **MDrawMetric** \* *overall\_ink\_return*, **MDrawMetric** \* *overall\_logical\_return*, **MDrawMetric** \* *overall\_line\_return*)

## DESCRIPTION

Compute text pixel width. The **mdraw\_text\_extents()** function computes the width of text between **from** and **to** of M-text **mt** when it is drawn on a window of frame **frame** using the **mdraw\_text\_with\_control()** function with the drawing control object **control**.

If **overall\_ink\_return** is not `NULL`, this function also computes the bounding box of character ink of the M-text, and stores the results in the members of the structure pointed to by **overall\_ink\_return**. If the M-text has a face specifying a surrounding box, the box is included in the bounding box.

If **overall\_logical\_return** is not `NULL`, this function also computes the bounding box that provides minimum spacing to other graphical features (such as surrounding box) for the M-text, and stores the results in the members of the structure pointed to by **overall\_logical\_return**.

If **overall\_line\_return** is not `NULL`, this function also computes the bounding box that provides minimum spacing to the other M-text drawn, and stores the results in the members of the structure pointed to by **overall\_line\_return**. This is a union of **overall\_ink\_return** and **overall\_logical\_return** if the members min\_line\_ascent, min\_line\_descent, max\_line\_ascent, and max\_line\_descent of **control** are all zero.

## RETURN VALUE

This function returns the width of the text to be drawn in the unit of pixels. If **control-\>two\_dimensional** is nonzero and the text is drawn in multiple physical lines, it returns the width of the widest line. If an error occurs, it returns -1 and assigns an error code to the external variable **merror\_code**. \

## ERRORS

`MERROR_RANGE`\

## COPYRIGHT

Copyright (C) 2001 Information-technology Promotion Agency (IPA)\
 Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)\
 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License  \<http://www.gnu.org/licenses/fdl.html\>.
