Rich Edit/EM_FORMATRANGE Q: Need way to determine width of painted rich text

Hi,

I am developing a WYSIWYG application that needs to paint rich text to
the screen and printer.  The application does its own formatting of
the text using some app defined control characters that we extract and
parse out.

The question is, how do we determine the width of a segment of text
that we want to paint using EM_FORMATRANGE? We need this information
because we want to determine the painted widths of certain sections of
text so we can perform our own text and field alignment.

What is documented in the Win32 help file is that sending the
EM_FORMATRANGE message with wParam = 0 causes the extent of the text
that is being painted (passed in the FORMATRANGE structure as 'chrg')
to be returned in the RECT  structure 'rc'. It is implied that
rc.Bottom and rc.Right will be updated on return.

What I observe is that only the height (rc.Bottom) is modified on
return. The value of rc.Right is unaffected.

I don't see any other candidate for doing this in the API.

So, does anyone know how to obtain the 'width' extent of painted rich
text? I would be most grateful for some ideas....

Thanks,

Don