PgDrawTextArea()
Draw text within an area
Synopsis:
int PgDrawTextArea( char const *ptr,
int len,
PhRect_t const *rect,
int flags );
Description:
This function draws text within an area. This area is clipped to the dimensions of the rectangle specified by rect.
By default, the text is left-aligned (Pg_TEXT_LEFT), and the text is drawn with its baseline centered inside the drawing area.
The flags can be a combination of:
- Pg_BACK_FILL
- Fill the text extent with fill-color parameters.
- Pg_TEXT_WIDECHAR
- The text is specified as wide characters. Each character is represented by 16 bits.
- Pg_TEXT_LEFT
- Align text to left edge of rect (rect->ul.l).
- Pg_TEXT_RIGHT
- Align text to right edge of rect (rect->lr.r).
- Pg_TEXT_CENTER
- Center text horizontally within rect.
- Pg_TEXT_TOP
- Align text to top edge of rect (rect->ul.y).
- Pg_TEXT_BOTTOM
- Align text to bottom edge of rect (rect->lr.y).
- Pg_TEXT_MIDDLE
- Center text vertically within rect.
Returns:
- 0
- Success.
- -1
- An error occurred.
Classification:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
Caveats:
PgDrawTextArea() doesn't work in any context that involves the render library, such as printing or Phindows. If your application needs to use the render library, you should:
- Calculate the position at which to print the text, based on the extent of the text and the desired alignment inside the drawing area.
- Set a clipping rectangle with PgSetUserClip() or PgSetUserClipAbsolute().
- Call PgDrawText() to display the text.
