pike.git / src / modules / Image / font.c

version» Context lines:

pike.git/src/modules/Image/font.c:1: - /* $Id: font.c,v 1.51 1999/06/03 17:20:11 mirar Exp $ */ + /* $Id: font.c,v 1.52 1999/06/18 19:19:21 mirar Exp $ */   #include "global.h"      #define SPACE_CHAR 'i'      extern unsigned char * image_default_font;   #define IMAGE_DEFAULT_FONT_SIZE 30596      /*   **! module Image   **! note - **! $Id: font.c,v 1.51 1999/06/03 17:20:11 mirar Exp $ + **! $Id: font.c,v 1.52 1999/06/18 19:19:21 mirar Exp $   **! class Font   **!   **! note   **! Short technical documentation on a font file:   **! This object adds the text-drawing and -creation   **! capabilities of the <ref>Image</ref> module.   **!   **! For simple usage, see   **! <ref>write</ref> and <ref>load</ref>.   **!
pike.git/src/modules/Image/font.c:550:       if (args==0)    {    push_string(make_shared_binary_string("",0));    args++;    }       maxwidth2=1;       width_of=(int *)malloc((args+1)*sizeof(int)); -  if(!width_of) error("Out of memory\n"); +  if(!width_of) resource_error(NULL,0,0,"memory",0,"Out of memory.\n");       for (j=0; j<args; j++)    {    int max;    if (sp[j-args].type!=T_STRING) -  error("font->write: illegal argument(s)\n"); +  bad_arg_error("font->write",sp-args,args,0,"",sp-args, +  "Bad arguments to font->write()\n");       xsize = max = 1;    to_write_len = sp[j-args].u.string->len;    switch(sp[j-args].u.string->size_shift)    {    case 0:    to_write0 = STR0(sp[j-args].u.string);    for (i = 0; i < to_write_len; i++)    {    if (to_write0[i] < (INT32)this->chars)
pike.git/src/modules/Image/font.c:618:    o = clone_object(image_program,0);    img = ((struct image*)o->storage);    img->xsize = maxwidth2;    if(args>1)    img->ysize = this->height+((double)this->height*(double)(args-1)*(double)this->yspacing_scale)+1;    else    img->ysize = this->height;    img->rgb.r=img->rgb.g=img->rgb.b=255;    img->img=malloc(img->xsize*img->ysize*sizeof(rgb_group)+1);    -  if (!img) { free_object(o); free(width_of); error("Out of memory\n"); } +  if (!img) { free_object(o); free(width_of); resource_error(NULL,0,0,"memory",0,"Out of memory.\n"); }       MEMSET(img->img,0,img->xsize*img->ysize*sizeof(rgb_group));       for (j=0; j<args; j++)    {    to_write_len = sp[j-args].u.string->len;    switch(this->justification)    {    case J_LEFT: xsize = 0; break;    case J_RIGHT: xsize = img->xsize-width_of[j]-1; break;
pike.git/src/modules/Image/font.c:750:    }       for (j=0; j<args; j++)    {    int max;    p_wchar0 *to_write0;    p_wchar1 *to_write1;    p_wchar2 *to_write2;    int to_write_len;    if (sp[j-args].type!=T_STRING) -  error("font->write: illegal argument(s)\n"); +  bad_arg_error("font->write",sp-args,args,0,"",sp-args, +  "Bad arguments to font->write()\n");       xsize = max = 1;    to_write_len = sp[j-args].u.string->len;    switch(sp[j-args].u.string->size_shift)    {    case 0:    to_write0 = STR0(sp[j-args].u.string);    for (i = 0; i < to_write_len; i++)    {    if (xsize+char_width(THIS,to_write0[i]) > max)