From 9044384d0286ac6dee6a27fdedaa335173fb43dc Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 19 Sep 2006 00:02:59 +0000 Subject: [PATCH] * Got rid of cucul_render_glyph(). Ahahahaha. --- cucul/cucul.h | 1 - cucul/font.c | 76 --------------------------------------------------- 2 files changed, 77 deletions(-) diff --git a/cucul/cucul.h b/cucul/cucul.h index 31f1e18..f9098c6 100644 --- a/cucul/cucul.h +++ b/cucul/cucul.h @@ -209,7 +209,6 @@ unsigned int cucul_get_font_height(cucul_font_t *); unsigned long int const *cucul_get_font_blocks(cucul_font_t *); int cucul_render_canvas(cucul_canvas_t *, cucul_font_t *, void *, unsigned int, unsigned int, unsigned int); -int cucul_render_glyph(cucul_font_t *, unsigned int, void *, unsigned int); int cucul_free_font(cucul_font_t *); /* @} */ diff --git a/cucul/font.c b/cucul/font.c index 9051ed0..139ecdf 100644 --- a/cucul/font.c +++ b/cucul/font.c @@ -493,82 +493,6 @@ int cucul_render_canvas(cucul_canvas_t *cv, cucul_font_t *f, return 0; } -/** \brief Render a single glyph onto an image buffer - * - * This function renders the given character on an image buffer using a - * specific font. The pixel format is fixed (8 bits per pixel). - * - * The required buffer size can be computed using cucul_get_font_width() - * and cucul_get_font_height(). - * - * This function never fails. - * - * \param f The font, as returned by cucul_load_font() - * \param ch The character to render - * \param buf The image buffer - * \param stride width of the destination buffer - * \return This function always returns 0. - */ -int cucul_render_glyph(cucul_font_t *f, unsigned int ch, void *buf, - unsigned int stride) -{ - unsigned int b, y; - struct glyph_info *g; - uint8_t *glyph = NULL; - - /* Find the Unicode block where our glyph lies */ - for(b = 0; b < f->header.blocks; b++) - { - if(ch < f->block_list[b].start) - { - b = f->header.blocks; - break; - } - if(ch < f->block_list[b].stop) { - break; - } - } - - /* Glyph not in font? Skip it. */ - if(b == f->header.blocks) - return 0; - - if(f->header.bpp != 8) - glyph = malloc(f->header.width * f->header.height); - - g = &f->glyph_list[f->block_list[b].index - + ch - f->block_list[b].start]; - - /* Step 1: unpack glyph */ - switch(f->header.bpp) - { - case 8: - glyph = f->font_data + g->data_offset; - break; - case 4: - unpack_glyph4(glyph, f->font_data + g->data_offset, - g->width * g->height); - break; - case 2: - unpack_glyph2(glyph, f->font_data + g->data_offset, - g->width * g->height); - break; - case 1: - unpack_glyph1(glyph, f->font_data + g->data_offset, - g->width * g->height); - break; - } - - /* Step 2: render glyph */ - for(y = 0; y < g->height; y++) - memcpy((uint8_t*)buf + y * stride, glyph + y * g->width, g->width); - - if(f->header.bpp != 8) - free(glyph); - - return 0; -} - /* * The libcaca font format, version 1 * ----------------------------------