Change a number of internal function names.

Consistenly use the __-prefix on internal imlib_... functions.
This commit is contained in:
Kim Woelders 2014-10-19 10:40:25 +02:00
parent a4dd5bcdc2
commit 54594ccd8d
6 changed files with 181 additions and 179 deletions

View File

@ -2996,7 +2996,7 @@ imlib_image_tile(void)
EAPI Imlib_Font
imlib_load_font(const char *font_name)
{
return imlib_font_load_joined(font_name);
return __imlib_font_load_joined(font_name);
}
/**
@ -3008,7 +3008,7 @@ imlib_free_font(void)
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER("imlib_free_font", "font", ctx->font);
imlib_remove_font_from_fallback_chain(ctx->font);
imlib_font_free(ctx->font);
__imlib_font_free(ctx->font);
ctx->font = NULL;
}
@ -3035,7 +3035,7 @@ imlib_insert_font_into_fallback_chain(Imlib_Font font, Imlib_Font fallback_font)
"font", font, 1);
CHECK_PARAM_POINTER_RETURN("imlib_insert_font_into_fallback_chain",
"fallback_font", fallback_font, 1);
return imlib_font_insert_into_fallback_chain_imp(font, fallback_font);
return __imlib_font_insert_into_fallback_chain_imp(font, fallback_font);
}
/**
@ -3053,7 +3053,7 @@ imlib_remove_font_from_fallback_chain(Imlib_Font fallback_font)
{
CHECK_PARAM_POINTER("imlib_remove_font_from_fallback_chain",
"fallback_font", fallback_font);
imlib_font_remove_from_fallback_chain_imp(fallback_font);
__imlib_font_remove_from_fallback_chain_imp(fallback_font);
}
/**
@ -3138,14 +3138,14 @@ imlib_text_draw_with_return_metrics(int x, int y, const char *text,
if (ctx->direction == IMLIB_TEXT_TO_ANGLE && ctx->angle == 0.0)
dir = IMLIB_TEXT_TO_RIGHT;
imlib_render_str(im, fn, x, y, text, (DATA8) ctx->color.red,
(DATA8) ctx->color.green, (DATA8) ctx->color.blue,
(DATA8) ctx->color.alpha, (char)dir,
ctx->angle, width_return, height_return, 0,
horizontal_advance_return, vertical_advance_return,
ctx->operation,
ctx->cliprect.x, ctx->cliprect.y,
ctx->cliprect.w, ctx->cliprect.h);
__imlib_render_str(im, fn, x, y, text, (DATA8) ctx->color.red,
(DATA8) ctx->color.green, (DATA8) ctx->color.blue,
(DATA8) ctx->color.alpha, (char)dir,
ctx->angle, width_return, height_return, 0,
horizontal_advance_return, vertical_advance_return,
ctx->operation,
ctx->cliprect.x, ctx->cliprect.y,
ctx->cliprect.w, ctx->cliprect.h);
}
/**
@ -3172,7 +3172,7 @@ imlib_get_text_size(const char *text, int *width_return, int *height_return)
if (ctx->direction == IMLIB_TEXT_TO_ANGLE && ctx->angle == 0.0)
dir = IMLIB_TEXT_TO_RIGHT;
imlib_font_query_size(fn, text, &w, &h);
__imlib_font_query_size(fn, text, &w, &h);
switch (dir)
{
@ -3271,7 +3271,7 @@ imlib_get_text_advance(const char *text, int *horizontal_advance_return,
CHECK_PARAM_POINTER("imlib_get_text_advance", "font", ctx->font);
CHECK_PARAM_POINTER("imlib_get_text_advance", "text", text);
fn = (ImlibFont *) ctx->font;
imlib_font_query_advance(fn, text, &w, &h);
__imlib_font_query_advance(fn, text, &w, &h);
if (horizontal_advance_return)
*horizontal_advance_return = w;
if (vertical_advance_return)
@ -3295,7 +3295,7 @@ imlib_get_text_inset(const char *text)
CHECK_PARAM_POINTER_RETURN("imlib_get_text_advance", "font", ctx->font, 0);
CHECK_PARAM_POINTER_RETURN("imlib_get_text_advance", "text", text, 0);
fn = (ImlibFont *) ctx->font;
return imlib_font_query_inset(fn, text);
return __imlib_font_query_inset(fn, text);
}
/**
@ -3309,8 +3309,8 @@ imlib_add_path_to_font_path(const char *path)
{
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER("imlib_add_path_to_font_path", "path", path);
if (!imlib_font_path_exists(path))
imlib_font_add_font_path(path);
if (!__imlib_font_path_exists(path))
__imlib_font_add_font_path(path);
}
/**
@ -3323,7 +3323,7 @@ imlib_remove_path_from_font_path(const char *path)
{
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER("imlib_remove_path_from_font_path", "path", path);
imlib_font_del_font_path(path);
__imlib_font_del_font_path(path);
}
/**
@ -3344,7 +3344,7 @@ imlib_list_font_path(int *number_return)
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER_RETURN("imlib_list_font_path", "number_return",
number_return, NULL);
return imlib_font_list_font_path(number_return);
return __imlib_font_list_font_path(number_return);
}
/**
@ -3410,7 +3410,7 @@ imlib_text_get_index_and_location(const char *text, int x, int y,
return -1;
}
cp = imlib_font_query_text_at_pos(fn, text, xx, yy, &cx, &cy, &cw, &ch);
cp = __imlib_font_query_text_at_pos(fn, text, xx, yy, &cx, &cy, &cw, &ch);
switch (dir)
{
@ -3492,7 +3492,7 @@ imlib_text_get_location_at_index(const char *text, int index,
CHECK_PARAM_POINTER("imlib_text_get_index_and_location", "text", text);
fn = (ImlibFont *) ctx->font;
imlib_font_query_char_coords(fn, text, index, &cx, &cy, &cw, &ch);
__imlib_font_query_char_coords(fn, text, index, &cx, &cy, &cw, &ch);
imlib_get_text_size(text, &w, &h);
@ -3563,7 +3563,7 @@ imlib_list_fonts(int *number_return)
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER_RETURN("imlib_list_fonts", "number_return",
number_return, NULL);
return imlib_font_list_fonts(number_return);
return __imlib_font_list_fonts(number_return);
}
/**
@ -3589,7 +3589,7 @@ EAPI int
imlib_get_font_cache_size(void)
{
CHECK_CONTEXT(ctx);
return imlib_font_cache_get();
return __imlib_font_cache_get();
}
/**
@ -3604,7 +3604,7 @@ EAPI void
imlib_set_font_cache_size(int bytes)
{
CHECK_CONTEXT(ctx);
imlib_font_cache_set(bytes);
__imlib_font_cache_set(bytes);
}
/**
@ -3615,7 +3615,7 @@ EAPI void
imlib_flush_font_cache(void)
{
CHECK_CONTEXT(ctx);
imlib_font_flush();
__imlib_font_flush();
}
/**
@ -3629,7 +3629,7 @@ imlib_get_font_ascent(void)
{
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER_RETURN("imlib_get_font_ascent", "font", ctx->font, 0);
return imlib_font_ascent_get(ctx->font);
return __imlib_font_ascent_get(ctx->font);
}
/**
@ -3643,7 +3643,7 @@ imlib_get_font_descent(void)
{
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER_RETURN("imlib_get_font_ascent", "font", ctx->font, 0);
return imlib_font_descent_get(ctx->font);
return __imlib_font_descent_get(ctx->font);
}
/**
@ -3657,7 +3657,7 @@ imlib_get_maximum_font_ascent(void)
{
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER_RETURN("imlib_get_font_ascent", "font", ctx->font, 0);
return imlib_font_max_ascent_get(ctx->font);
return __imlib_font_max_ascent_get(ctx->font);
}
/**
@ -3671,7 +3671,7 @@ imlib_get_maximum_font_descent(void)
{
CHECK_CONTEXT(ctx);
CHECK_PARAM_POINTER_RETURN("imlib_get_font_ascent", "font", ctx->font, 0);
return imlib_font_max_descent_get(ctx->font);
return __imlib_font_max_descent_get(ctx->font);
}
/**

View File

@ -64,69 +64,69 @@ struct _Imlib_Font_Glyph
/* functions */
void imlib_font_init(void);
int imlib_font_ascent_get(ImlibFont * fn);
int imlib_font_descent_get(ImlibFont * fn);
int imlib_font_max_ascent_get(ImlibFont * fn);
int imlib_font_max_descent_get(ImlibFont * fn);
int imlib_font_get_line_advance(ImlibFont * fn);
int imlib_font_utf8_get_next(unsigned char *buf, int *iindex);
void imlib_font_add_font_path(const char *path);
void imlib_font_del_font_path(const char *path);
int imlib_font_path_exists(const char *path);
char **imlib_font_list_font_path(int *num_ret);
char **imlib_font_list_fonts(int *num_ret);
void __imlib_font_init(void);
int __imlib_font_ascent_get(ImlibFont * fn);
int __imlib_font_descent_get(ImlibFont * fn);
int __imlib_font_max_ascent_get(ImlibFont * fn);
int __imlib_font_max_descent_get(ImlibFont * fn);
int __imlib_font_get_line_advance(ImlibFont * fn);
int __imlib_font_utf8_get_next(unsigned char *buf, int *iindex);
void __imlib_font_add_font_path(const char *path);
void __imlib_font_del_font_path(const char *path);
int __imlib_font_path_exists(const char *path);
char **__imlib_font_list_font_path(int *num_ret);
char **__imlib_font_list_fonts(int *num_ret);
ImlibFont *imlib_font_load_joined(const char *name);
void imlib_font_free(ImlibFont * fn);
int imlib_font_insert_into_fallback_chain_imp(ImlibFont * fn,
ImlibFont *__imlib_font_load_joined(const char *name);
void __imlib_font_free(ImlibFont * fn);
int __imlib_font_insert_into_fallback_chain_imp(ImlibFont * fn,
ImlibFont * fallback);
void imlib_font_remove_from_fallback_chain_imp(ImlibFont * fn);
int imlib_font_cache_get(void);
void imlib_font_cache_set(int size);
void imlib_font_flush(void);
void imlib_font_modify_cache_by(ImlibFont * fn, int dir);
void imlib_font_modify_cache_by(ImlibFont * fn, int dir);
void imlib_font_flush_last(void);
ImlibFont *imlib_font_find(const char *name, int size);
ImlibFont *imlib_font_find_glyph(ImlibFont * fn, int gl, unsigned int *ret_index);
void __imlib_font_remove_from_fallback_chain_imp(ImlibFont * fn);
int __imlib_font_cache_get(void);
void __imlib_font_cache_set(int size);
void __imlib_font_flush(void);
void __imlib_font_modify_cache_by(ImlibFont * fn, int dir);
void __imlib_font_modify_cache_by(ImlibFont * fn, int dir);
void __imlib_font_flush_last(void);
ImlibFont *__imlib_font_find(const char *name, int size);
ImlibFont *__imlib_font_find_glyph(ImlibFont * fn, int gl, unsigned int *ret_index);
void imlib_font_query_size(ImlibFont * fn, const char *text,
void __imlib_font_query_size(ImlibFont * fn, const char *text,
int *w, int *h);
int imlib_font_query_inset(ImlibFont * fn, const char *text);
void imlib_font_query_advance(ImlibFont * fn, const char *text,
int __imlib_font_query_inset(ImlibFont * fn, const char *text);
void __imlib_font_query_advance(ImlibFont * fn, const char *text,
int *h_adv, int *v_adv);
int imlib_font_query_char_coords(ImlibFont * fn,
int __imlib_font_query_char_coords(ImlibFont * fn,
const char *text, int pos,
int *cx, int *cy, int *cw,
int *ch);
int imlib_font_query_text_at_pos(ImlibFont * fn,
int __imlib_font_query_text_at_pos(ImlibFont * fn,
const char *text, int x, int y,
int *cx, int *cy, int *cw,
int *ch);
Imlib_Font_Glyph *imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index);
void imlib_render_str(ImlibImage * im, ImlibFont * f, int drx,
Imlib_Font_Glyph *__imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index);
void __imlib_render_str(ImlibImage * im, ImlibFont * f, int drx,
int dry, const char *text, DATA8 r,
DATA8 g, DATA8 b, DATA8 a, char dir,
double angle, int *retw, int *reth,
int blur, int *nextx, int *nexty,
ImlibOp op, int clx, int cly, int clw,
int clh);
void imlib_font_draw(ImlibImage * dst, DATA32 col,
void __imlib_font_draw(ImlibImage * dst, DATA32 col,
ImlibFont * fn, int x, int y,
const char *text, int *nextx, int *nexty,
int clx, int cly, int clw, int clh);
/* data manipulation */
void *imlib_object_list_prepend(void *in_list, void *in_item);
void *imlib_object_list_remove(void *in_list, void *in_item);
Imlib_Hash *imlib_hash_add(Imlib_Hash * hash, const char *key,
void *__imlib_object_list_prepend(void *in_list, void *in_item);
void *__imlib_object_list_remove(void *in_list, void *in_item);
Imlib_Hash *__imlib_hash_add(Imlib_Hash * hash, const char *key,
const void *data);
void *imlib_hash_find(Imlib_Hash * hash, const char *key);
void imlib_hash_free(Imlib_Hash * hash);
void imlib_hash_foreach(Imlib_Hash * hash,
void *__imlib_hash_find(Imlib_Hash * hash, const char *key);
void __imlib_hash_free(Imlib_Hash * hash);
void __imlib_hash_foreach(Imlib_Hash * hash,
int (*func) (Imlib_Hash * hash,
const char *key, void *data,
void *fdata),

View File

@ -18,7 +18,7 @@
extern FT_Library ft_lib;
Imlib_Font_Glyph *
imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index)
__imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index)
{
Imlib_Font_Glyph *fg;
char key[6];
@ -31,7 +31,7 @@ imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index)
key[4] = ((index >> 28) & 0x0f) + 1;
key[5] = 0;
fg = imlib_hash_find(fn->glyphs, key);
fg = __imlib_hash_find(fn->glyphs, key);
if (fg)
return fg;
@ -62,24 +62,24 @@ imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index)
}
fg->glyph_out = (FT_BitmapGlyph) fg->glyph;
fn->glyphs = imlib_hash_add(fn->glyphs, key, fg);
fn->glyphs = __imlib_hash_add(fn->glyphs, key, fg);
return fg;
}
void
imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry,
const char *text, DATA8 r, DATA8 g, DATA8 b, DATA8 a,
char dir, double angle, int *retw, int *reth, int blur,
int *nextx, int *nexty, ImlibOp op, int clx, int cly,
int clw, int clh)
__imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry,
const char *text, DATA8 r, DATA8 g, DATA8 b, DATA8 a,
char dir, double angle, int *retw, int *reth, int blur,
int *nextx, int *nexty, ImlibOp op, int clx, int cly,
int clw, int clh)
{
int w, h, ascent;
ImlibImage *im2;
DATA32 *data, col;
int nx, ny;
imlib_font_query_advance(fn, text, &w, NULL);
h = imlib_font_max_ascent_get(fn) - imlib_font_max_descent_get(fn);
__imlib_font_query_advance(fn, text, &w, NULL);
h = __imlib_font_max_ascent_get(fn) - __imlib_font_max_descent_get(fn);
data = malloc(w * h * sizeof(DATA32));
if (!data)
@ -97,9 +97,9 @@ imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry,
/* TODO check for endianess */
col = (a << 24) | (r << 16) | (g << 8) | b;
ascent = imlib_font_max_ascent_get(fn);
ascent = __imlib_font_max_ascent_get(fn);
imlib_font_draw(im2, col, fn, 0, ascent, text, &nx, &ny, 0, 0, w, h);
__imlib_font_draw(im2, col, fn, 0, ascent, text, &nx, &ny, 0, 0, w, h);
/* OK, now we have small ImlibImage with text rendered,
* have to blend it on im */
@ -253,7 +253,7 @@ imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry,
* ret_index will be set to 0
*/
ImlibFont *
imlib_font_find_glyph(ImlibFont * first_fn, int gl, unsigned int *ret_index)
__imlib_font_find_glyph(ImlibFont * first_fn, int gl, unsigned int *ret_index)
{
ImlibFont *fn = first_fn;
@ -276,9 +276,9 @@ imlib_font_find_glyph(ImlibFont * first_fn, int gl, unsigned int *ret_index)
}
void
imlib_font_draw(ImlibImage * dst, DATA32 col, ImlibFont * fn, int x, int y,
const char *text, int *nextx, int *nexty, int clx, int cly,
int clw, int clh)
__imlib_font_draw(ImlibImage * dst, DATA32 col, ImlibFont * fn, int x, int y,
const char *text, int *nextx, int *nexty, int clx, int cly,
int clw, int clh)
{
int use_kerning;
int pen_x, pen_y;
@ -344,10 +344,10 @@ imlib_font_draw(ImlibImage * dst, DATA32 col, ImlibFont * fn, int x, int y,
int chr_x, chr_y;
int gl;
gl = imlib_font_utf8_get_next((unsigned char *)text, &chr);
gl = __imlib_font_utf8_get_next((unsigned char *)text, &chr);
if (gl == 0)
break;
fn_in_chain = imlib_font_find_glyph(fn, gl, &index);
fn_in_chain = __imlib_font_find_glyph(fn, gl, &index);
if ((use_kerning) && (prev_index) && (index))
{
FT_Vector delta;
@ -356,7 +356,7 @@ imlib_font_draw(ImlibImage * dst, DATA32 col, ImlibFont * fn, int x, int y,
ft_kerning_default, &delta);
pen_x += delta.x << 2;
}
fg = imlib_font_cache_glyph_get(fn_in_chain, index);
fg = __imlib_font_cache_glyph_get(fn_in_chain, index);
if (!fg)
continue;
@ -449,5 +449,5 @@ imlib_font_draw(ImlibImage * dst, DATA32 col, ImlibFont * fn, int x, int y,
if (nextx)
*nextx = (pen_x >> 8) - x;
if (nexty)
*nexty = imlib_font_get_line_advance(fn);
*nexty = __imlib_font_get_line_advance(fn);
}

View File

@ -24,7 +24,7 @@ static char **fpath = NULL;
static int fpath_num = 0;
static Imlib_Object_List *fonts = NULL;
static ImlibFont *imlib_font_load(const char *name, int faceidx, int size);
static ImlibFont *__imlib_font_load(const char *name, int faceidx, int size);
static int font_modify_cache_cb(Imlib_Hash * hash, const char *key,
void *data, void *fdata);
static int font_flush_free_glyph_cb(Imlib_Hash * hash, const char *key,
@ -32,9 +32,9 @@ static int font_flush_free_glyph_cb(Imlib_Hash * hash, const char *key,
/* FIXME now! listdir() from evas_object_text.c */
/* separate fontname and size, find font file, start imlib_font_load() then */
/* separate fontname and size, find font file, start __imlib_font_load() then */
ImlibFont *
imlib_font_load_joined(const char *fontname)
__imlib_font_load_joined(const char *fontname)
{
int j, k, size, faceidx, namelen;
char *name, *file = NULL, *tmp;
@ -128,23 +128,23 @@ imlib_font_load_joined(const char *fontname)
if (!file)
return NULL;
fn = imlib_font_load(file, faceidx, size);
fn = __imlib_font_load(file, faceidx, size);
free(file);
return fn;
}
static ImlibFont *
imlib_font_load(const char *name, int faceidx, int size)
__imlib_font_load(const char *name, int faceidx, int size)
{
int error;
ImlibFont *fn;
char *file;
fn = imlib_font_find(name, size);
fn = __imlib_font_find(name, size);
if (fn)
return fn;
imlib_font_init();
__imlib_font_init();
fn = malloc(sizeof(ImlibFont));
file = (char *)name;
@ -209,30 +209,31 @@ imlib_font_load(const char *name, int faceidx, int size)
fn->fallback_prev = NULL;
fn->fallback_next = NULL;
fonts = imlib_object_list_prepend(fonts, fn);
fonts = __imlib_object_list_prepend(fonts, fn);
return fn;
}
void
imlib_font_free(ImlibFont * fn)
__imlib_font_free(ImlibFont * fn)
{
fn->references--;
if (fn->references == 0)
{
imlib_font_modify_cache_by(fn, 1);
imlib_font_flush();
__imlib_font_modify_cache_by(fn, 1);
__imlib_font_flush();
}
}
int
imlib_font_insert_into_fallback_chain_imp(ImlibFont * fn, ImlibFont * fallback)
__imlib_font_insert_into_fallback_chain_imp(ImlibFont * fn,
ImlibFont * fallback)
{
/* avoid infinite recursion */
if (fn == fallback)
return 1;
/* now remove the given fallback font from any chain it's already in */
imlib_font_remove_from_fallback_chain_imp(fallback);
__imlib_font_remove_from_fallback_chain_imp(fallback);
/* insert fallback into fn's font chain */
ImlibFont *tmp = fn->fallback_next;
@ -246,7 +247,7 @@ imlib_font_insert_into_fallback_chain_imp(ImlibFont * fn, ImlibFont * fallback)
}
void
imlib_font_remove_from_fallback_chain_imp(ImlibFont * fn)
__imlib_font_remove_from_fallback_chain_imp(ImlibFont * fn)
{
/* if fn has a previous font in its font chain, then make its fallback_next fn's fallback_next since fn is going away */
if (fn->fallback_prev)
@ -269,7 +270,7 @@ font_modify_cache_cb(Imlib_Hash * hash, const char *key, void *data,
}
void
imlib_font_modify_cache_by(ImlibFont * fn, int dir)
__imlib_font_modify_cache_by(ImlibFont * fn, int dir)
{
int sz_name = 0, sz_file = 0, sz_hash = 0;
@ -279,30 +280,30 @@ imlib_font_modify_cache_by(ImlibFont * fn, int dir)
sz_file = strlen(fn->file);
if (fn->glyphs)
sz_hash = sizeof(Imlib_Hash);
imlib_hash_foreach(fn->glyphs, font_modify_cache_cb, &dir);
__imlib_hash_foreach(fn->glyphs, font_modify_cache_cb, &dir);
font_cache_usage += dir * (sizeof(ImlibFont) + sz_name + sz_file + sz_hash + sizeof(FT_FaceRec) + 16384); /* fudge values */
}
int
imlib_font_cache_get(void)
__imlib_font_cache_get(void)
{
return font_cache;
}
void
imlib_font_cache_set(int size)
__imlib_font_cache_set(int size)
{
font_cache = size;
imlib_font_flush();
__imlib_font_flush();
}
void
imlib_font_flush(void)
__imlib_font_flush(void)
{
if (font_cache_usage < font_cache)
return;
while (font_cache_usage > font_cache)
imlib_font_flush_last();
__imlib_font_flush_last();
}
static int
@ -318,7 +319,7 @@ font_flush_free_glyph_cb(Imlib_Hash * hash, const char *key, void *data,
}
void
imlib_font_flush_last(void)
__imlib_font_flush_last(void)
{
Imlib_Object_List *l;
ImlibFont *fn = NULL;
@ -334,11 +335,11 @@ imlib_font_flush_last(void)
if (!fn)
return;
fonts = imlib_object_list_remove(fonts, fn);
imlib_font_modify_cache_by(fn, -1);
fonts = __imlib_object_list_remove(fonts, fn);
__imlib_font_modify_cache_by(fn, -1);
imlib_hash_foreach(fn->glyphs, font_flush_free_glyph_cb, NULL);
imlib_hash_free(fn->glyphs);
__imlib_hash_foreach(fn->glyphs, font_flush_free_glyph_cb, NULL);
__imlib_hash_free(fn->glyphs);
if (fn->file)
free(fn->file);
@ -349,7 +350,7 @@ imlib_font_flush_last(void)
}
ImlibFont *
imlib_font_find(const char *name, int size)
__imlib_font_find(const char *name, int size)
{
Imlib_Object_List *l;
@ -361,10 +362,10 @@ imlib_font_find(const char *name, int size)
if ((fn->size == size) && (!strcmp(name, fn->name)))
{
if (fn->references == 0)
imlib_font_modify_cache_by(fn, -1);
__imlib_font_modify_cache_by(fn, -1);
fn->references++;
fonts = imlib_object_list_remove(fonts, fn);
fonts = imlib_object_list_prepend(fonts, fn);
fonts = __imlib_object_list_remove(fonts, fn);
fonts = __imlib_object_list_prepend(fonts, fn);
return fn;
}
}
@ -373,7 +374,7 @@ imlib_font_find(const char *name, int size)
/* font pathes */
void
imlib_font_add_font_path(const char *path)
__imlib_font_add_font_path(const char *path)
{
fpath_num++;
if (!fpath)
@ -384,7 +385,7 @@ imlib_font_add_font_path(const char *path)
}
void
imlib_font_del_font_path(const char *path)
__imlib_font_del_font_path(const char *path)
{
int i, j;
@ -409,7 +410,7 @@ imlib_font_del_font_path(const char *path)
}
int
imlib_font_path_exists(const char *path)
__imlib_font_path_exists(const char *path)
{
int i;
@ -422,7 +423,7 @@ imlib_font_path_exists(const char *path)
}
char **
imlib_font_list_font_path(int *num_ret)
__imlib_font_list_font_path(int *num_ret)
{
*num_ret = fpath_num;
return fpath;
@ -430,14 +431,14 @@ imlib_font_list_font_path(int *num_ret)
/* fonts list */
char **
imlib_font_list_fonts(int *num_ret)
__imlib_font_list_fonts(int *num_ret)
{
int i, j, d, l = 0;
char **list = NULL, **dir, *path;
FT_Error error;
char *p;
imlib_font_init();
__imlib_font_init();
for (i = 0; i < fpath_num; i++)
{

View File

@ -17,14 +17,14 @@
FT_Library ft_lib;
static int imlib_hash_gen(const char *key);
static int __imlib_hash_gen(const char *key);
static int imlib_list_alloc_error(void);
static int _imlib_hash_alloc_error = 0;
static int _imlib_list_alloc_error = 0;
void
imlib_font_init(void)
__imlib_font_init(void)
{
static int initialised = 0;
int error;
@ -38,7 +38,7 @@ imlib_font_init(void)
}
int
imlib_font_ascent_get(ImlibFont * fn)
__imlib_font_ascent_get(ImlibFont * fn)
{
int val;
int ret;
@ -53,7 +53,7 @@ imlib_font_ascent_get(ImlibFont * fn)
}
int
imlib_font_descent_get(ImlibFont * fn)
__imlib_font_descent_get(ImlibFont * fn)
{
int val;
int ret;
@ -68,7 +68,7 @@ imlib_font_descent_get(ImlibFont * fn)
}
int
imlib_font_max_ascent_get(ImlibFont * fn)
__imlib_font_max_ascent_get(ImlibFont * fn)
{
int val;
int ret;
@ -83,7 +83,7 @@ imlib_font_max_ascent_get(ImlibFont * fn)
}
int
imlib_font_max_descent_get(ImlibFont * fn)
__imlib_font_max_descent_get(ImlibFont * fn)
{
int val;
int ret;
@ -98,7 +98,7 @@ imlib_font_max_descent_get(ImlibFont * fn)
}
int
imlib_font_get_line_advance(ImlibFont * fn)
__imlib_font_get_line_advance(ImlibFont * fn)
{
int val;
int ret;
@ -113,7 +113,7 @@ imlib_font_get_line_advance(ImlibFont * fn)
}
int
imlib_font_utf8_get_next(unsigned char *buf, int *iindex)
__imlib_font_utf8_get_next(unsigned char *buf, int *iindex)
{
/* Reads UTF8 bytes from @buf, starting at *@index and returns the code
* point of the next valid code point. @index is updated ready for the
@ -178,7 +178,7 @@ imlib_font_utf8_get_next(unsigned char *buf, int *iindex)
/* TODO put this somewhere else */
void *
imlib_object_list_prepend(void *in_list, void *in_item)
__imlib_object_list_prepend(void *in_list, void *in_item)
{
Imlib_Object_List *new_l;
Imlib_Object_List *list, *item;
@ -201,7 +201,7 @@ imlib_object_list_prepend(void *in_list, void *in_item)
}
void *
imlib_object_list_remove(void *in_list, void *in_item)
__imlib_object_list_remove(void *in_list, void *in_item)
{
Imlib_Object_List *return_l;
Imlib_Object_List *list, *item;
@ -235,7 +235,7 @@ imlib_object_list_remove(void *in_list, void *in_item)
}
static int
imlib_hash_gen(const char *key)
__imlib_hash_gen(const char *key)
{
unsigned int hash_num = 0;
const unsigned char *ptr;
@ -251,7 +251,7 @@ imlib_hash_gen(const char *key)
}
Imlib_Hash *
imlib_hash_add(Imlib_Hash * hash, const char *key, const void *data)
__imlib_hash_add(Imlib_Hash * hash, const char *key, const void *data)
{
int hash_num;
Imlib_Hash_El *el;
@ -285,7 +285,7 @@ imlib_hash_add(Imlib_Hash * hash, const char *key, const void *data)
_imlib_hash_alloc_error = 1;
return hash;
}
hash_num = imlib_hash_gen(key);
hash_num = __imlib_hash_gen(key);
}
else
{
@ -295,7 +295,7 @@ imlib_hash_add(Imlib_Hash * hash, const char *key, const void *data)
el->data = (void *)data;
hash->buckets[hash_num] =
imlib_object_list_prepend(hash->buckets[hash_num], el);
__imlib_object_list_prepend(hash->buckets[hash_num], el);
if (imlib_list_alloc_error())
{
@ -310,7 +310,7 @@ imlib_hash_add(Imlib_Hash * hash, const char *key, const void *data)
}
void *
imlib_hash_find(Imlib_Hash * hash, const char *key)
__imlib_hash_find(Imlib_Hash * hash, const char *key)
{
int hash_num;
Imlib_Hash_El *el;
@ -319,7 +319,7 @@ imlib_hash_find(Imlib_Hash * hash, const char *key)
_imlib_hash_alloc_error = 0;
if (!hash)
return NULL;
hash_num = imlib_hash_gen(key);
hash_num = __imlib_hash_gen(key);
for (l = hash->buckets[hash_num]; l; l = l->next)
{
el = (Imlib_Hash_El *) l;
@ -330,9 +330,9 @@ imlib_hash_find(Imlib_Hash * hash, const char *key)
{
/* FIXME: move to front of list without alloc */
hash->buckets[hash_num] =
imlib_object_list_remove(hash->buckets[hash_num], el);
__imlib_object_list_remove(hash->buckets[hash_num], el);
hash->buckets[hash_num] =
imlib_object_list_prepend(hash->buckets[hash_num], el);
__imlib_object_list_prepend(hash->buckets[hash_num], el);
if (imlib_list_alloc_error())
{
_imlib_hash_alloc_error = 1;
@ -346,7 +346,7 @@ imlib_hash_find(Imlib_Hash * hash, const char *key)
}
static int
imlib_hash_size(Imlib_Hash * hash)
__imlib_hash_size(Imlib_Hash * hash)
{
if (!hash)
return 0;
@ -354,13 +354,13 @@ imlib_hash_size(Imlib_Hash * hash)
}
void
imlib_hash_free(Imlib_Hash * hash)
__imlib_hash_free(Imlib_Hash * hash)
{
int i, size;
if (!hash)
return;
size = imlib_hash_size(hash);
size = __imlib_hash_size(hash);
for (i = 0; i < size; i++)
{
while (hash->buckets[i])
@ -370,7 +370,8 @@ imlib_hash_free(Imlib_Hash * hash)
el = (Imlib_Hash_El *) hash->buckets[i];
if (el->key)
free(el->key);
hash->buckets[i] = imlib_object_list_remove(hash->buckets[i], el);
hash->buckets[i] =
__imlib_object_list_remove(hash->buckets[i], el);
free(el);
}
}
@ -378,16 +379,16 @@ imlib_hash_free(Imlib_Hash * hash)
}
void
imlib_hash_foreach(Imlib_Hash * hash, int (*func) (Imlib_Hash * hash,
const char *key, void *data,
void *fdata),
const void *fdata)
__imlib_hash_foreach(Imlib_Hash * hash, int (*func) (Imlib_Hash * hash,
const char *key,
void *data, void *fdata),
const void *fdata)
{
int i, size;
if (!hash)
return;
size = imlib_hash_size(hash);
size = __imlib_hash_size(hash);
for (i = 0; i < size; i++)
{
Imlib_Object_List *l, *next_l;

View File

@ -19,7 +19,7 @@ extern FT_Library ft_lib;
/* string extents */
void
imlib_font_query_size(ImlibFont * fn, const char *text, int *w, int *h)
__imlib_font_query_size(ImlibFont * fn, const char *text, int *w, int *h)
{
int use_kerning;
int pen_x /*, pen_y */ ;
@ -41,10 +41,10 @@ imlib_font_query_size(ImlibFont * fn, const char *text, int *w, int *h)
int chr_x, /*chr_y, */ chr_w;
int gl;
gl = imlib_font_utf8_get_next((unsigned char *)text, &chr);
gl = __imlib_font_utf8_get_next((unsigned char *)text, &chr);
if (gl == 0)
break;
fn_in_chain = imlib_font_find_glyph(fn, gl, &index);
fn_in_chain = __imlib_font_find_glyph(fn, gl, &index);
if ((use_kerning) && (prev_index) && (index))
{
FT_Vector delta;
@ -53,7 +53,7 @@ imlib_font_query_size(ImlibFont * fn, const char *text, int *w, int *h)
ft_kerning_default, &delta);
pen_x += delta.x << 2;
}
fg = imlib_font_cache_glyph_get(fn_in_chain, index);
fg = __imlib_font_cache_glyph_get(fn_in_chain, index);
if (!fg)
continue;
@ -72,12 +72,12 @@ imlib_font_query_size(ImlibFont * fn, const char *text, int *w, int *h)
if (w)
*w = (pen_x >> 8) - start_x;
if (h)
*h = imlib_font_max_ascent_get(fn) - imlib_font_max_descent_get(fn); /* TODO: compute this inside the loop since we now may be dealing with multiple fonts */
*h = __imlib_font_max_ascent_get(fn) - __imlib_font_max_descent_get(fn); /* TODO: compute this inside the loop since we now may be dealing with multiple fonts */
}
/* text x inset */
int
imlib_font_query_inset(ImlibFont * fn, const char *text)
__imlib_font_query_inset(ImlibFont * fn, const char *text)
{
FT_UInt index;
Imlib_Font_Glyph *fg;
@ -88,11 +88,11 @@ imlib_font_query_inset(ImlibFont * fn, const char *text)
chr = 0;
if (!text[0])
return 0;
gl = imlib_font_utf8_get_next((unsigned char *)text, &chr);
gl = __imlib_font_utf8_get_next((unsigned char *)text, &chr);
if (gl == 0)
return 0;
fn_in_chain = imlib_font_find_glyph(fn, gl, &index);
fg = imlib_font_cache_glyph_get(fn_in_chain, index);
fn_in_chain = __imlib_font_find_glyph(fn, gl, &index);
fg = __imlib_font_cache_glyph_get(fn_in_chain, index);
if (!fg)
return 0;
return -fg->glyph_out->left;
@ -100,8 +100,8 @@ imlib_font_query_inset(ImlibFont * fn, const char *text)
/* h & v advance */
void
imlib_font_query_advance(ImlibFont * fn, const char *text, int *h_adv,
int *v_adv)
__imlib_font_query_advance(ImlibFont * fn, const char *text, int *h_adv,
int *v_adv)
{
int use_kerning;
int pen_x;
@ -120,10 +120,10 @@ imlib_font_query_advance(ImlibFont * fn, const char *text, int *h_adv,
ImlibFont *fn_in_chain;
int gl;
gl = imlib_font_utf8_get_next((unsigned char *)text, &chr);
gl = __imlib_font_utf8_get_next((unsigned char *)text, &chr);
if (gl == 0)
break;
fn_in_chain = imlib_font_find_glyph(fn, gl, &index);
fn_in_chain = __imlib_font_find_glyph(fn, gl, &index);
if ((use_kerning) && (prev_index) && (index))
{
FT_Vector delta;
@ -132,7 +132,7 @@ imlib_font_query_advance(ImlibFont * fn, const char *text, int *h_adv,
ft_kerning_default, &delta);
pen_x += delta.x << 2;
}
fg = imlib_font_cache_glyph_get(fn_in_chain, index);
fg = __imlib_font_cache_glyph_get(fn_in_chain, index);
if (!fg)
continue;
@ -140,15 +140,15 @@ imlib_font_query_advance(ImlibFont * fn, const char *text, int *h_adv,
prev_index = index;
}
if (v_adv)
*v_adv = imlib_font_get_line_advance(fn); /* TODO: compute this in the loop since we may be dealing with multiple fonts */
*v_adv = __imlib_font_get_line_advance(fn); /* TODO: compute this in the loop since we may be dealing with multiple fonts */
if (h_adv)
*h_adv = (pen_x >> 8) - start_x;
}
/* x y w h for char at char pos */
int
imlib_font_query_char_coords(ImlibFont * fn, const char *text, int pos,
int *cx, int *cy, int *cw, int *ch)
__imlib_font_query_char_coords(ImlibFont * fn, const char *text, int pos,
int *cx, int *cy, int *cw, int *ch)
{
int use_kerning;
int pen_x;
@ -161,8 +161,8 @@ imlib_font_query_char_coords(ImlibFont * fn, const char *text, int pos,
use_kerning = FT_HAS_KERNING(fn->ft.face);
prev_index = 0;
prev_chr_end = 0;
asc = imlib_font_max_ascent_get(fn);
desc = imlib_font_max_descent_get(fn);
asc = __imlib_font_max_ascent_get(fn);
desc = __imlib_font_max_descent_get(fn);
for (chr = 0; text[chr];)
{
int pchr;
@ -174,10 +174,10 @@ imlib_font_query_char_coords(ImlibFont * fn, const char *text, int pos,
FT_Vector delta;
pchr = chr;
gl = imlib_font_utf8_get_next((unsigned char *)text, &chr);
gl = __imlib_font_utf8_get_next((unsigned char *)text, &chr);
if (gl == 0)
break;
fn_in_chain = imlib_font_find_glyph(fn, gl, &index);
fn_in_chain = __imlib_font_find_glyph(fn, gl, &index);
kern = 0;
if ((use_kerning) && (prev_index) && (index))
{
@ -186,7 +186,7 @@ imlib_font_query_char_coords(ImlibFont * fn, const char *text, int pos,
kern = delta.x << 2;
pen_x += kern;
}
fg = imlib_font_cache_glyph_get(fn_in_chain, index);
fg = __imlib_font_cache_glyph_get(fn_in_chain, index);
if (!fg)
continue;
@ -228,8 +228,8 @@ imlib_font_query_char_coords(ImlibFont * fn, const char *text, int pos,
/* char pos of text at xy pos */
int
imlib_font_query_text_at_pos(ImlibFont * fn, const char *text, int x, int y,
int *cx, int *cy, int *cw, int *ch)
__imlib_font_query_text_at_pos(ImlibFont * fn, const char *text, int x, int y,
int *cx, int *cy, int *cw, int *ch)
{
int use_kerning;
int pen_x;
@ -242,8 +242,8 @@ imlib_font_query_text_at_pos(ImlibFont * fn, const char *text, int x, int y,
use_kerning = FT_HAS_KERNING(fn->ft.face);
prev_index = 0;
prev_chr_end = 0;
asc = imlib_font_max_ascent_get(fn);
desc = imlib_font_max_descent_get(fn);
asc = __imlib_font_max_ascent_get(fn);
desc = __imlib_font_max_descent_get(fn);
for (chr = 0; text[chr];)
{
int pchr;
@ -255,10 +255,10 @@ imlib_font_query_text_at_pos(ImlibFont * fn, const char *text, int x, int y,
FT_Vector delta;
pchr = chr;
gl = imlib_font_utf8_get_next((unsigned char *)text, &chr);
gl = __imlib_font_utf8_get_next((unsigned char *)text, &chr);
if (gl == 0)
break;
fn_in_chain = imlib_font_find_glyph(fn, gl, &index);
fn_in_chain = __imlib_font_find_glyph(fn, gl, &index);
kern = 0;
if ((use_kerning) && (prev_index) && (index))
{
@ -267,7 +267,7 @@ imlib_font_query_text_at_pos(ImlibFont * fn, const char *text, int x, int y,
kern = delta.x << 2;
pen_x += kern;
}
fg = imlib_font_cache_glyph_get(fn_in_chain, index);
fg = __imlib_font_cache_glyph_get(fn_in_chain, index);
if (!fg)
continue;