make hinting an engine api thnig - engine apis need to be mroe easily updated

SVN revision: 20850
This commit is contained in:
Carsten Haitzler 2006-02-28 04:07:49 +00:00
parent 7ee17d1174
commit e8bf4cdcbb
17 changed files with 2360 additions and 2089 deletions

View File

@ -478,6 +478,10 @@ tile_mode);
EAPI void evas_font_path_append (Evas *e, const char *path);
EAPI void evas_font_path_prepend (Evas *e, const char *path);
EAPI const Evas_List *evas_font_path_list (Evas *e);
EAPI void evas_font_hinting_set (Evas *e, Evas_Font_Hinting_Flags hinting);
EAPI Evas_Font_Hinting_Flags evas_font_hinting_get (Evas *e);
EAPI Evas_Bool evas_font_hinting_can_hint (Evas *e, Evas_Font_Hinting_Flags hinting);
EAPI void evas_font_cache_flush (Evas *e);
EAPI void evas_font_cache_set (Evas *e, int size);
@ -722,7 +726,7 @@ tile_mode);
EAPI void evas_imaging_font_hinting_set (Evas_Font_Hinting_Flags hinting);
EAPI Evas_Font_Hinting_Flags evas_imaging_font_hinting_get (void);
EAPI Evas_Bool evas_imaging_font_hinting_can_hint (Evas_Font_Hinting_Flags hinting);
EAPI Evas_Imaging_Font *evas_imaging_font_load (const char *file, const char *key, int size);
EAPI void evas_imaging_font_free (Evas_Imaging_Font *fn);
EAPI int evas_imaging_font_ascent_get (Evas_Imaging_Font *fn);

View File

@ -312,6 +312,9 @@ evas_font_load(Evas *evas, const char *name, const char *source, int size)
fd->ref = 1;
fonts_cache = evas_list_prepend(fonts_cache, fd);
}
if (font)
evas->engine.func->font_hinting_set(evas->engine.data.output, font,
evas->hinting);
return font;
}

View File

@ -61,6 +61,7 @@ evas_new(void)
e->output.render_method = RENDER_METHOD_INVALID;
e->viewport.w = 1;
e->viewport.h = 1;
e->hinting = EVAS_FONT_HINTING_BYTECODE;
return e;
}

View File

@ -969,6 +969,38 @@ evas_font_path_list(Evas *e)
return e->font_path;
}
static Evas_Font_Hinting_Flags _evas_hinting = EVAS_FONT_HINTING_BYTECODE;
EAPI void
evas_font_hinting_set(Evas *e, Evas_Font_Hinting_Flags hinting)
{
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
e->hinting = hinting;
}
EAPI Evas_Font_Hinting_Flags
evas_font_hinting_get(Evas *e)
{
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return EVAS_FONT_HINTING_BYTECODE;
MAGIC_CHECK_END();
return e->hinting;
}
EAPI Evas_Bool
evas_font_hinting_can_hint(Evas *e, Evas_Font_Hinting_Flags hinting)
{
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return 0;
MAGIC_CHECK_END();
if (e->engine.func->font_hinting_can_hint)
return e->engine.func->font_hinting_can_hint(e->engine.data.output,
hinting);
return 0;
}

View File

