PEXOCCSetTextAlignment - Set Text Alignment (5.0)


Synopsis

   void PEXOCCSetTextAlignment(
        PEXOCC context,
        int halignment,
        int valignment
   )
 

 
   void PEXSetTextAlignment(
        Display *display,
        XID resource_id,
        PEXOCRequestType req_type,
        int halignment,
        int valignment
   )
 

Arguments

context
An OC context returned by a successful PEXCreateOCC call.

display (OCC)
A pointer to a display structure returned by a successful XOpenDisplay call.

resource_id (OCC)
The resource identifier of the renderer or structure.

req_type (OCC)
The request type for the output command (PEXOCRender, PEXOCStore, PEXOCRenderSingle or PEXOCStoreSingle).

halignment
The horizontal text alignment (PEXHAlignNormal, PEXHAlignLeft, PEXHAlignCenter or PEXHAlignRight).

valignment
The vertical text alignment (PEXVAlignNormal, PEXVAlignTop, PEXVAlignCap, PEXVAlignHalf, PEXVAlignBase or PEXVAlignBottom).

Returns

None.

Description

Invoke PEXOCCSetTextAlignment to create an attribute output command which sets the horizontal and vertical text alignment attributes in the renderer's pipeline state according to the values specified by halignment and valignment respectively.

The text alignment positions the text primitive's extent relative to the text position. The extent is an imaginary parallelogram which has sides that parallel the x and y axes of the text's coordinate system. The sides are bounded by the characters of the character string according to the font.

PEXlib defines the following horizontal text alignments (halignment):

PEXHAlignNormal -
aligns the text with the left-side of the character string if you specify a text path of PEXPathRight. If you specify an a text path of PEXPathLeft, then the alignment is based on the right-side of the character string. If you specify a text path of PEXPathUp or PEXPathDown, then the alignment is based on the center of the character string. (5.0)

PEXHAlignLeft -
aligns the text whereby the left-side of the extent passes through the text position. (5.0)

PEXHAlignCenter -
aligns the text whereby the text position lies midway between the left and right sides of the text extent. (5.0)

PEXHAlignRight -
aligns the text whereby the right-side of the extent passes through the text position. (5.0)

PEXlib defines the following vertical text alignments (valignment):

PEXVAlignNormal -
aligns the text with the base if you specify a text path of PEXPathRight, PEXPathLeft, or PEXPathUp. If you specify a text path of PEXPathDown, then the alignment is based on the top of the text primitive's extent.

PEXVAlignTop -
aligns the text whereby the top of the extent passes through the text position. (5.0)

PEXVAlignCap - aligns the text whereby the capline of the character string passes through the text position if you specify a text path of PEXPathRight or PEXPathLeft. If you specify a text path of PEXPathUp or PEXPathDown, then the alignment is based such that the capline of the top-most character in the string passes through the text position. (5.0)

The capline is a horizontal line which bounds the top of the characters of the character string according to the font. In general there is space between the capline and the topline for placing additional rendering, such as an accent, above the character string.

PEXVAlignHalf - aligns the text whereby the halfline of the character string passes through the text position if you specify a text path of PEXPathRight or PEXPathLeft. If you specify a text path of PEXPathDown or PEXPathUp, then the alignment is based such that the text position lies halfway between the halflines of the top and bottom characters. (5.0)

The halfline is a horizontal line which lies halfway between the capline and the baseline according to the font.

PEXVAlignBase -
aligns the text whereby the baseline of the string passes through the text position if you specify a text path of PEXPathRight or PEXPathLeft. If you specify a text path of PEXPathUp or PEXPathDown, then the alignment is based such that the bottom line of the bottom-most portion of the character in the character string passes through the text position. (5.0)

The baseline is a horizontal line upon which the characters sit according to the font. In general there is space between the baseline and the bottomline for placing the lower portions of letters, such as the stems of the lowercase "j" and "q."

PEXVAlignBottom -
aligns the text whereby the bottom of the extent passes through the text position. (5.0)

If you specify an undefined text alignment, then the implementation issues a BadPEXOutputCommand error.

This function is a member of the text attribute set.

Errors

BadPEXOutputCommand
The output command contains an invalid value.

BadPEXRenderer
The specified renderer resource identifier is invalid.

BadPEXStructure
The specified structure resource identifier is invalid.

See Also

For an overview and for a list of output attribute functions, see Output Attribute Functions.