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

version» Context lines:

pike.git/src/modules/Image/font.c:170:      /***************** init & exit *********************************/      static inline void free_font_struct(struct font *font)   {    if (font)    {    if (font->mem && font->mem!=image_default_font)    {   #ifdef HAVE_MMAP -  if (font->mmaped_size) { +  if (font->mmaped_size)    munmap(font->mem,font->mmaped_size); -  } else +    #else    free(font->mem);   #endif -  font->mem = NULL; +     }    free(font);    }   }    -  + #ifdef PIKE_NULL_IS_SPECIAL   static void init_font_struct(struct object *UNUSED(o))   {    THIS=NULL;   } -  + #endif      static void exit_font_struct(struct object *UNUSED(obj))   {    free_font_struct(THIS); -  THIS=NULL; +    }      /***************** internals ***********************************/      static inline int char_space(struct font *this, INT32 c)   {    if(c==0x20)    return (int)((double)(this->height*this->xspacing_scale)/4.5);    else if(c==0x20+128)    return (int)((this->height*this->xspacing_scale)/18);
pike.git/src/modules/Image/font.c:299:    unsigned INT32 height;    unsigned INT32 baseline;    unsigned INT32 o[1];    } *fh = NULL;   #ifdef HAVE_MMAP    size_t mmaped_size = 0;   #endif    int size = 0;    char *filename = NULL;    -  get_all_args("load", args, ".%s", &filename); +  get_all_args(NULL, args, ".%s", &filename);       if (!filename)    {    fh = (struct file_head *)image_default_font;    size = IMAGE_DEFAULT_FONT_SIZE;    } else {    int fd = -1;       do    {
pike.git/src/modules/Image/font.c:483:   }      /*! @decl void create(string filename)    *! Loads a font file to this font object.    *! Similar to @[load()].    */      void font_create(INT32 args)   {    font_load(args); +  pop_stack();   }      /*! @decl Image.Image write(string text, string ... more_text_lines)    *! Writes some text; thus creating an image object    *! that can be used as mask or as a complete picture.    *! One or more text lines may be provided.    *!    *! @seealso    *! @[text_extents], @[load], @[Image.Image->paste_mask], @[Image.Image->paste_alpha_color]   */
pike.git/src/modules/Image/font.c:799:    *! Set spacing scale to write characters closer    *! or more far away. This does not change scale    *! of character, only the space between them.    */      void font_set_xspacing_scale(INT32 args)   {    FLOAT_TYPE f;       if(!THIS) Pike_error("font->set_xspacing_scale(): No font loaded.\n"); -  get_all_args("set_xspaxing_scale", args, "%f", &f); +  get_all_args(NULL, args, "%f", &f);       if(f < 0.0) f=0.1;    THIS->xspacing_scale = (double)f;   }         void font_set_yspacing_scale(INT32 args)   {    FLOAT_TYPE f;       if(!THIS) Pike_error("font->set_yspacing_scale(): No font loaded.\n"); -  get_all_args("set_yspacing_scale", args, "%f", &f); +  get_all_args(NULL, args, "%f", &f);       if(f <= 0.0) f=0.1;    THIS->yspacing_scale = (double)f;   }         /*! @decl int baseline()    *!    *! Returns font baseline (pixels from top)    *!
pike.git/src/modules/Image/font.c:926:       /* function(void:void) */    ADD_FUNCTION("center", font_set_center,tFunc(tVoid,tVoid), 0);       /* function(void:void) */    ADD_FUNCTION("left", font_set_left,tFunc(tVoid,tVoid), 0);       /* function(void:void) */    ADD_FUNCTION("right", font_set_right,tFunc(tVoid,tVoid), 0);    + #ifdef PIKE_NULL_IS_SPECIAL    set_init_callback(init_font_struct); -  + #endif    set_exit_callback(exit_font_struct);   }      void exit_image_font(void)   {   }