Jump to content

GpiSetCharAngle

From EDM2
Revision as of 21:14, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function specifies the angle of the baseline for the characters in a string, as a relative vector. ==Syntax== GpiSetCharAngle(hps, pgradlAngle) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; pgradlAngle (PGRADIENTL) - input : Baseline angle. : The baseline angle is defined in terms of the relative coordinates of the point pgradlAngle (x, y). : If both x and y are 0, the character angle is reset to the default value. This default value...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function specifies the angle of the baseline for the characters in a string, as a relative vector.

Syntax

GpiSetCharAngle(hps, pgradlAngle)

Parameters

hps (HPS) - input
Presentation-space handle.
pgradlAngle (PGRADIENTL) - input
Baseline angle.
The baseline angle is defined in terms of the relative coordinates of the point pgradlAngle (x, y).
If both x and y are 0, the character angle is reset to the default value. This default value is (1,0), unless changed with GpiSetDefAttrs.

Return Value

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

Remarks

The coordinates of the point pgradlAngle specify integer values for the coordinates of the end of a line starting at the origin (0,0); the base line for subsequent character strings is parallel to this line. The effect of the baseline angle attribute depends on the value of the character mode attribute (see GpiSetCharMode), and whether the current font is an outline or a raster font, as described below. When the character mode is set to CM_MODE1, and the current font is a raster font, the character angle can be ignored. When the character mode is set to CM_MODE2, and the current font is a raster font, the angle is used to determine the position of each character, but the orientations of characters within the character box may not be affected by changes in character angle. If this is so, the characters are positioned so that the lower left-hand corners of the character definitions are placed at the lower left-hand corners of the character boxes after all transforms have been applied. This is illustrated below. For illustrative purposes, the figure shows all character reference points at their bottom left-hand corner.

When the character mode is set to CM_MODE3, or when the current font is an outline font, the angle is observed accurately, and the character boxes are rotated to be normal (perpendicular) to the character baseline. If the world coordinate system is such that one x-axis unit is not physically equal to one y-axis unit, a rotated character string appears to be sheared. This function must not be issued in an area bracket. The attribute mode determines whether the current value of the baseline angle 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.

Graphic Elements and Orders

Element Type: OCODE_GSCA This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE. Order: Set Character Angle Element Type: OCODE_GPSCA This element type is generated if the attribute mode is set to AM_PRESERVE. Order: Set Character Angle/Push and Set Character Angle

Example Code

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

HPS          hps;          /* Presentation-space handle. */
PGRADIENTL   pgradlAngle;  /* Baseline angle. */
BOOL         rc;           /* Success indicator. */

rc = GpiSetCharAngle(hps, pgradlAngle);

This function resets the angle of the baseline for the characters in a string, as a relative vector.

#define INCL_GPIPRIMITIVES
#include <OS2.H>

HPS hps;
GRADIENTL gradlAngle = {0L, 0L};

GpiSetCharAngle(hps, &gradlAngle);

Related Functions