|
String Widths and Heights
In addition to retrieving character-width data for individual characters,
applications also need to compute the width and height of entire strings. Two
functions retrieve string-width and height measurements: GetTextExtentPoint32, and GetTabbedTextExtent. If the string does not contain tab characters, an application can use the GetTextExtentPoint32 function to retrieve the width and height of a specified string. If the
string contains tab characters, an application should call the GetTabbedTextExtent function.
Windows also supports a special function, called GetTextExtentExPoint, that applications can use for word-wrapping operations. This function
returns the number of characters from a specified string that fit within a given
space.
Font Ascenders and Descenders
Some applications determine the line spacing between text lines of different
sizes by using a font's maximum ascender and descender. An application can
retrieve these values by calling the GetTextMetrics function and then checking the tmAscent and tmDescent members of the TEXTMETRIC.
The maximum ascent and descent are different from the typographic ascent and
descent. In TrueType fonts, the typographic ascent and descent are typically the
top of the "f" glyph and bottom of the "g" glyph. An application can retrieve
the typographic ascender and descender for a TrueType font by calling the GetOutlineTextMetrics function and checking the values in the otmMacAscent and otmMacDescent members of the OUTLINETEXTMETRIC structure. It is important to note that TrueType font metrics do not
correspond exactly to the metrics for Windows raster fonts, because TrueType font
metrics have been designed by Apple Computer, Inc. for consistency across a variety
of display and output devices.
The following figure shows the difference between the vertical text metric
values returned in the NEWTEXTMETRIC and OUTLINETEXTMETRIC structures. (The names beginning with otm are members of the OUTLINETEXTMETRIC structure.)
Font Dimensions
An application can retrieve the physical dimensions of a TrueType font by
calling the GetOutlineTextMetrics function. An application can retrieve the physical dimensions of any other
font by calling the GetTextMetrics function. To determine the dimensions of an output device, an application can
call the GetDeviceCaps function. GetDeviceCaps returns both physical and logical dimensions.
A logical inch is a measure Windows uses to present legible fonts on the
screen and is approximately 30 to 40 percent larger than a physical inch. The use of
logical inches precludes an exact match between the output of the screen and
printer. Developers should be aware that the text on a screen is not simply a
scaled version of the text that will appear on the page, particularly if graphics
are incorporated into the text.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|