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

version» Context lines:

pike.git/src/modules/Image/font.c:1: - /* $Id: font.c,v 1.62 2000/08/11 18:42:54 grubba Exp $ */ + /* $Id: font.c,v 1.63 2000/08/14 14:26:37 grubba 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.62 2000/08/11 18:42:54 grubba Exp $ + **! $Id: font.c,v 1.63 2000/08/14 14:26:37 grubba 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:243:   }      static void exit_font_struct(struct object *obj)   {    free_font_struct(THIS);    THIS=NULL;   }      /***************** internals ***********************************/    - static INLINE int char_space(struct font *this, INT32 c) + static INLINE ptrdiff_t char_space(struct font *this, INT32 c)   {    if(c==0x20)    return DOUBLE_TO_INT((double)(this->height*this->xspacing_scale)/4.5);    else if(c==0x20+128)    return (this->height*this->xspacing_scale)/18;    return this->charinfo[c].spacing*this->xspacing_scale;   }      static INLINE int char_width(struct font *this, INT32 c)   {    if(c==0x20 || c==0x20+128) return 0;    return this->charinfo[c].width;   }      #ifndef HAVE_MMAP   static INLINE int my_read(int from, void *t, size_t towrite)   { -  int res; +  ptrdiff_t res;    while((res = fd_read(from, t, towrite)) < 0)    {    switch(errno)    {    case EAGAIN: case EINTR:    continue;       default:    res = 0;    return 0;
pike.git/src/modules/Image/font.c:669:    to_write0 = STR0(sp[j-args].u.string);    THREADS_ALLOW();    for (i = 0; i < to_write_len; i++)    {    c=*(to_write0++);    if (c < (INT32)this->chars)    {    if(char_width(this,c))    write_char(this->charinfo+c,    (img->img+xsize)+ -  (img->xsize*(int)(j*this->height*this->yspacing_scale)), +  (img->xsize*DOUBLE_TO_INT(j*this->height* +  this->yspacing_scale)),    img->xsize,    this->height);    xsize += char_space(this, c);    }    }    THREADS_DISALLOW();    break;    case 1:    to_write1 = STR1(sp[j-args].u.string);    THREADS_ALLOW();    for (i = 0; i < to_write_len; i++)    {    c=*(to_write1++);    if (c < (INT32)this->chars)    {    if(char_width(this,c))    write_char(this->charinfo+c,    (img->img+xsize)+ -  (img->xsize*(int)(j*this->height*this->yspacing_scale)), +  (img->xsize*DOUBLE_TO_INT(j*this->height* +  this->yspacing_scale)),    img->xsize,    this->height);    xsize += char_space(this, c);    }    }    THREADS_DISALLOW();    break;    case 2:    to_write2 = STR2(sp[j-args].u.string);    THREADS_ALLOW();    for (i = 0; i < to_write_len; i++)    {    c=*(to_write2++);    if (c < (INT32)this->chars)    {    if(char_width(this,c))    write_char(this->charinfo+c,    (img->img+xsize)+ -  (img->xsize*(int)(j*this->height*this->yspacing_scale)), +  (img->xsize*DOUBLE_TO_INT(j*this->height* +  this->yspacing_scale)),    img->xsize,    this->height);    xsize += char_space(this, c);    }    }    THREADS_DISALLOW();    break;    default:    fatal("Illegal shift size!\n");    }
pike.git/src/modules/Image/font.c:818:    }    break;    default:    fatal("Illegal shift size!\n");    }    if (max>maxwidth2) maxwidth2=max;    }       pop_n_elems(args);    push_int(maxwidth2); -  push_int(args * THIS->height * THIS->yspacing_scale); +  push_int64(args * THIS->height * THIS->yspacing_scale);    f_aggregate(2);   }            /*   **! method void set_xspacing_scale(float scale)   **! method void set_yspacing_scale(float scale)   **! Set spacing scale to write characters closer   **! or more far away. This does not change scale