Sfoglia il codice sorgente

Rename figfont into charfont. We will support far more than figfonts in

the future.
tags/v0.99.beta18
Sam Hocevar sam 14 anni fa
parent
commit
c822280896
3 ha cambiato i file con 27 aggiunte e 17 eliminazioni
  1. +14
    -3
      caca/caca.h
  2. +1
    -2
      caca/caca_internals.h
  3. +12
    -12
      caca/figfont.c

+ 14
- 3
caca/caca.h Vedi File

@@ -49,7 +49,9 @@ extern "C"
typedef struct caca_canvas caca_canvas_t;
/** dither structure */
typedef struct caca_dither caca_dither_t;
/** font structure */
/** character font structure */
typedef struct caca_charfont caca_charfont_t;
/** bitmap font structure */
typedef struct caca_font caca_font_t;
/** file handle structure */
typedef struct caca_file caca_file_t;
@@ -413,9 +415,18 @@ __extern int caca_dither_bitmap(caca_canvas_t *, int, int, int, int,
__extern int caca_free_dither(caca_dither_t *);
/* @} */

/** \defgroup caca_font libcaca font handling
/** \defgroup caca_charfont libcaca character font handling
*
* These functions provide font handling routines and high quality
* These functions provide character font handling routines.
*
* @{ */
__extern caca_charfont_t *caca_load_charfont(void const *, size_t);
__extern int caca_free_charfont(caca_charfont_t *);
/* @} */

/** \defgroup caca_font libcaca bitmap font handling
*
* These functions provide bitmap font handling routines and high quality
* canvas to bitmap rendering.
*
* @{ */


+ 1
- 2
caca/caca_internals.h Vedi File

@@ -19,7 +19,6 @@

typedef struct caca_timer caca_timer_t;
typedef struct caca_privevent caca_privevent_t;
typedef struct caca_figfont caca_figfont_t;

#if !defined(_DOXYGEN_SKIP_ME)
# define STAT_VALUES 32
@@ -75,7 +74,7 @@ struct caca_canvas
uint32_t curattr;

/* FIGfont management */
caca_figfont_t *ff;
caca_charfont_t *ff;
};

/* Graphics driver */


+ 12
- 12
caca/figfont.c Vedi File

@@ -29,7 +29,7 @@
#include "caca.h"
#include "caca_internals.h"

struct caca_figfont
struct caca_charfont
{
int term_width;
int x, y, w, h, lines;
@@ -47,17 +47,17 @@ struct caca_figfont
};

static uint32_t hsmush(uint32_t ch1, uint32_t ch2, int rule);
static caca_figfont_t * open_figfont(char const *);
static int free_figfont(caca_figfont_t *);
static caca_charfont_t * open_charfont(char const *);
static int free_charfont(caca_charfont_t *);

/** \brief load a figfont and attach it to a canvas */
int caca_canvas_set_figfont(caca_canvas_t *cv, char const *path)
{
caca_figfont_t *ff = NULL;
caca_charfont_t *ff = NULL;

if(path)
{
ff = open_figfont(path);
ff = open_charfont(path);
if(!ff)
return -1;
}
@@ -67,7 +67,7 @@ int caca_canvas_set_figfont(caca_canvas_t *cv, char const *path)
caca_free_canvas(cv->ff->charcv);
free(cv->ff->left);
free(cv->ff->right);
free_figfont(cv->ff);
free_charfont(cv->ff);
}

cv->ff = ff;
@@ -129,7 +129,7 @@ int caca_canvas_set_figfont(caca_canvas_t *cv, char const *path)
/** \brief paste a character using the current figfont */
int caca_put_figchar(caca_canvas_t *cv, uint32_t ch)
{
caca_figfont_t *ff = cv->ff;
caca_charfont_t *ff = cv->ff;
int c, w, h, x, y, overlap, extra, xleft, xright;

if (!ff)
@@ -253,7 +253,7 @@ int caca_put_figchar(caca_canvas_t *cv, uint32_t ch)
/** \brief flush the figlet context */
int caca_flush_figlet(caca_canvas_t *cv)
{
caca_figfont_t *ff = cv->ff;
caca_charfont_t *ff = cv->ff;
int x, y;

if (!ff)
@@ -287,19 +287,19 @@ int caca_flush_figlet(caca_canvas_t *cv)
#define STD_GLYPHS (127 - 32)
#define EXT_GLYPHS (STD_GLYPHS + 7)

static caca_figfont_t * open_figfont(char const *path)
static caca_charfont_t * open_charfont(char const *path)
{
#if !defined __KERNEL__ && defined HAVE_SNPRINTF
char altpath[2048];
#endif
char buf[2048];
char hardblank[10];
caca_figfont_t *ff;
caca_charfont_t *ff;
char *data = NULL;
caca_file_t *f;
int i, j, size, comment_lines;

ff = malloc(sizeof(caca_figfont_t));
ff = malloc(sizeof(caca_charfont_t));
if(!ff)
{
seterrno(ENOMEM);
@@ -484,7 +484,7 @@ static caca_figfont_t * open_figfont(char const *path)
return ff;
}

int free_figfont(caca_figfont_t *ff)
int free_charfont(caca_charfont_t *ff)
{
caca_free_canvas(ff->fontcv);
free(ff->lookup);


Caricamento…
Annulla
Salva