dwExtent = GetTextExtent(hDC, lpString, nCount); GetTextMetrics(hDC, &tm); xExtent = LOWORD(dwExtent) - tm.tmOverhang;
GetTextExtent yields this as the extent: || / / \/ / / / / / / / /| | /---/ / / / / / / | | / / /---/ /---/ /---/ |---| / / / / / / / / | | ----- / / / / / / | | ^ /\ /\ Overhang || || Because the next Start the nonitalic H character is italic, here because it does not start the next slant and would partially character within the overwrite the previous overhang of the italic character. current characterThe overhang for bold characters synthesized by GDI is generally 1because GDI synthesizes bold fonts by outputting the text twice,offsetting the second output by one pixel, effectively increasing thewidth of each character by one pixel. Calculating the advance width of thebold text is similar to the method for italic text. TheGetTextExtent function always returns the extent of the text plus 1for bold text. Thus by subtracting the tmOverhang(1), the properadvance is achieved.
|| || || || ||===|| || || || || ---<= This line represents the "extra" overhang of 1. /\ || GetTextExtent yields this as the extent of the bold H.NOTE: This article applies only to Raster and Vectory Fonts. The GetTextExtent() family of functions always return advance widths of strings for TrueType fonts as described by ABC widths structure. For more information on ABC advance widths, see the GetCharABCWidths() function documentation.
Article ID: 74298 - Last Review: 02/27/2014 21:02:07 - Revision: 3.2