The SetTextJustification function specifies the amount of space Windows should add to the break characters in a string of text. The space is added when an application calls the TextOut or ExtTextOut functions.
BOOL SetTextJustification(
HDC hdc, |
// handle of device context |
int nBreakExtra, |
// length of extra space, in logical units |
int nBreakCount |
// count of space characters in line of text |
); |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The break character is usually the space character (ASCII 32), but it may be defined by a font as some other character. The GetTextMetrics function can be used to retrieve a font’s break character.
The TextOut function distributes the specified extra space evenly among the break characters in the line.
The GetTextExtentPoint32 function is always used with the SetTextJustification function. The GetTextExtentPoint32 function computes the width of a given line before justification. This width must be known before an appropriate nBreakExtra value can be computed.
SetTextJustification can be used to justify a line that contains multiple strings in different fonts. In this case, each string must be justified separately.
Because rounding errors can occur during justification, Windows keeps a running error term that defines the current error value. When justifying a line that contains multiple runs, GetTextExtentPoint automatically uses this error term when it computes the extent of the next run, allowing TextOut to blend the error into the new run. After each line has been justified, this error term must be cleared to prevent it from being incorporated into the next line. The term can be cleared by calling SetTextJustification with nBreakExtra set to zero.
ExtTextOut, GetTextExtentPoint32, GetTextMetrics, TextOut
file: /Techref/os/win/api/win32/func/src/f82_15.htm, 4KB, , updated: 2000/4/7 11:19, local time: 2024/11/9 07:59,
3.12.153.105:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/os/win/api/win32/func/src/f82_15.htm"> SetTextJustification</A> |
Did you find what you needed? |