Logo Search packages:      
Sourcecode: adesklets version File versions

void imlib_text_draw_with_return_metrics ( int  x,
int  y,
const char *  text,
int *  width_return,
int *  height_return,
int *  horizontal_advance_return,
int *  vertical_advance_return 

x The x coordinate of the top left corner.
y The y coordinate of the top left corner.
text A null-byte terminated string.
width_return The width of the string.
height_return The height of the string.
horizontal_advance_return Horizontal offset.
vertical_advance_return Vertical offset.
Works just like imlib_text_draw() but also returns the width and height of the string drawn, and horizontal_advance_return returns the number of pixels you should advance horizontally to draw another string (useful if you are drawing a line of text word by word) and vertical_advance_return does the same for the vertical direction (i.e. drawing text line by line).

Definition at line 3574 of file imlib2.c.

Referenced by imlib_text_draw().

   ImlibImage         *im;
   ImlibFont          *fn;
   int                 dir;

   if (!ctx)
      ctx = imlib_context_new();
   CHECK_PARAM_POINTER("imlib_text_draw_with_return_metrics", "font",
   CHECK_PARAM_POINTER("imlib_text_draw_with_return_metrics", "image",
   CHECK_PARAM_POINTER("imlib_text_draw_with_return_metrics", "text", text);
   CAST_IMAGE(im, ctx->image);
   if ((!(im->data)) && (im->loader) && (im->loader->load))
      im->loader->load(im, NULL, 0, 1);
   if (!(im->data))
   fn = (ImlibFont *) ctx->font;

   dir = ctx->direction;
   if (ctx->direction == IMLIB_TEXT_TO_ANGLE && ctx->angle == 0.0)
      dir = IMLIB_TEXT_TO_RIGHT;

   imlib_render_str(im, fn, x, y, text, (DATA8) ctx->color.red,
                    (DATA8) ctx->color.green, (DATA8) ctx->color.blue,
                    (DATA8) ctx->color.alpha, (char)dir,
                    ctx->angle, width_return, height_return, 0,
                    horizontal_advance_return, vertical_advance_return,
                    ctx->cliprect.x, ctx->cliprect.y,
                    ctx->cliprect.w, ctx->cliprect.h);

Generated by  Doxygen 1.6.0   Back to index