Picasso API  2.2
Typedefs | Enumerations | Functions
Text
Graphic Functions

Typedefs

typedef enum _ps_text_type ps_text_type
 Text rendering type.
typedef enum _ps_draw_text_type ps_draw_text_type
 Draw mode for rending text.
typedef enum _ps_text_align ps_text_align
 Text align mode for drawing text.

Enumerations

enum  _ps_text_type { TEXT_TYPE_SMOOTH, TEXT_TYPE_MONO, TEXT_TYPE_STROKE }
 Text rendering type. More...
enum  _ps_draw_text_type { DRAW_TEXT_FILL, DRAW_TEXT_STROKE, DRAW_TEXT_BOTH }
 Draw mode for rending text. More...
enum  _ps_text_align {
  TEXT_ALIGN_CENTER = 0, TEXT_ALIGN_TOP = 1, TEXT_ALIGN_BOTTOM = 2, TEXT_ALIGN_LEFT = 4,
  TEXT_ALIGN_RIGHT = 8
}
 Text align mode for drawing text. More...

Functions

PEXPORT ps_bool PICAPI ps_get_text_extent (ps_context *ctx, const void *text, unsigned int length, ps_size *rsize)
 Get extent for text using current font which selected to graphic context.
PEXPORT void PICAPI ps_set_text_color (ps_context *ctx, const ps_color *color)
 Set the text fill color for the graphic context.
PEXPORT void PICAPI ps_set_text_stroke_color (ps_context *ctx, const ps_color *color)
 Set the text stroke color for the graphic context.
PEXPORT void PICAPI ps_text_transform (ps_context *ctx, const ps_matrix *matrix)
 Transform text matrix for the graphic context. The text matrix is not a part of graphic state -- saving and restoring has no effect on the text matrix. The text matrix is an attribute of graphic context.
PEXPORT void PICAPI ps_set_text_matrix (ps_context *ctx, const ps_matrix *matrix)
 Set text matrix for the graphic context. The text matrix is not a part of graphic state -- saving and restoring has no effect on the text matrix. The text matrix is an attribute of graphic context.
PEXPORT void PICAPI ps_set_text_render_type (ps_context *ctx, ps_text_type type)
 Set rendering type for text.
PEXPORT void PICAPI ps_set_text_antialias (ps_context *ctx, ps_bool antialias)
 Set whether the font allowed be anti-aliasing.
PEXPORT void PICAPI ps_set_text_kerning (ps_context *ctx, ps_bool kerning)
 Set whether the font auto kerning is allowed.
PEXPORT void PICAPI ps_text_out_length (ps_context *ctx, float x, float y, const char *text, unsigned int length)
 Draw single byte characters (latin-1) at location in user space.
PEXPORT void PICAPI ps_wide_text_out_length (ps_context *ctx, float x, float y, const ps_uchar16 *text, unsigned int length)
 Draw unicode characters (ucs-2) at location in user space.
PEXPORT void PICAPI ps_draw_text (ps_context *ctx, const ps_rect *area, const void *text, unsigned int length, ps_draw_text_type type, ps_text_align align)
 Draw text in a rectangle area, using font object which is selected in graphic context.
PEXPORT ps_bool PICAPI ps_get_glyph (ps_context *ctx, int ch, ps_glyph *glyph)
 Get the glyph from a given character, using font object which is selected in graphic context.
PEXPORT void PICAPI ps_show_glyphs (ps_context *ctx, float x, float y, ps_glyph *glyphs, unsigned int length)
 Draw an array of glyphs at location in user space.
PEXPORT ps_bool PICAPI ps_get_path_from_glyph (ps_context *ctx, const ps_glyph *glyph, ps_path *path)
 Get the path from a given glyph object.
PEXPORT ps_bool PICAPI ps_glyph_get_extent (const ps_glyph *glyph, ps_size *rsize)
 Get extent for a glyph object.

Enumeration Type Documentation

Draw mode for rending text.

Enumerator:
DRAW_TEXT_FILL 

Perform a fill operation on the text.

DRAW_TEXT_STROKE 

Perform a stroke operation on the text.

DRAW_TEXT_BOTH 

Perform fill,then stroke operation on the text.

Definition at line 2322 of file picasso.h.

Text align mode for drawing text.

Enumerator:
TEXT_ALIGN_CENTER 

Centers text horizontally in the rectangle.

TEXT_ALIGN_TOP 

Justifies the text to the top of the rectangle.

TEXT_ALIGN_BOTTOM 

Justifies the text to the bottom of the rectangle.

TEXT_ALIGN_LEFT 

Aligns text to left.

TEXT_ALIGN_RIGHT 

Aligns text to right.

Definition at line 2340 of file picasso.h.

Text rendering type.

Enumerator:
TEXT_TYPE_SMOOTH 

Smooth rendering.

TEXT_TYPE_MONO 

Mono rendering.

TEXT_TYPE_STROKE 

OutLine rendering.

Definition at line 2170 of file picasso.h.


Function Documentation

void ps_draw_text ( ps_context ctx,
const ps_rect area,
const void *  text,
unsigned int  length,
ps_draw_text_type  type,
ps_text_align  align 
)

Draw text in a rectangle area, using font object which is selected in graphic context.

Parameters:
ctxPointer to an existing context object.
areaThe rectangle area which text to be drawn.
textThe unicode text string to be draw.
lengthThe length of the text string.
typeThe rending type of text.
alignThe text align mode.
See also:
ps_text_out_length, ps_wide_text_out_length
ps_bool ps_get_glyph ( ps_context ctx,
int  ch,
ps_glyph glyph 
)

Get the glyph from a given character, using font object which is selected in graphic context.

