ENABLERELATIVEWIDTHS

Syntax

short Escape(hDC, ENABLERELATIVEWIDTHS, sizeof(int),lpNewWidthFlag,lpOldWidthFlag)

This escape enables or disables relative character widths. When relative widths are disabled (the default), each character's width can be expressed as a number of device units. This guarantees that the extent of a string will equal the sum of the extents of the characters in the string. This allows applications to build an extent table by using one-character GetTextExtent function calls.

When relative widths are enabled, the sum of a string may not equal the sum of the widths of the characters. Applications that enable this feature are expected to retrieve the font's extent table and compute relatively scaled string widths.

Parameter Type/Description  

hDC HDC Identifies the device context.  
lpNewWidthFlag LPINT Points to a short-integer value that specifies whether relative widths are to be enabled (1) or disabled (0).  
lpOldWidthFlag LPINT Points to a short-integer value that will receive the previous relative character width value.  

Return Value

The return value specifies the outcome of the escape. It is 1 if the escape is successful; it is zero if the escape is not successful or not implemented.

Comments

The default state of this escape is zero; relative character widths are disabled.

The values specified as font units and accepted and returned by the escapes described in this chapter are returned in the relative units of the font when the ENABLERELATIVEWIDTHS escape is enabled.

It is assumed that only linear-scaling devices will be dealt with in a relative mode. Nonlinear-scaling devices do not implement this escape.