INFO: Baseline Shifts in Cell When Character Italicized (72460)
The information in this article applies to:
- Microsoft Windows Software Development Kit (SDK) 3.1
This article was previously published under Q72460
3.00 3.10
WINDOWS
kbprg
NOTE: With TrueType fonts in Windows 3.1, this process described below is not necessary. An application should do a version check to determine if it is running under version 3.0 and perform this process only if the application is indeed running under Windows 3.0 or if the application is using non TrueType fonts in Windows 3.1.
SUMMARY
When a font is italicized under Windows version 3.0, the dimensions of the
character cells change because the descender of the character may require
more space at the left edge of the character cell.
Because the character cell is larger, the relative position of the baseline
of the character within the cell changes. The baseline itself is not
affected, but when a character is drawn italic and nonitalic with the
TextOut() function at the same x coordinate, the baseline of the italic font is shifted a few pixels to the right.
To account for this shift, calculate the slope of the font -- ascent
divided by overhang -- after italicization. Using this slope, the number of
pixels by which the character cell was expanded left is equal to descent
divided by slope, or (descent times overhang) divided by ascent. This value
can be subtracted from the x coordinate in the TextOut() call to align the
baselines.
Modification Type: | Minor | Last Reviewed: | 2/11/2005 |
---|
Keywords: | kbinfo KB72460 |
---|
|