Parameters:
ctxPointer to an existing context object.
chThe character value.
glyphPointer to a structure to receiving the glyph.
Returns:
True if is success, otherwise False.
See also:
ps_show_glyphs, ps_get_path_from_glyph
ps_bool ps_get_path_from_glyph ( ps_context ctx,
const ps_glyph glyph,
ps_path path 
)

Get the path from a given glyph object.

Parameters:
ctxPointer to an existing context object.
glyphThe glyph object.
pathPointer to a structure to receiving the path.
Returns:
True if is success, otherwise False.
See also:
ps_show_glyphs
ps_bool ps_get_text_extent ( ps_context ctx,
const void *  text,
unsigned int  length,
ps_size rsize 
)

Get extent for text using current font which selected to graphic context.

Parameters:
ctxPointer to an existing context object.
textText which being tested. It can be latin-1 or unicode encoding.
lengthLength of the text.
rsizePointer to a buffer to receiving the size.
Returns:
True if is success, otherwise False.
Note:
To get extended error information, call ps_last_status.
See also:
ps_glyph_get_extent
ps_bool ps_glyph_get_extent ( const ps_glyph glyph,
ps_size rsize 
)

Get extent for a glyph object.

Parameters:
glyphPointer to an existing glyph object.
rsizePointer to a buffer to receiving the size.
Returns:
True if is success, otherwise False.
Note:
To get extended error information, call ps_last_status.
See also:
ps_get_text_extent
void ps_set_text_antialias ( ps_context ctx,
ps_bool  antialias 
)

Set whether the font allowed be anti-aliasing.

Parameters:
ctxPointer to an existing context object.
antialiasBoolean value whether anti-aliasing is allowed. (True default)
See also:
ps_set_text_matrix, ps_set_text_color, ps_set_text_stroke_color, ps_set_text_render_type, ps_text_transform, ps_set_text_kerning
void ps_set_text_color ( ps_context ctx,
const ps_color color 
)

Set the text fill color for the graphic context.

Parameters:
ctxPointer to an existing context object.
colorThe text fill color.
See also:
ps_transform, ps_set_text_matrix, ps_set_text_antialias, ps_set_text_stroke_color, ps_set_text_render_type, ps_set_text_kerning
void ps_set_text_kerning ( ps_context ctx,
ps_bool  kerning 
)

Set whether the font auto kerning is allowed.

Parameters:
ctxPointer to an existing context object.
kerningBoolean value whether auto kerning is allowed. (True default)
See also:
ps_set_text_matrix, ps_set_text_color, ps_set_text_stroke_color, ps_set_text_render_type, ps_text_transform, ps_set_text_antialias
void ps_set_text_matrix ( ps_context ctx,
const ps_matrix matrix 
)

Set text matrix for the graphic context. The text matrix is not a part of graphic state -- saving and restoring has no effect on the text matrix. The text matrix is an attribute of graphic context.

Parameters:
ctxPointer to an existing context object.
matrixPointer to an existing matrix object.
See also:
ps_text_transform, ps_set_text_antialias, ps_set_text_color, ps_set_text_stroke_color, ps_set_text_render_type, ps_set_text_kerning
void ps_set_text_render_type ( ps_context ctx,
ps_text_type  type 
)

Set rendering type for text.

Parameters:
ctxPointer to an existing context object.
typeRendering type for the text.
See also:
ps_set_text_matrix, ps_set_text_color, ps_set_text_stroke_color, ps_set_text_antialias, ps_text_transform, ps_set_text_kerning
void ps_set_text_stroke_color ( ps_context ctx,
const ps_color color 
)

Set the text stroke color for the graphic context.

Parameters:
ctxPointer to an existing context object.
colorThe text stroke color.
See also:
ps_set_text_color, ps_set_text_matrix, ps_set_text_antialias, ps_text_transform, ps_set_text_render_type, ps_set_text_kerning
void ps_show_glyphs ( ps_context ctx,
float  x,
float  y,
ps_glyph glyphs,
unsigned int  length 
)

Draw an array of glyphs at location in user space.

Parameters:
ctxPointer to an existing context object.
xThe X-coordinate at which to draw the glyphs.
yThe Y-coordinate at which to draw the glyphs.
glyphsThe array of glyphs.
lengthThe length of array.
See also:
ps_get_path_from_glyph
void ps_text_out_length ( ps_context ctx,
float  x,
float  y,
const char *  text,
unsigned int  length 
)

Draw single byte characters (latin-1) at location in user space.

Parameters:
ctxPointer to an existing context object.
xThe X-coordinate at which to draw the text.
yThe Y-coordinate at which to draw the text.
textThe text string to be draw.
lengthThe length of the text string.
See also:
ps_wide_text_out_length, ps_draw_text
void ps_text_transform ( ps_context ctx,
const ps_matrix matrix 
)

Transform text matrix for the graphic context. The text matrix is not a part of graphic state -- saving and restoring has no effect on the text matrix. The text matrix is an attribute of graphic context.

Parameters:
ctxPointer to an existing context object.
matrixPointer to an existing matrix object.
See also:
ps_set_text_matrix, ps_set_text_antialias, ps_set_text_color, ps_set_text_stroke_color, ps_set_text_render_type, ps_set_text_kerning
void ps_wide_text_out_length ( ps_context ctx,
float  x,
float  y,
const ps_uchar16 text,
unsigned int  length 
)

Draw unicode characters (ucs-2) at location in user space.

Parameters:
ctxPointer to an existing context object.
xThe X-coordinate at which to draw the text.
yThe Y-coordinate at which to draw the text.
textThe unicode text string to be draw.
lengthThe length of the text string.
See also:
ps_text_out_length, ps_draw_text