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

version» Context lines:

pike.git/src/modules/Image/font.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: font.c,v 1.88 2005/11/03 16:08:51 grubba Exp $ + || $Id: font.c,v 1.89 2005/11/13 12:14:28 nilsson Exp $   */      #include "global.h"      #define SPACE_CHAR 'i'      extern const unsigned char image_default_font[];   #define IMAGE_DEFAULT_FONT_SIZE 30596      
pike.git/src/modules/Image/font.c:303:    unsigned INT32 version;    unsigned INT32 chars;    unsigned INT32 height;    unsigned INT32 baseline;    unsigned INT32 o[1];    } *fh = NULL;   #ifdef HAVE_MMAP    size_t mmaped_size = 0;   #endif    size_t size = 0; +  char *filename;    -  if (args && Pike_sp[-args].type != T_STRING) -  Pike_error("font->read: illegal or wrong number of arguments\n"); +  get_all_args("Image.Font->load()", args, ".%s", &filename);       if (!args)    {    fh = (struct file_head *)image_default_font;    size = IMAGE_DEFAULT_FONT_SIZE;    } else {    int fd = -1;       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); +  fd = fd_open(filename,fd_RDONLY,0);    if (errno == EINTR) check_threads_etc();    } while(fd < 0 && errno == EINTR);       if (fd >= 0)    {    size = (size_t) file_size(fd);    if (size > 0)    {    THREADS_ALLOW();   #ifdef HAVE_MMAP
pike.git/src/modules/Image/font.c:579:    {    if (to_write2[i] < (unsigned INT32)this->chars)    {    if (xsize+char_width(this,to_write2[i]) > max)    max=xsize+char_width(this,to_write2[i]);    xsize += char_space(this,to_write2[i]);    if (xsize > max) max=xsize;    }    }    break; + #ifdef PIKE_DEBUG    default:    Pike_fatal("Illegal shift size!\n"); -  + #endif    }    width_of[j]=max;    if (max>maxwidth2) maxwidth2=max;    }       o = clone_object(image_program,0);    img = ((struct image*)o->storage);    img->xsize = maxwidth2;    if(args>1)    img->ysize = DOUBLE_TO_INT(this->height+
pike.git/src/modules/Image/font.c:685:    (img->img+xsize)+    (img->xsize*DOUBLE_TO_INT(j*this->height*    this->yspacing_scale)),    img->xsize,    this->height);    xsize += char_space(this, c);    }    }    /* THREADS_DISALLOW(); */    break; + #ifdef PIKE_DEBUG    default:    Pike_fatal("Illegal shift size!\n"); -  + #endif    }    }    CALL_AND_UNSET_ONERROR(err);       pop_n_elems(args);    push_object(o);   }      /*! @decl int height()    *! Returns the font height.