ENABLERELATIVEWIDTHS

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

The ENABLERELATIVEWIDTHS printer escape enables or disables relative character widths. When relative widths are disabled (the default), the width of each character can be expressed as a number of device units. This method 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 extent table for the font and compute relatively scaled string widths.

Parameters

hdc

HDC Identifies the device context.

lpNewWidthFlag

LPINT Points to a short integer that specifies whether relative widths are to be enabled (1) or disabled (zero).

lpOldWidthFlag

LPINT Points to a short integer that receives the previous relative character width value.

Return Value

The return value specifies the outcome of the escape. This value 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.

When the ENABLERELATIVEWIDTHS escape is enabled, 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.

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