@ -80,13 +80,7 @@ evas_imaging_font_hinting_get(void)
EAPI Evas_Bool
evas_imaging_font_hinting_can_hint(Evas_Font_Hinting_Flags hinting)
{
Font_Hint_Flags h;
h = FONT_BYTECODE_HINT;
if (hinting == EVAS_FONT_HINTING_NONE) h = FONT_NO_HINT;
else if (hinting == EVAS_FONT_HINTING_AUTO) h = FONT_AUTO_HINT;
else if (hinting == EVAS_FONT_HINTING_BYTECODE) h = FONT_BYTECODE_HINT;
return evas_common_hinting_available(h);
return evas_common_hinting_available(hinting);
}
EAPI Evas_Imaging_Font *
@ -108,7 +102,7 @@ evas_imaging_font_load(const char *file, const char *key, int size)
tmp = evas_file_path_join(file, key);
if (tmp)
{
font = evas_common_font_load(tmp, size);
font = evas_common_font_hinting_load(tmp, size, _evas_hinting);
if (!font)
{
Eet_File *ef;
@ -122,7 +116,7 @@ evas_imaging_font_load(const char *file, const char *key, int size)
fdata = eet_read(ef, (char *)key, &fsize);
if ((fdata) && (fsize > 0))
{
font = evas_common_font_memory_load(tmp, size, fdata, fsize);
font = evas_common_font_memory_hinting_load(tmp, size, fdata, fsize, _evas_hinting);
free(fdata);
}
eet_close(ef);
@ -134,13 +128,8 @@ evas_imaging_font_load(const char *file, const char *key, int size)
else
#endif
{
font = evas_common_font_load((char *)file, size);
font = evas_common_font_hinting_load((char *)file, size, _evas_hinting);
}
h = FONT_BYTECODE_HINT;
if (_evas_hinting == EVAS_FONT_HINTING_NONE) h = FONT_NO_HINT;
else if (_evas_hinting == EVAS_FONT_HINTING_AUTO) h = FONT_AUTO_HINT;
else if (_evas_hinting == EVAS_FONT_HINTING_BYTECODE) h = FONT_BYTECODE_HINT;
if (font) evas_common_font_hinting_set(font, h);
fn = calloc(1, sizeof(RGBA_Font));
if (!fn) return NULL;
fn->font = font;
@ -224,4 +213,4 @@ EAPI int
evas_imaging_font_cache_get(void)
{
return evas_common_font_cache_get();
}
}

View File

@ -875,6 +875,10 @@ RGBA_Font_Int *evas_common_font_int_load_init (RGBA_Font_Int *fn);
void evas_common_font_free (RGBA_Font *fn);
void evas_common_font_hinting_set (RGBA_Font *fn, Font_Hint_Flags hinting);
Evas_Bool evas_common_hinting_available (Font_Hint_Flags hinting);
RGBA_Font *evas_common_font_memory_hinting_load(const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting);
RGBA_Font *evas_common_font_hinting_load (const char *name, int size, Font_Hint_Flags hinting);
RGBA_Font *evas_common_font_hinting_add (RGBA_Font *fn, const char *name, int size, Font_Hint_Flags hinting);
RGBA_Font *evas_common_font_memory_hinting_add(RGBA_Font *fn, const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting);
void evas_common_font_int_modify_cache_by(RGBA_Font_Int *fi, int dir);
int evas_common_font_cache_get (void);
void evas_common_font_cache_set (int size);

View File

@ -330,6 +330,7 @@ struct _Evas
unsigned int last_timestamp;
void *attach_data;
int last_click_counter;
Evas_Font_Hinting_Flags hinting;
};
struct _Evas_Layer
@ -592,9 +593,12 @@ struct _Evas_Func
void (*font_cache_set) (void *data, int bytes);
int (*font_cache_get) (void *data);
/* Engine functions will over time expand from here */
void (*font_hinting_set) (void *data, void *font, int hinting);
int (*font_hinting_can_hint) (void *data, int hinting);
/* void (*image_rotation_set) (void *data, void *image); */
/* Engine functions will over time expand from here */
};
struct _Evas_Image_Load_Func

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#include <math.h>
#include <string.h>
Evas_Func evas_engine_directfb_func = {
static Evas_Func evas_engine_directfb_func = {
evas_engine_directfb_info,
evas_engine_directfb_info_free,
evas_engine_directfb_setup,
@ -91,7 +91,10 @@ Evas_Func evas_engine_directfb_func = {
/* font cache functions */
evas_engine_directfb_font_cache_flush,
evas_engine_directfb_font_cache_set,
evas_engine_directfb_font_cache_get
evas_engine_directfb_font_cache_get,
evas_engine_directfb_font_hinting_set,
evas_engine_directfb_font_hinting_can_hint
};
@ -1085,6 +1088,23 @@ evas_engine_directfb_font_cache_get(void *data)
return evas_common_font_cache_get();
}
void
evas_engine_directfb_font_hinting_set(void *data, void *font, int hinting)
{
Render_Engine *re;
re = (Render_Engine *)data;
evas_common_font_hinting_set(font, hinting);
}
int
evas_engine_directfb_font_hinting_can_hint(void *data, int hinting)
{
Render_Engine *re;
re = (Render_Engine *)data;
return evas_common_hinting_available(hinting);
}
int module_open(Evas_Module *em)
{

View File

@ -194,6 +194,9 @@ void evas_engine_directfb_font_cache_flush(void *data);
void evas_engine_directfb_font_cache_set(void *data, int bytes);
int evas_engine_directfb_font_cache_get(void *data);
void evas_engine_directfb_font_hinting_set(void *data, void *font, int hinting);
int evas_engine_directfb_font_hinting_can_hint(void *data, int hinting);
void rectangle_draw_internal(void *dst, void *dc, int x, int y,
int w, int h);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff