How To Calculate a Bounding Rectangle For a of String Text (203099)
The information in this article applies to:
- Microsoft Windows 2000 Server
- Microsoft Windows 2000 Advanced Server
- Microsoft Windows 2000 Professional
- Microsoft Platform Software Development Kit (SDK) 1.0
- the operating system: Microsoft Windows XP 64-Bit Edition
This article was previously published under Q203099 SUMMARY
In many cases it is necessary to calculate the display area occupied by a particular text string when outputting it to a display context. The code in this article demonstrates one way of deriving this information and returning it as a bounding rectangle.
Regardless of the rotation or orientation of the text, the bounding rectangle is not rotated. The left and right sides of the bounding rectangle parallel the Y axis and the top and bottom sides parallel the X axis. It is noteworthy that the bounding rectangle that's returned represents the pixel bounds of the text's glyphs rather than the typographical extents that would be used for text formatting.
REFERENCES
For more information on paths, what they are, and how to use them, please see the following article in the Microsoft Knowledge Base:
128091 SAMPLE: How to Use Paths to Create Text Effects
Modification Type: | Minor | Last Reviewed: | 4/4/2006 |
---|
Keywords: | kbDSWGDI2003Swept kbhowto KB203099 |
---|
|