Jump to content

GpiSetCharShear

From EDM2
Revision as of 21:21, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function sets the character-shear attribute. ==Syntax== GpiSetCharShear(hps, pptlAngle) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; pptlAngle (PPOINTL) - input : Character shear vector. : With reference to the figure in the Notes, the shear angle is defined in terms of the relative coordinates of the point pptlAngle. (x, y). : If x is 0 and y is 1 (initial default), "upright" characters result. If x and y are both positive or both n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets the character-shear attribute.

Syntax

GpiSetCharShear(hps, pptlAngle)

Parameters

hps (HPS) - input
Presentation-space handle.
pptlAngle (PPOINTL) - input
Character shear vector.
With reference to the figure in the Notes, the shear angle is defined in terms of the relative coordinates of the point pptlAngle. (x, y).
If x is 0 and y is 1 (initial default), "upright" characters result. If x and y are both positive or both negative, the characters slope from bottom-left to top-right. If x and y are of opposite signs, the characters slope from top-left to bottom-right. No character inversion ever takes place as a result of a shear alone.
Usually, it is an error to specify 0 for y, because this implies an "infinite" shear. However, if both x and y are 0, the attribute is set to the default value. This can be changed from the initial default with GpiSetDefAttrs.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

The coordinates of the point pptlAngle (x, y), specify integer values that identify the end coordinates of a line originating at (0,0) (see figure below). The vertical strokes in subsequent character strings are drawn parallel to the defined line. The top of the character box remains parallel to the character baseline (which may itself be rotated).

Whether this attribute is used when character strings are drawn depends on the type of font being used (raster or outline), and on the value of the character mode attribute (see GpiSetCharMode). If it is used, then with character directions of CHDIRN_TOPBOTTOM and CHDIRN_BOTTOMTOP (see GpiSetCharDirection) the whole string is tilted by the shear angle, in addition to the individual characters being sheared if the current font is an outline font.

This function must not be issued in an area bracket.

The attribute mode (see GpiSetAttrMode) determines whether the current value of the character shear attribute is preserved.

Errors

Possible returns from WinGetLastError:

PMERR_INV_HPS (0x207F)
An invalid presentation-space handle was specified.
PMERR_PS_BUSY (0x20F4)
An attempt was made to access the presentation space from more than one thread simultaneously.
PMERR_INV_CHAR_SHEAR_ATTR (0x2050)
An invalid character shear attribute value was specified or the default value was explicitly specified with GpiSetAttrs instead of using the defaults mask.
PMERR_INV_COORDINATE (0x205B)
An invalid coordinate value was specified.

Graphic Elements and Orders

Element Type
OCODE_GSCH

This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE. Order: Set Character Shear

Element Type
OCODE_GPSCH

This element type is generated if the attribute mode is set to AM_PRESERVE. Order: Push and Set Character Shear

Example Code

#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS       hps;       /* Presentation-space handle. */
PPOINTL   pptlAngle; /* Character shear vector. */
BOOL      rc;        /* Success indicator. */

rc = GpiSetCharShear(hps, pptlAngle);

This function sets the character-shear attribute.

#define INCL_GPIPRIMITIVES
#include <OS2.H>

HPS hps; /* Presentation space handle */
POINTL ptlAngle = {50L, 70L}; /* character shear vector. */

GpiSetCharShear(hps, &ptlAngle); /* the shear */
                                 /* angle is defined in terms */
                                 /* of the relative */
                                 /* coordinates of the point */
                                 /* pptlAngle. This can be */
                                 /* changed from the initial */
                                 /* default with */
                                 /* GpiSetDefAttrs. */

Related Functions