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

version» Context lines:

pike.git/src/modules/Image/font.c:1: - /* $Id: font.c,v 1.65 2000/08/19 11:16:53 grubba Exp $ */ + /* $Id: font.c,v 1.66 2000/12/01 08:10:00 hubbe 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.65 2000/08/19 11:16:53 grubba Exp $ + **! $Id: font.c,v 1.66 2000/12/01 08:10:00 hubbe 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:361:       if (!args)    {    THIS=(struct font *)xalloc(sizeof(struct font));    THIS->mem=image_default_font;    size=IMAGE_DEFAULT_FONT_SIZE;    goto loading_default;    }       if (sp[-args].type!=T_STRING) -  error("font->read: illegal or wrong number of arguments\n"); +  Pike_error("font->read: illegal or wrong number of arguments\n");       do    {   #ifdef FONT_DEBUG    fprintf(stderr,"FONT open '%s'\n",sp[-args].u.string->str);   #endif    fd = fd_open(sp[-args].u.string->str,fd_RDONLY,0);    /* FIXME: check_threads_etc(); ?    */    } while(fd < 0 && errno == EINTR);
pike.git/src/modules/Image/font.c:561:    struct image *img;    INT32 xsize=0,i,maxwidth2,j;    int *width_of;    p_wchar0 *to_write0;    p_wchar1 *to_write1;    p_wchar2 *to_write2;    ptrdiff_t to_write_len;    INT32 c;    struct font *this = (*(struct font **)(Pike_fp->current_storage));    if (!this) -  error("font->write: no font loaded\n"); +  Pike_error("font->write: no font loaded\n");       if (args==0)    {    push_string(make_shared_binary_string("",0));    args++;    }       maxwidth2=1;       width_of=(int *)malloc((args+1)*sizeof(int));
pike.git/src/modules/Image/font.c:760:   **! returns an array of width and height   **! arg string text, ...   **! One or more lines of text.   **! see also: write, height, baseline   */      void font_text_extents(INT32 args)   {    INT32 xsize,i,maxwidth2,j;    -  if (!THIS) error("font->text_extents: no font loaded\n"); +  if (!THIS) Pike_error("font->text_extents: no font loaded\n");       maxwidth2=0;       if (args==0)    {    push_string(make_shared_binary_string("",0));    args++;    }       for (j=0; j<args; j++)
pike.git/src/modules/Image/font.c:841:   **! method void set_yspacing_scale(float scale)   **! Set spacing scale to write characters closer   **! or more far away. This does not change scale   **! of character, only the space between them.   **! arg float scale   **! what scale to use   */      void font_set_xspacing_scale(INT32 args)   { -  if(!THIS) error("font->set_xspacing_scale(FLOAT): No font loaded.\n"); -  if(!args) error("font->set_xspacing_scale(FLOAT): No argument!\n"); +  if(!THIS) Pike_error("font->set_xspacing_scale(FLOAT): No font loaded.\n"); +  if(!args) Pike_error("font->set_xspacing_scale(FLOAT): No argument!\n");    if(sp[-args].type!=T_FLOAT) -  error("font->set_xspacing_scale(FLOAT): Wrong type of argument!\n"); +  Pike_error("font->set_xspacing_scale(FLOAT): Wrong type of argument!\n");       THIS->xspacing_scale = (double)sp[-args].u.float_number;   /*fprintf(stderr, "Setting xspacing to %f\n", THIS->xspacing_scale);*/    if(THIS->xspacing_scale < 0.0)    THIS->xspacing_scale=0.1;    pop_stack();   }         void font_set_yspacing_scale(INT32 args)   { -  if(!THIS) error("font->set_yspacing_scale(FLOAT): No font loaded.\n"); -  if(!args) error("font->set_yspacing_scale(FLOAT): No argument!\n"); +  if(!THIS) Pike_error("font->set_yspacing_scale(FLOAT): No font loaded.\n"); +  if(!args) Pike_error("font->set_yspacing_scale(FLOAT): No argument!\n");    if(sp[-args].type!=T_FLOAT) -  error("font->set_yspacing_scale(FLOAT): Wrong type of argument!\n"); +  Pike_error("font->set_yspacing_scale(FLOAT): Wrong type of argument!\n");       THIS->yspacing_scale = (double)sp[-args].u.float_number;   /*fprintf(stderr, "Setting yspacing to %f\n", THIS->yspacing_scale);*/    if(THIS->yspacing_scale <= 0.0)    THIS->yspacing_scale=0.1;    pop_stack();   }         /*