Remove evas internal dependency from the evas_font module

Summary:
dev branch : devs/subhransu/font

The Final goal is to move the evas_font module to ector so that both ector and evas can reuse the code.
make the api simple so that sam eapi can be used by evas_textblock and ector text.

This is the 1st stage to achive that gola, first remove the evas internal dependancy as much as possible before moving to ector library.

Reviewers: jpeg, raster, herdsman, cedric, id213sin

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5419
This commit is contained in:
subhransu mohanty 2017-11-07 11:22:09 +09:00 committed by Carsten Haitzler (Rasterman)
parent a75b3dcdfb
commit b038d7df25
22 changed files with 1296 additions and 1188 deletions

View File

@ -493,7 +493,8 @@ lib/evas/common/language/evas_bidi_utils.h \
lib/evas/common/language/evas_language_utils.h \ lib/evas/common/language/evas_language_utils.h \
lib/evas/common/language/evas_script_table.h \ lib/evas/common/language/evas_script_table.h \
lib/evas/common/evas_text_utils.h \ lib/evas/common/evas_text_utils.h \
lib/evas/common/evas_font_ot.h lib/evas/common/evas_font_ot.h \
lib/evas/common/evas_font_draw.h
lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/lib/evas/canvas \ -I$(top_srcdir)/src/lib/evas/canvas \

View File

@ -13,8 +13,14 @@
#include <fontconfig/fcfreetype.h> #include <fontconfig/fcfreetype.h>
#endif #endif
#include "evas_common_private.h" #include "evas_font.h"
#include "evas_private.h"
/* General types - used for script type chceking */
#define OPAQUE_TYPE(type) struct __##type { int a; }; \
typedef struct __##type type
OPAQUE_TYPE(Evas_Font_Set); /* General type for RGBA_Font */
OPAQUE_TYPE(Evas_Font_Instance); /* General type for RGBA_Font_Int */
/* font dir cache */ /* font dir cache */
static Eina_Hash *font_dirs = NULL; static Eina_Hash *font_dirs = NULL;
@ -57,6 +63,70 @@ static int evas_object_text_font_string_parse(char *buffer, char dest[14][256]);
static FcConfig *fc_config = NULL; static FcConfig *fc_config = NULL;
#endif #endif
/* FIXME move these helper function to eina_file or eina_path */
/* get the casefold feature! */
#include <fnmatch.h>
#ifndef _MSC_VER
# include <unistd.h>
# include <sys/param.h>
#endif
int
_file_path_is_full_path(const char *path)
{
if (!path) return 0;
#ifdef _WIN32
if (evil_path_is_absolute(path)) return 1;
#else
if (path[0] == '/') return 1;
#endif
return 0;
}
static DATA64
_file_modified_time(const char *file)
{
struct stat st;
if (stat(file, &st) < 0) return 0;
if (st.st_ctime > st.st_mtime) return (DATA64)st.st_ctime;
else return (DATA64)st.st_mtime;
return 0;
}
Eina_List *
_file_path_list(char *path, const char *match, int match_case)
{
Eina_File_Direct_Info *info;
Eina_Iterator *it;
Eina_List *files = NULL;
int flags;
flags = FNM_PATHNAME;
#ifdef FNM_CASEFOLD
if (!match_case)
flags |= FNM_CASEFOLD;
#elif defined FNM_IGNORECASE
if (!match_case)
flags |= FNM_IGNORECASE;
#else
/*#warning "Your libc does not provide case-insensitive matching!"*/
#endif
it = eina_file_direct_ls(path);
EINA_ITERATOR_FOREACH(it, info)
{
if (match)
{
if (fnmatch(match, info->path + info->name_start, flags) == 0)
files = eina_list_append(files, strdup(info->path + info->name_start));
}
else
files = eina_list_append(files, strdup(info->path + info->name_start));
}
if (it) eina_iterator_free(it);
return files;
}
static void static void
evas_font_init(void) evas_font_init(void)
{ {
@ -145,17 +215,15 @@ evas_font_set_get(const char *name)
} }
void void
evas_fonts_zero_free(Evas *eo_evas) evas_fonts_zero_free()
{ {
Fndat *fd; Fndat *fd;
Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
EINA_LIST_FREE(fonts_zero, fd) EINA_LIST_FREE(fonts_zero, fd)
{ {
if (fd->fdesc) evas_font_desc_unref(fd->fdesc); if (fd->fdesc) evas_font_desc_unref(fd->fdesc);
if (fd->source) eina_stringshare_del(fd->source); if (fd->source) eina_stringshare_del(fd->source);
if ((evas->engine.func) && (evas->engine.func->font_free)) evas_common_font_free((RGBA_Font *)fd->font);
evas->engine.func->font_free(_evas_engine_context(evas), fd->font);
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
if (fd->set) FcFontSetDestroy(fd->set); if (fd->set) FcFontSetDestroy(fd->set);
if (fd->p_nm) FcPatternDestroy(fd->p_nm); if (fd->p_nm) FcPatternDestroy(fd->p_nm);
@ -165,10 +233,9 @@ evas_fonts_zero_free(Evas *eo_evas)
} }
void void
evas_fonts_zero_pressure(Evas *eo_evas) evas_fonts_zero_pressure()
{ {
Fndat *fd; Fndat *fd;
Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
while (fonts_zero while (fonts_zero
&& eina_list_count(fonts_zero) > 4) /* 4 is arbitrary */ && eina_list_count(fonts_zero) > 4) /* 4 is arbitrary */
@ -180,8 +247,7 @@ evas_fonts_zero_pressure(Evas *eo_evas)
if (fd->fdesc) evas_font_desc_unref(fd->fdesc); if (fd->fdesc) evas_font_desc_unref(fd->fdesc);
if (fd->source) eina_stringshare_del(fd->source); if (fd->source) eina_stringshare_del(fd->source);
if ((evas->engine.func) && (evas->engine.func->font_free)) evas_common_font_free((RGBA_Font *)fd->font);
evas->engine.func->font_free(_evas_engine_context(evas), fd->font);
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
if (fd->set) FcFontSetDestroy(fd->set); if (fd->set) FcFontSetDestroy(fd->set);
if (fd->p_nm) FcPatternDestroy(fd->p_nm); if (fd->p_nm) FcPatternDestroy(fd->p_nm);
@ -193,11 +259,10 @@ evas_fonts_zero_pressure(Evas *eo_evas)
} }
void void
evas_font_free(Evas *eo_evas, void *font) evas_font_free(void *font)
{ {
Eina_List *l; Eina_List *l;
Fndat *fd; Fndat *fd;
Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
EINA_LIST_FOREACH(fonts_cache, l, fd) EINA_LIST_FOREACH(fonts_cache, l, fd)
{ {
@ -222,7 +287,7 @@ evas_font_free(Evas *eo_evas, void *font)
if (fd->fdesc) evas_font_desc_unref(fd->fdesc); if (fd->fdesc) evas_font_desc_unref(fd->fdesc);
if (fd->source) eina_stringshare_del(fd->source); if (fd->source) eina_stringshare_del(fd->source);
evas->engine.func->font_free(_evas_engine_context(evas), fd->font); evas_common_font_free((RGBA_Font *)fd->font);
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
if (fd->set) FcFontSetDestroy(fd->set); if (fd->set) FcFontSetDestroy(fd->set);
if (fd->p_nm) FcPatternDestroy(fd->p_nm); if (fd->p_nm) FcPatternDestroy(fd->p_nm);
@ -235,10 +300,9 @@ evas_font_free(Evas *eo_evas, void *font)
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
static Evas_Font_Set * static Evas_Font_Set *
_evas_load_fontconfig(Evas_Font_Set *font, Evas *eo_evas, FcFontSet *set, int size, _evas_load_fontconfig(Evas_Font_Set *font, FcFontSet *set, int size,
Font_Rend_Flags wanted_rend, Efl_Text_Font_Bitmap_Scalable bitmap_scalable) Font_Rend_Flags wanted_rend, Efl_Text_Font_Bitmap_Scalable bitmap_scalable)
{ {
Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
int i; int i;
/* Do loading for all in family */ /* Do loading for all in family */
@ -249,9 +313,9 @@ _evas_load_fontconfig(Evas_Font_Set *font, Evas *eo_evas, FcFontSet *set, int si
if (FcPatternGet(set->fonts[i], FC_FILE, 0, &filename) == FcResultMatch) if (FcPatternGet(set->fonts[i], FC_FILE, 0, &filename) == FcResultMatch)
{ {
if (font) if (font)
evas->engine.func->font_add(_evas_engine_context(evas), font, (char *)filename.u.s, size, wanted_rend, bitmap_scalable); evas_common_font_add((RGBA_Font *)font, (char *)filename.u.s, size, wanted_rend, bitmap_scalable);
else else
font = evas->engine.func->font_load(_evas_engine_context(evas), (char *)filename.u.s, size, wanted_rend, bitmap_scalable); font = (Evas_Font_Set *)evas_common_font_load((char *)filename.u.s, size, wanted_rend, bitmap_scalable);
} }
} }
@ -552,9 +616,8 @@ evas_font_name_parse(Evas_Font_Description *fdesc, const char *name)
} }
void * void *
evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size, Efl_Text_Font_Bitmap_Scalable bitmap_scalable) evas_font_load(const Eina_List *font_paths, int hinting, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size, Efl_Text_Font_Bitmap_Scalable bitmap_scalable)
{ {
Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
FcPattern *p_nm = NULL; FcPattern *p_nm = NULL;
FcFontSet *set = NULL; FcFontSet *set = NULL;
@ -608,7 +671,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
if (found_fd) if (found_fd)
{ {
font = _evas_load_fontconfig(font, evas->evas, found_fd->set, size, wanted_rend, bitmap_scalable); font = _evas_load_fontconfig(font, found_fd->set, size, wanted_rend, bitmap_scalable);
goto on_find; goto on_find;
} }
#endif #endif
@ -641,7 +704,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
if (found_fd) if (found_fd)
{ {
font = _evas_load_fontconfig(font, evas->evas, found_fd->set, size, wanted_rend, bitmap_scalable); font = _evas_load_fontconfig(font, found_fd->set, size, wanted_rend, bitmap_scalable);
goto on_find; goto on_find;
} }
#endif #endif
@ -654,12 +717,10 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
if (source) /* Load Font from "eet" source */ if (source) /* Load Font from "eet" source */
{ {
Eet_File *ef; Eet_File *ef;
char *fake_name; char fake_name[PATH_MAX];
fake_name = evas_file_path_join(source, nm); eina_file_path_join(fake_name, PATH_MAX, source, nm);
if (fake_name) font = (Evas_Font_Set *)evas_common_font_load(fake_name, size, wanted_rend, bitmap_scalable);
{
font = evas->engine.func->font_load(_evas_engine_context(evas), fake_name, size, wanted_rend, bitmap_scalable);
if (!font) /* Load from fake name failed, probably not cached */ if (!font) /* Load from fake name failed, probably not cached */
{ {
/* read original!!! */ /* read original!!! */
@ -672,32 +733,30 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
fdata = eet_read(ef, nm, &fsize); fdata = eet_read(ef, nm, &fsize);
if (fdata) if (fdata)
{ {
font = evas->engine.func->font_memory_load(_evas_engine_context(evas), source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable); font = (Evas_Font_Set *)evas_common_font_memory_load(source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable);
free(fdata); free(fdata);
} }
eet_close(ef); eet_close(ef);
} }
} }
free(fake_name);
}
} }
if (!font) /* Source load failed */ if (!font) /* Source load failed */
{ {
if (evas_file_path_is_full_path((char *)nm)) /* Try filename */ if (_file_path_is_full_path((char *)nm)) /* Try filename */
font = evas->engine.func->font_load(_evas_engine_context(evas), (char *)nm, size, wanted_rend, bitmap_scalable); font = (Evas_Font_Set *)evas_common_font_load((char *)nm, size, wanted_rend, bitmap_scalable);
else /* search font path */ else /* search font path */
{ {
Eina_List *ll; const Eina_List *ll;
char *dir; char *dir;
EINA_LIST_FOREACH(evas->font_path, ll, dir) EINA_LIST_FOREACH(font_paths, ll, dir)
{ {
const char *f_file; const char *f_file;
f_file = evas_font_dir_cache_find(dir, (char *)nm); f_file = evas_font_dir_cache_find(dir, (char *)nm);
if (f_file) if (f_file)
{ {
font = evas->engine.func->font_load(_evas_engine_context(evas), f_file, size, wanted_rend, bitmap_scalable); font = (Evas_Font_Set *)evas_common_font_load(f_file, size, wanted_rend, bitmap_scalable);
if (font) break; if (font) break;
} }
} }
@ -711,7 +770,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
f_file = evas_font_dir_cache_find(dir, (char *)nm); f_file = evas_font_dir_cache_find(dir, (char *)nm);
if (f_file) if (f_file)
{ {
font = evas->engine.func->font_load(_evas_engine_context(evas), f_file, size, wanted_rend, bitmap_scalable); font = (Evas_Font_Set *)evas_common_font_load(f_file, size, wanted_rend, bitmap_scalable);
if (font) break; if (font) break;
} }
} }
@ -726,13 +785,10 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
if (source) if (source)
{ {
Eet_File *ef; Eet_File *ef;
char *fake_name; char fake_name[PATH_MAX];
fake_name = evas_file_path_join(source, nm); eina_file_path_join(fake_name, PATH_MAX, source, nm);
if (fake_name) if (!evas_common_font_add((RGBA_Font *)font, fake_name, size, wanted_rend, bitmap_scalable))
{
/* FIXME: make an engine func */
if (!evas->engine.func->font_add(_evas_engine_context(evas), font, fake_name, size, wanted_rend, bitmap_scalable))
{ {
/* read original!!! */ /* read original!!! */
ef = eet_open(source, EET_FILE_MODE_READ); ef = eet_open(source, EET_FILE_MODE_READ);
@ -744,7 +800,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
fdata = eet_read(ef, nm, &fsize); fdata = eet_read(ef, nm, &fsize);
if ((fdata) && (fsize > 0)) if ((fdata) && (fsize > 0))
{ {
ok = evas->engine.func->font_memory_add(_evas_engine_context(evas), font, source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable); ok = evas_common_font_memory_add((RGBA_Font *)font, source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable);
} }
eet_close(ef); eet_close(ef);
free(fdata); free(fdata);
@ -752,27 +808,25 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
} }
else else
ok = (void *)1; ok = (void *)1;
free(fake_name);
}
} }
if (!ok) if (!ok)
{ {
if (evas_file_path_is_full_path((char *)nm)) if (_file_path_is_full_path((char *)nm))
evas->engine.func->font_add(_evas_engine_context(evas), font, (char *)nm, size, wanted_rend, bitmap_scalable); evas_common_font_add((RGBA_Font *)font, (char *)nm, size, wanted_rend, bitmap_scalable);
else else
{ {
Eina_List *ll; const Eina_List *ll;
char *dir; char *dir;
RGBA_Font *fn = NULL; RGBA_Font *fn = NULL;
EINA_LIST_FOREACH(evas->font_path, ll, dir) EINA_LIST_FOREACH(font_paths, ll, dir)
{ {
const char *f_file; const char *f_file;
f_file = evas_font_dir_cache_find(dir, (char *)nm); f_file = evas_font_dir_cache_find(dir, (char *)nm);
if (f_file) if (f_file)
{ {
fn = (RGBA_Font *)evas->engine.func->font_add(_evas_engine_context(evas), font, f_file, size, wanted_rend, bitmap_scalable); fn = evas_common_font_add((RGBA_Font *)font, f_file, size, wanted_rend, bitmap_scalable);
if (fn) if (fn)
break; break;
} }
@ -787,7 +841,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
f_file = evas_font_dir_cache_find(dir, (char *)nm); f_file = evas_font_dir_cache_find(dir, (char *)nm);
if (f_file) if (f_file)
{ {
fn = (RGBA_Font *)evas->engine.func->font_add(_evas_engine_context(evas), font, f_file, size, wanted_rend, bitmap_scalable); fn = evas_common_font_add((RGBA_Font *)font, f_file, size, wanted_rend, bitmap_scalable);
if (fn) if (fn)
break; break;
} }
@ -851,13 +905,14 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
set = FcFontSort(fc_config, p_nm, FcTrue, NULL, &res); set = FcFontSort(fc_config, p_nm, FcTrue, NULL, &res);
if (!set) if (!set)
{ {
ERR("No fontconfig font matches '%s'. It was the last resource, no font found!", fdesc->name); //FIXME add ERR log capability
//ERR("No fontconfig font matches '%s'. It was the last resource, no font found!", fdesc->name);
FcPatternDestroy(p_nm); FcPatternDestroy(p_nm);
p_nm = NULL; p_nm = NULL;
} }
else else
{ {
font = _evas_load_fontconfig(font, evas->evas, set, size, wanted_rend, bitmap_scalable); font = _evas_load_fontconfig(font, set, size, wanted_rend, bitmap_scalable);
} }
} }
else /* Add a fallback list from fontconfig according to the found font. */ else /* Add a fallback list from fontconfig according to the found font. */
@ -884,7 +939,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
} }
else else
{ {
font = _evas_load_fontconfig(font, evas->evas, set, size, wanted_rend, bitmap_scalable); font = _evas_load_fontconfig(font, set, size, wanted_rend, bitmap_scalable);
} }
} }
#endif #endif
@ -913,24 +968,20 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
} }
if (font) if (font)
evas->engine.func->font_hinting_set(_evas_engine_context(evas), font, evas_common_font_hinting_set((RGBA_Font *)font, hinting);
evas->hinting);
return font; return font;
} }
void void
evas_font_load_hinting_set(Evas *eo_evas, void *font, int hinting) evas_font_load_hinting_set(void *font, int hinting)
{ {
Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS); evas_common_font_hinting_set((RGBA_Font *) font, hinting);
evas->engine.func->font_hinting_set(_evas_engine_context(evas), font,
hinting);
} }
Eina_List * Eina_List *
evas_font_dir_available_list(const Evas *eo_evas) evas_font_dir_available_list(const Eina_List *font_paths)
{ {
const Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS); const Eina_List *l;
Eina_List *l;
Eina_List *ll; Eina_List *ll;
Eina_List *available = NULL; Eina_List *available = NULL;
char *dir; char *dir;
@ -967,12 +1018,12 @@ evas_font_dir_available_list(const Evas *eo_evas)
} }
#endif #endif
/* Add fonts in evas font_path*/ /* Add fonts in font_paths*/
if (evas->font_path) if (font_paths)
{ {
if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL); if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL);
EINA_LIST_FOREACH(evas->font_path, l, dir) EINA_LIST_FOREACH(font_paths, l, dir)
{ {
Evas_Font_Dir *fd; Evas_Font_Dir *fd;
@ -1032,12 +1083,12 @@ font_cache_dir_free(const Eina_Hash *hash EINA_UNUSED, const void *key, void *da
static Evas_Font_Dir * static Evas_Font_Dir *
object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd) object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
{ {
char file_path[PATH_MAX];
DATA64 mt; DATA64 mt;
char *tmp;
if (fd) if (fd)
{ {
mt = evas_file_modified_time(dir); mt = _file_modified_time(dir);
if (mt != fd->dir_mod_time) if (mt != fd->dir_mod_time)
{ {
eina_hash_del(font_dirs, dir, fd); eina_hash_del(font_dirs, dir, fd);
@ -1045,11 +1096,8 @@ object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
} }
else else
{ {
tmp = evas_file_path_join(dir, "fonts.dir"); eina_file_path_join(file_path, PATH_MAX, dir, "fonts.dir");
if (tmp) mt = _file_modified_time(file_path);
{
mt = evas_file_modified_time(tmp);
free(tmp);
if (mt != fd->fonts_dir_mod_time) if (mt != fd->fonts_dir_mod_time)
{ {
eina_hash_del(font_dirs, dir, fd); eina_hash_del(font_dirs, dir, fd);
@ -1057,12 +1105,8 @@ object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
} }
else else
{ {
tmp = evas_file_path_join(dir, "fonts.alias"); eina_file_path_join(file_path, PATH_MAX, dir, "fonts.alias");
if (tmp) mt = _file_modified_time(file_path);
{
mt = evas_file_modified_time(tmp);
free(tmp);
}
if (mt != fd->fonts_alias_mod_time) if (mt != fd->fonts_alias_mod_time)
{ {
eina_hash_del(font_dirs, dir, fd); eina_hash_del(font_dirs, dir, fd);
@ -1073,7 +1117,6 @@ object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
} }
} }
} }
}
return object_text_font_cache_dir_add(dir); return object_text_font_cache_dir_add(dir);
} }
@ -1155,10 +1198,13 @@ object_text_font_cache_font_find(Evas_Font_Dir *fd, char *font)
static Evas_Font_Dir * static Evas_Font_Dir *
object_text_font_cache_dir_add(char *dir) object_text_font_cache_dir_add(char *dir)
{ {
char file_path[PATH_MAX];
Evas_Font_Dir *fd; Evas_Font_Dir *fd;
char *tmp, *tmp2, *file; char *file;
char tmp2[PATH_MAX];
Eina_List *fdir; Eina_List *fdir;
Evas_Font *fn; Evas_Font *fn;
FILE *f;
fd = calloc(1, sizeof(Evas_Font_Dir)); fd = calloc(1, sizeof(Evas_Font_Dir));
if (!fd) return NULL; if (!fd) return NULL;
@ -1169,12 +1215,9 @@ object_text_font_cache_dir_add(char *dir)
/* READ fonts.alias, fonts.dir and directory listing */ /* READ fonts.alias, fonts.dir and directory listing */
/* fonts.dir */ /* fonts.dir */
tmp = evas_file_path_join(dir, "fonts.dir"); eina_file_path_join(file_path, PATH_MAX, dir, "fonts.dir");
if (tmp)
{
FILE *f;
f = fopen(tmp, "rb"); f = fopen(file_path, "rb");
if (f) if (f)
{ {
int num; int num;
@ -1199,12 +1242,8 @@ object_text_font_cache_dir_add(char *dir)
fn->type = 1; fn->type = 1;
for (i = 0; i < 14; i++) for (i = 0; i < 14; i++)
fn->x.prop[i] = eina_stringshare_add(font_prop[i]); fn->x.prop[i] = eina_stringshare_add(font_prop[i]);
tmp2 = evas_file_path_join(dir, fname); eina_file_path_join(tmp2, PATH_MAX, dir, fname);
if (tmp2)
{
fn->path = eina_stringshare_add(tmp2); fn->path = eina_stringshare_add(tmp2);
free(tmp2);
}
fd->fonts = eina_list_append(fd->fonts, fn); fd->fonts = eina_list_append(fd->fonts, fn);
} }
} }
@ -1212,47 +1251,33 @@ object_text_font_cache_dir_add(char *dir)
cant_read: ; cant_read: ;
fclose(f); fclose(f);
} }
free(tmp);
}
/* directoy listing */ /* directoy listing */
fdir = evas_file_path_list(dir, "*.ttf", 0); fdir = _file_path_list(dir, "*.ttf", 0);
EINA_LIST_FREE(fdir, file) EINA_LIST_FREE(fdir, file)
{ {
tmp = evas_file_path_join(dir, file); eina_file_path_join(file_path, PATH_MAX, dir, file);
if (tmp)
{
fn = calloc(1, sizeof(Evas_Font)); fn = calloc(1, sizeof(Evas_Font));
if (fn) if (fn)
{ {
char *p; char *p;
fn->type = 0; fn->type = 0;
tmp2 = alloca(strlen(file) + 1);
strcpy(tmp2, file); strcpy(tmp2, file);
p = strrchr(tmp2, '.'); p = strrchr(tmp2, '.');
if (p) *p = 0; if (p) *p = 0;
fn->simple.name = eina_stringshare_add(tmp2); fn->simple.name = eina_stringshare_add(tmp2);
tmp2 = evas_file_path_join(dir, file); eina_file_path_join(tmp2, PATH_MAX, dir, file);
if (tmp2)
{
fn->path = eina_stringshare_add(tmp2); fn->path = eina_stringshare_add(tmp2);
free(tmp2);
}
fd->fonts = eina_list_append(fd->fonts, fn); fd->fonts = eina_list_append(fd->fonts, fn);
} }
free(tmp);
}
free(file); free(file);
} }
/* fonts.alias */ /* fonts.alias */
tmp = evas_file_path_join(dir, "fonts.alias"); eina_file_path_join(file_path, PATH_MAX, dir, "fonts.alias");
if (tmp)
{
FILE *f;
f = fopen(tmp, "rb"); f = fopen(file_path, "rb");
if (f) if (f)
{ {
char fname[4096], fdef[4096]; char fname[4096], fdef[4096];
@ -1280,22 +1305,14 @@ object_text_font_cache_dir_add(char *dir)
} }
fclose(f); fclose(f);
} }
free(tmp);
}
fd->dir_mod_time = evas_file_modified_time(dir); fd->dir_mod_time = _file_modified_time(dir);
tmp = evas_file_path_join(dir, "fonts.dir");
if (tmp) eina_file_path_join(file_path, PATH_MAX, dir, "fonts.dir");
{ fd->fonts_dir_mod_time = _file_modified_time(file_path);
fd->fonts_dir_mod_time = evas_file_modified_time(tmp);
free(tmp); eina_file_path_join(file_path, PATH_MAX, dir, "fonts.alias");
} fd->fonts_alias_mod_time = _file_modified_time(file_path);
tmp = evas_file_path_join(dir, "fonts.alias");
if (tmp)
{
fd->fonts_alias_mod_time = evas_file_modified_time(tmp);
free(tmp);
}
return fd; return fd;
} }
@ -1360,43 +1377,6 @@ evas_object_text_font_string_parse(char *buffer, char dest[14][256])
return n; return n;
} }
EOLIAN void
_evas_canvas_font_path_clear(Eo *eo_e EINA_UNUSED, Evas_Public_Data *evas)
{
evas_canvas_async_block(evas);
while (evas->font_path)
{
eina_stringshare_del(evas->font_path->data);
evas->font_path = eina_list_remove(evas->font_path, evas->font_path->data);
}
}
EOLIAN void
_evas_canvas_font_path_append(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
{
if (!path) return;
evas_canvas_async_block(e);
e->font_path = eina_list_append(e->font_path, eina_stringshare_add(path));
evas_font_init();
}
EOLIAN void
_evas_canvas_font_path_prepend(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
{
if (!path) return;
evas_canvas_async_block(e);
e->font_path = eina_list_prepend(e->font_path, eina_stringshare_add(path));
evas_font_init();
}
EOLIAN const Eina_List*
_evas_canvas_font_path_list(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
{
return e->font_path;
}
EAPI void EAPI void
evas_font_path_global_append(const char *path) evas_font_path_global_append(const char *path)
{ {
@ -1439,103 +1419,6 @@ evas_font_path_global_list(void)
return global_font_path; return global_font_path;
} }
void
evas_font_object_rehint(Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
if (obj->is_smart)
{
EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), obj)
evas_font_object_rehint(obj->object);
}
else
{
if (!strcmp(obj->type, "text"))
_evas_object_text_rehint(eo_obj);
if (!strcmp(obj->type, "textblock"))
_evas_object_textblock_rehint(eo_obj);
}
}
EAPI void
evas_font_hinting_set(Eo *eo_e, Evas_Font_Hinting_Flags hinting)
{
Evas_Layer *lay;
EVAS_LEGACY_API(eo_e, e);
evas_canvas_async_block(e);
if (e->hinting == hinting) return;
e->hinting = hinting;
EINA_INLIST_FOREACH(e->layers, lay)
{
Evas_Object_Protected_Data *obj;
EINA_INLIST_FOREACH(lay->objects, obj)
evas_font_object_rehint(obj->object);
}
}
EAPI Evas_Font_Hinting_Flags
evas_font_hinting_get(const Evas *eo_e)
{
EVAS_LEGACY_API(eo_e, e, EVAS_FONT_HINTING_NONE);
return e->hinting;
}
EAPI Eina_Bool
evas_font_hinting_can_hint(const Evas *eo_e, Evas_Font_Hinting_Flags hinting)
{
EVAS_LEGACY_API(eo_e, e, EINA_FALSE);
if (e->engine.func->font_hinting_can_hint && _evas_engine_context(e))
return e->engine.func->font_hinting_can_hint(_evas_engine_context(e),
hinting);
else return EINA_FALSE;
}
EOLIAN void
_evas_canvas_font_cache_flush(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
{
evas_canvas_async_block(e);
evas_render_rendering_wait(e);
if (_evas_engine_context(e))
e->engine.func->font_cache_flush(_evas_engine_context(e));
}
EOLIAN void
_evas_canvas_font_cache_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int size)
{
if (size < 0) size = 0;
evas_canvas_async_block(e);
evas_render_rendering_wait(e);
if (_evas_engine_context(e))
e->engine.func->font_cache_set(_evas_engine_context(e), size);
}
EOLIAN int
_evas_canvas_font_cache_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
{
if (_evas_engine_context(e))
return e->engine.func->font_cache_get(_evas_engine_context(e));
return -1;
}
EOLIAN Eina_List*
_evas_canvas_font_available_list(Eo *eo_e, Evas_Public_Data *_pd EINA_UNUSED)
{
return evas_font_dir_available_list(eo_e);
}
EAPI void
evas_font_available_list_free(Evas *eo_e, Eina_List *available)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
evas_font_dir_available_list_free(available);
}
EAPI void EAPI void
evas_font_reinit(void) evas_font_reinit(void)
{ {

View File

@ -384,7 +384,7 @@ next_zombie:
EINA_LIST_FREE(e->obscures, r) EINA_LIST_FREE(e->obscures, r)
eina_rectangle_free(r); eina_rectangle_free(r);
evas_fonts_zero_free(eo_e); evas_fonts_zero_free();
evas_event_callback_all_del(eo_e); evas_event_callback_all_del(eo_e);
evas_event_callback_cleanup(eo_e); evas_event_callback_cleanup(eo_e);
@ -1289,6 +1289,139 @@ _evas_pointer_list_in_rect_get(Evas_Public_Data *edata, Evas_Object *obj,
return list; return list;
} }
/* font related api */
EOLIAN static void
_evas_canvas_font_path_clear(Eo *eo_e EINA_UNUSED, Evas_Public_Data *evas)
{
evas_canvas_async_block(evas);
while (evas->font_path)
{
eina_stringshare_del(evas->font_path->data);
evas->font_path = eina_list_remove(evas->font_path, evas->font_path->data);
}
}
EOLIAN static void
_evas_canvas_font_path_append(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
{
if (!path) return;
evas_canvas_async_block(e);
e->font_path = eina_list_append(e->font_path, eina_stringshare_add(path));
}
EOLIAN static void
_evas_canvas_font_path_prepend(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
{
if (!path) return;
evas_canvas_async_block(e);
e->font_path = eina_list_prepend(e->font_path, eina_stringshare_add(path));
}
EOLIAN static const Eina_List*
_evas_canvas_font_path_list(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
{
return e->font_path;
}
EOLIAN static void
_evas_canvas_font_cache_flush(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
{
evas_canvas_async_block(e);
evas_render_rendering_wait(e);
if (_evas_engine_context(e))
e->engine.func->font_cache_flush(_evas_engine_context(e));
}
EOLIAN static void
_evas_canvas_font_cache_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int size)
{
if (size < 0) size = 0;
evas_canvas_async_block(e);
evas_render_rendering_wait(e);
if (_evas_engine_context(e))
e->engine.func->font_cache_set(_evas_engine_context(e), size);
}
EOLIAN static int
_evas_canvas_font_cache_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
{
if (_evas_engine_context(e))
return e->engine.func->font_cache_get(_evas_engine_context(e));
return -1;
}
EOLIAN static Eina_List*
_evas_canvas_font_available_list(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *pd)
{
return evas_font_dir_available_list(pd->font_path);
}
static void
evas_font_object_rehint(Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
if (obj->is_smart)
{
EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), obj)
evas_font_object_rehint(obj->object);
}
else
{
if (!strcmp(obj->type, "text"))
_evas_object_text_rehint(eo_obj);
if (!strcmp(obj->type, "textblock"))
_evas_object_textblock_rehint(eo_obj);
}
}
EAPI void
evas_font_hinting_set(Eo *eo_e, Evas_Font_Hinting_Flags hinting)
{
Evas_Layer *lay;
EVAS_LEGACY_API(eo_e, e);
evas_canvas_async_block(e);
if (e->hinting == hinting) return;
e->hinting = hinting;
EINA_INLIST_FOREACH(e->layers, lay)
{
Evas_Object_Protected_Data *obj;
EINA_INLIST_FOREACH(lay->objects, obj)
evas_font_object_rehint(obj->object);
}
}
EAPI Evas_Font_Hinting_Flags
evas_font_hinting_get(const Evas *eo_e)
{
EVAS_LEGACY_API(eo_e, e, EVAS_FONT_HINTING_NONE);
return e->hinting;
}
EAPI Eina_Bool
evas_font_hinting_can_hint(const Evas *eo_e, Evas_Font_Hinting_Flags hinting)
{
EVAS_LEGACY_API(eo_e, e, EINA_FALSE);
if (e->engine.func->font_hinting_can_hint && _evas_engine_context(e))
return e->engine.func->font_hinting_can_hint(_evas_engine_context(e),
hinting);
else return EINA_FALSE;
}
EAPI void
evas_font_available_list_free(Evas *eo_e, Eina_List *available)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return;
MAGIC_CHECK_END();
evas_font_dir_available_list_free(available);
}
/* Legacy EAPI */ /* Legacy EAPI */
EAPI Eina_Bool EAPI Eina_Bool

View File

@ -439,12 +439,15 @@ _evas_text_font_reload(Eo *eo_obj, Evas_Text_Data *o)
/* DO IT */ /* DO IT */
if (o->font) if (o->font)
{ {
evas_font_free(obj->layer->evas->evas, o->font); evas_font_free(o->font);
o->font = NULL; o->font = NULL;
} }
o->font = evas_font_load(obj->layer->evas->evas, o->cur.fdesc, o->cur.source, o->font = evas_font_load(obj->layer->evas->font_path,
(int)(((double) o->cur.size) * obj->cur->scale), o->cur.bitmap_scalable); obj->layer->evas->hinting,
o->cur.fdesc, o->cur.source,
(int)(((double) o->cur.size) * obj->cur->scale),
o->cur.bitmap_scalable);
{ {
o->ascent = 0; o->ascent = 0;
o->descent = 0; o->descent = 0;
@ -1657,7 +1660,7 @@ evas_object_text_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters); if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters);
if (o->cur.text) free(o->cur.text); if (o->cur.text) free(o->cur.text);
if (o->font && obj->layer && obj->layer->evas) if (o->font && obj->layer && obj->layer->evas)
evas_font_free(obj->layer->evas->evas, o->font); evas_font_free(o->font);
o->font = NULL; o->font = NULL;
o->cur.utf8_text = NULL; o->cur.utf8_text = NULL;
o->cur.font = NULL; o->cur.font = NULL;
@ -2241,8 +2244,7 @@ _evas_object_text_rehint(Evas_Object *eo_obj)
Eina_List *was = NULL; Eina_List *was = NULL;
if (!o->font) return; if (!o->font) return;
evas_font_load_hinting_set(obj->layer->evas->evas, o->font, evas_font_load_hinting_set(o->font, obj->layer->evas->hinting);
obj->layer->evas->hinting);
was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj, 1, 1); was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj, 1, 1);
/* DO II */ /* DO II */
_evas_object_text_recalc(eo_obj, o->cur.text); _evas_object_text_recalc(eo_obj, o->cur.text);

View File

@ -1007,7 +1007,7 @@ _format_unref_free(Evas_Object_Protected_Data *evas_o, Evas_Object_Textblock_For
fmt->gfx_filter = NULL; fmt->gfx_filter = NULL;
} }
if ((obj->layer) && (obj->layer->evas)) if ((obj->layer) && (obj->layer->evas))
evas_font_free(obj->layer->evas->evas, fmt->font.font); evas_font_free(fmt->font.font);
free(fmt); free(fmt);
} }
@ -2835,8 +2835,12 @@ _format_dup(Evas_Object *eo_obj, const Evas_Object_Textblock_Format *fmt)
if (fmt->font.source) fmt2->font.source = eina_stringshare_add(fmt->font.source); if (fmt->font.source) fmt2->font.source = eina_stringshare_add(fmt->font.source);
/* FIXME: just ref the font here... */ /* FIXME: just ref the font here... */
fmt2->font.font = evas_font_load(obj->layer->evas->evas, fmt2->font.fdesc, fmt2->font.font = evas_font_load(obj->layer->evas->font_path,
fmt2->font.source, (int)(((double) fmt2->font.size) * obj->cur->scale), fmt2->font.bitmap_scalable); obj->layer->evas->hinting,
fmt2->font.fdesc,
fmt2->font.source,
(int)(((double) fmt2->font.size) * obj->cur->scale),
fmt2->font.bitmap_scalable);
if (fmt->gfx_filter) if (fmt->gfx_filter)
{ {
@ -3392,8 +3396,12 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
fmt->font.fdesc->slant = _FMT_INFO(font_slant); fmt->font.fdesc->slant = _FMT_INFO(font_slant);
fmt->font.fdesc->width = _FMT_INFO(font_width); fmt->font.fdesc->width = _FMT_INFO(font_width);
fmt->font.fdesc->lang = _FMT_INFO(font_lang); fmt->font.fdesc->lang = _FMT_INFO(font_lang);
fmt->font.font = evas_font_load(evas_obj->layer->evas->evas, fmt->font.fdesc, fmt->font.font = evas_font_load(evas_obj->layer->evas->font_path,
fmt->font.source, (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale), fmt->font.bitmap_scalable); evas_obj->layer->evas->hinting,
fmt->font.fdesc,
fmt->font.source,
(int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale),
fmt->font.bitmap_scalable);
} }
if (_FMT_INFO(gfx_filter_name)) if (_FMT_INFO(gfx_filter_name))
{ {
@ -4538,9 +4546,13 @@ _format_finalize(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt)
of = fmt->font.font; of = fmt->font.font;
fmt->font.font = evas_font_load(obj->layer->evas->evas, fmt->font.fdesc, fmt->font.font = evas_font_load(obj->layer->evas->font_path,
fmt->font.source, (int)(((double) fmt->font.size) * obj->cur->scale), fmt->font.bitmap_scalable); obj->layer->evas->hinting,
if (of) evas_font_free(obj->layer->evas->evas, of); fmt->font.fdesc,
fmt->font.source,
(int)(((double) fmt->font.size) * obj->cur->scale),
fmt->font.bitmap_scalable);
if (of) evas_font_free(of);
} }
static Efl_Canvas_Text_Filter_Program * static Efl_Canvas_Text_Filter_Program *
@ -14597,8 +14609,7 @@ _evas_object_textblock_rehint(Evas_Object *eo_obj)
Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it); Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it);
if (ti->parent.format->font.font) if (ti->parent.format->font.font)
{ {
evas_font_load_hinting_set(obj->layer->evas->evas, evas_font_load_hinting_set(ti->parent.format->font.font,
ti->parent.format->font.font,
obj->layer->evas->hinting); obj->layer->evas->hinting);
} }
} }

View File

@ -210,7 +210,7 @@ evas_object_textgrid_rows_clear(Evas_Object *eo_obj)
} }
static void static void
evas_object_textgrid_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) evas_object_textgrid_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj EINA_UNUSED)
{ {
Evas_Object_Textgrid_Color *c; Evas_Object_Textgrid_Color *c;
Evas_Textgrid_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); Evas_Textgrid_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
@ -223,10 +223,10 @@ evas_object_textgrid_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
if (o->cur.font_description_normal) if (o->cur.font_description_normal)
evas_font_desc_unref(o->cur.font_description_normal); evas_font_desc_unref(o->cur.font_description_normal);
if (o->font_normal) evas_font_free(obj->layer->evas->evas, o->font_normal); if (o->font_normal) evas_font_free(o->font_normal);
if (o->font_bold) evas_font_free(obj->layer->evas->evas, o->font_bold); if (o->font_bold) evas_font_free(o->font_bold);
if (o->font_italic) evas_font_free(obj->layer->evas->evas, o->font_italic); if (o->font_italic) evas_font_free(o->font_italic);
if (o->font_bolditalic) evas_font_free(obj->layer->evas->evas, o->font_bolditalic); if (o->font_bolditalic) evas_font_free(o->font_bolditalic);
if (o->cur.cells) free(o->cur.cells); if (o->cur.cells) free(o->cur.cells);
while ((c = eina_array_pop(&o->cur.palette_standard))) while ((c = eina_array_pop(&o->cur.palette_standard)))
@ -1003,7 +1003,8 @@ _alternate_font_weight_slant(Evas_Object_Protected_Data *obj,
int ret = -1; int ret = -1;
Evas_Font_Set *font; Evas_Font_Set *font;
font = evas_font_load(obj->layer->evas->evas, font = evas_font_load(obj->layer->evas->font_path,
obj->layer->evas->hinting,
fdesc, fdesc,
o->cur.font_source, o->cur.font_source,
(int)(((double) o->cur.font_size) * (int)(((double) o->cur.font_size) *
@ -1040,7 +1041,7 @@ _alternate_font_weight_slant(Evas_Object_Protected_Data *obj,
(o->cur.char_height != vadvance) || (o->cur.char_height != vadvance) ||
(o->ascent != ascent)) (o->ascent != ascent))
{ {
evas_font_free(obj->layer->evas->evas, font); evas_font_free(font);
} }
else else
{ {
@ -1080,11 +1081,12 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
if (o->font_normal) if (o->font_normal)
{ {
evas_font_free(obj->layer->evas->evas, o->font_normal); evas_font_free(o->font_normal);
o->font_normal = NULL; o->font_normal = NULL;
} }
o->font_normal = evas_font_load(obj->layer->evas->evas, o->font_normal = evas_font_load(obj->layer->evas->font_path,
obj->layer->evas->hinting,
o->cur.font_description_normal, o->cur.font_description_normal,
o->cur.font_source, o->cur.font_source,
(int)(((double) o->cur.font_size) * (int)(((double) o->cur.font_size) *
@ -1133,7 +1135,7 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
/* Bold */ /* Bold */
if (o->font_bold) if (o->font_bold)
{ {
evas_font_free(obj->layer->evas->evas, o->font_bold); evas_font_free(o->font_bold);
o->font_bold = NULL; o->font_bold = NULL;
} }
if ((fdesc->weight == EVAS_FONT_WEIGHT_NORMAL) || if ((fdesc->weight == EVAS_FONT_WEIGHT_NORMAL) ||
@ -1153,7 +1155,7 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
/* Italic */ /* Italic */
if (o->font_italic) if (o->font_italic)
{ {
evas_font_free(obj->layer->evas->evas, o->font_italic); evas_font_free(o->font_italic);
o->font_italic = NULL; o->font_italic = NULL;
} }
if (fdesc->slant == EVAS_FONT_SLANT_NORMAL) if (fdesc->slant == EVAS_FONT_SLANT_NORMAL)
@ -1180,7 +1182,7 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
/* BoldItalic */ /* BoldItalic */
if (o->font_bolditalic) if (o->font_bolditalic)
{ {
evas_font_free(obj->layer->evas->evas, o->font_bolditalic); evas_font_free(o->font_bolditalic);
o->font_bolditalic = NULL; o->font_bolditalic = NULL;
} }
if (fdesc->slant == EVAS_FONT_SLANT_NORMAL && if (fdesc->slant == EVAS_FONT_SLANT_NORMAL &&

View File

@ -4001,7 +4001,7 @@ _evas_canvas_render_idle_flush(Eo *eo_e, Evas_Public_Data *evas)
evas_render_rendering_wait(evas); evas_render_rendering_wait(evas);
evas_fonts_zero_pressure(eo_e); evas_fonts_zero_pressure();
if (ENFN && ENFN->output_idle_flush) if (ENFN && ENFN->output_idle_flush)
{ {
@ -4125,7 +4125,7 @@ _evas_canvas_render_dump(Eo *eo_e, Evas_Public_Data *evas)
GC_ALL(evas_object_image_load_opts_cow); GC_ALL(evas_object_image_load_opts_cow);
GC_ALL(evas_object_image_state_cow); GC_ALL(evas_object_image_state_cow);
evas_fonts_zero_pressure(eo_e); evas_fonts_zero_pressure();
if (ENFN && ENFN->output_idle_flush) if (ENFN && ENFN->output_idle_flush)
{ {

View File

@ -433,7 +433,7 @@ _evas_render2_idle_flush(Eo *eo_e)
// wait for rendering to finish so we don't mess up shared resources // wait for rendering to finish so we don't mess up shared resources
_evas_render2_wait(eo_e); _evas_render2_wait(eo_e);
// clean fonts // clean fonts
evas_fonts_zero_pressure(eo_e); evas_fonts_zero_pressure();
// call engine idle flush call // call engine idle flush call
if ((e->engine.func) && (e->engine.func->output_idle_flush) && if ((e->engine.func) && (e->engine.func->output_idle_flush) &&
(e->engine.data.output)) (e->engine.data.output))

View File

@ -1,9 +1,329 @@
#ifndef _EVAS_FONT_H #ifndef _EVAS_FONT_H
#define _EVAS_FONT_H #define _EVAS_FONT_H
typedef unsigned char DATA8;
typedef unsigned long long DATA64;
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_SIZES_H
#include FT_MODULE_H
#ifndef FT_HAS_COLOR
# define FT_HAS_COLOR(face) 0
#endif
#ifndef FT_LOAD_COLOR
# define FT_LOAD_COLOR FT_LOAD_DEFAULT
#endif
#ifdef EAPI
# undef EAPI
#endif
#ifdef _WIN32
# ifdef EFL_EVAS_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif /* ! DLL_EXPORT */
# else
# define EAPI __declspec(dllimport)
# endif /* ! EFL_EVAS_BUILD */
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
#endif /* ! _WIN32 */
#include <Eina.h>
#define LK(x) Eina_Lock x
#define LKU(x) eina_lock_release(&(x))
#define LKL(x) eina_lock_take(&(x))
#define LKD(x) eina_lock_free(&(x))
#include "evas_text_utils.h" #include "evas_text_utils.h"
enum _Evas_Font_Style
{
EVAS_FONT_STYLE_SLANT,
EVAS_FONT_STYLE_WEIGHT,
EVAS_FONT_STYLE_WIDTH
};
enum _Evas_Font_Slant
{
EVAS_FONT_SLANT_NORMAL,
EVAS_FONT_SLANT_OBLIQUE,
EVAS_FONT_SLANT_ITALIC
};
enum _Evas_Font_Weight
{
EVAS_FONT_WEIGHT_NORMAL,
EVAS_FONT_WEIGHT_THIN,
EVAS_FONT_WEIGHT_ULTRALIGHT,
EVAS_FONT_WEIGHT_EXTRALIGHT,
EVAS_FONT_WEIGHT_LIGHT,
EVAS_FONT_WEIGHT_BOOK,
EVAS_FONT_WEIGHT_MEDIUM,
EVAS_FONT_WEIGHT_SEMIBOLD,
EVAS_FONT_WEIGHT_BOLD,
EVAS_FONT_WEIGHT_ULTRABOLD,
EVAS_FONT_WEIGHT_EXTRABOLD,
EVAS_FONT_WEIGHT_BLACK,
EVAS_FONT_WEIGHT_EXTRABLACK
};
enum _Evas_Font_Width
{
EVAS_FONT_WIDTH_NORMAL,
EVAS_FONT_WIDTH_ULTRACONDENSED,
EVAS_FONT_WIDTH_EXTRACONDENSED,
EVAS_FONT_WIDTH_CONDENSED,
EVAS_FONT_WIDTH_SEMICONDENSED,
EVAS_FONT_WIDTH_SEMIEXPANDED,
EVAS_FONT_WIDTH_EXPANDED,
EVAS_FONT_WIDTH_EXTRAEXPANDED,
EVAS_FONT_WIDTH_ULTRAEXPANDED
};
enum _Evas_Font_Spacing
{
EVAS_FONT_SPACING_PROPORTIONAL,
EVAS_FONT_SPACING_DUAL,
EVAS_FONT_SPACING_MONO,
EVAS_FONT_SPACING_CHARCELL
};
typedef enum _Evas_Font_Style Evas_Font_Style;
typedef enum _Evas_Font_Slant Evas_Font_Slant;
typedef enum _Evas_Font_Weight Evas_Font_Weight;
typedef enum _Evas_Font_Width Evas_Font_Width;
typedef enum _Evas_Font_Spacing Evas_Font_Spacing;
typedef struct _Evas_Font_Dir Evas_Font_Dir;
typedef struct _Evas_Font Evas_Font;
typedef struct _Evas_Font_Alias Evas_Font_Alias;
typedef struct _Evas_Font_Description Evas_Font_Description;
typedef struct _RGBA_Font RGBA_Font;
typedef struct _RGBA_Font_Int RGBA_Font_Int;
typedef struct _RGBA_Font_Source RGBA_Font_Source;
typedef struct _RGBA_Font_Glyph RGBA_Font_Glyph;
typedef struct _RGBA_Font_Glyph_Out RGBA_Font_Glyph_Out;
typedef struct _Fash_Item_Index_Map Fash_Item_Index_Map;
typedef struct _Fash_Int_Map Fash_Int_Map;
typedef struct _Fash_Int_Map2 Fash_Int_Map2;
typedef struct _Fash_Int Fash_Int;
struct _Fash_Item_Index_Map
{
RGBA_Font_Int *fint;
int index;
};
struct _Fash_Int_Map
{
Fash_Item_Index_Map item[256];
};
struct _Fash_Int_Map2
{
Fash_Int_Map *bucket[256];
};
struct _Fash_Int
{
Fash_Int_Map2 *bucket[256];
void (*freeme) (Fash_Int *fash);
};
typedef struct _Fash_Glyph_Map Fash_Glyph_Map;
typedef struct _Fash_Glyph_Map2 Fash_Glyph_Map2;
typedef struct _Fash_Glyph Fash_Glyph;
struct _Fash_Glyph_Map
{
RGBA_Font_Glyph *item[256];
};
struct _Fash_Glyph_Map2
{
Fash_Glyph_Map *bucket[256];
};
struct _Fash_Glyph
{
Fash_Glyph_Map2 *bucket[256];
void (*freeme) (Fash_Glyph *fash);
};
typedef enum _Font_Hint_Flags
{
FONT_NO_HINT,
FONT_AUTO_HINT,
FONT_BYTECODE_HINT
} Font_Hint_Flags;
typedef enum _Font_Rend_Flags
{
FONT_REND_REGULAR = 0,
FONT_REND_SLANT = (1 << 0),
FONT_REND_WEIGHT = (1 << 1),
} Font_Rend_Flags;
struct _RGBA_Font
{
Eina_List *fonts;
Fash_Int *fash;
Font_Hint_Flags hinting;
int references;
LK(lock);
unsigned char sizeok : 1;
};
struct _Evas_Font_Dir
{
Eina_Hash *lookup;
Eina_List *fonts;
Eina_List *aliases;
DATA64 dir_mod_time;
DATA64 fonts_dir_mod_time;
DATA64 fonts_alias_mod_time;
};
struct _Evas_Font
{
struct {
const char *prop[14];
} x;
struct {
const char *name;
} simple;
const char *path;
char type;
};
struct _Evas_Font_Alias
{
const char *alias;
Evas_Font *fn;
};
struct _Evas_Font_Description
{
int ref;
Eina_Stringshare *name;
Eina_Stringshare *fallbacks;
Eina_Stringshare *lang;
Eina_Stringshare *style;
Evas_Font_Slant slant;
Evas_Font_Weight weight;
Evas_Font_Width width;
Evas_Font_Spacing spacing;
Eina_Bool is_new : 1;
};
struct _RGBA_Font_Int
{
EINA_INLIST;
RGBA_Font_Source *src;
Eina_Hash *kerning;
Fash_Glyph *fash;
unsigned int size;
float scale_factor;
int real_size;
int max_h;
int references;
int usage;
struct {
FT_Size size;
#ifdef USE_HARFBUZZ
void *hb_font;
#endif
} ft;
LK(ft_mutex);
Font_Hint_Flags hinting;
Font_Rend_Flags wanted_rend; /* The wanted rendering style */
Font_Rend_Flags runtime_rend; /* The rendering we need to do on runtime
in order to comply with the wanted_rend. */
Eina_List *task;
#ifdef EVAS_CSERVE2
void *cs2_handler;
#endif
int generation;
Efl_Text_Font_Bitmap_Scalable bitmap_scalable;
unsigned char sizeok : 1;
unsigned char inuse : 1;
};
struct _RGBA_Font_Source
{
const char *name;
const char *file;
void *data;
unsigned int current_size;
int data_size;
int references;
struct {
int orig_upem;
FT_Face face;
} ft;
};
/*
* laziness wins for now. The parts used from the freetpye struct are
* kept intact to avoid changing the code using it until we know exactly
* what needs to be changed
*/
struct _RGBA_Font_Glyph_Out
{
unsigned char *rle;
struct {
unsigned char *buffer;
unsigned short rows;
unsigned short width;
unsigned short pitch;
unsigned short rle_alloc : 1;
unsigned short no_free_glout : 1;
} bitmap;
int rle_size;
};
struct _RGBA_Font_Glyph
{
FT_UInt index;
Evas_Coord width;
Evas_Coord x_bear;
Evas_Coord y_bear;
FT_Glyph glyph;
RGBA_Font_Glyph_Out *glyph_out;
/* this is a problem - only 1 engine at a time can extend such a font... grrr */
void *ext_dat;
void (*ext_dat_free) (void *ext_dat);
RGBA_Font_Int *fi;
};
/* The tangent of the slant angle we do on runtime. */ /* The tangent of the slant angle we do on runtime. */
#define _EVAS_FONT_SLANT_TAN 0.221694663 #define _EVAS_FONT_SLANT_TAN 0.221694663
/* main */ /* main */
EAPI void evas_common_font_init (void); EAPI void evas_common_font_init (void);
@ -23,20 +343,9 @@ EAPI int evas_common_font_instance_underline_thickness_get (R
EAPI int evas_common_font_get_line_advance (RGBA_Font *fn); EAPI int evas_common_font_get_line_advance (RGBA_Font *fn);
void *evas_common_font_freetype_face_get(RGBA_Font *font); /* XXX: Not EAPI on purpose. Not ment to be used in modules. */ void *evas_common_font_freetype_face_get(RGBA_Font *font); /* XXX: Not EAPI on purpose. Not ment to be used in modules. */
/* draw */
typedef Eina_Bool (*Evas_Common_Font_Draw_Cb)(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h);
EAPI Eina_Bool evas_common_font_draw_cb (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, Evas_Common_Font_Draw_Cb cb);
EAPI void evas_common_font_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs);
EAPI Eina_Bool evas_common_font_rgba_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h);
EAPI int evas_common_font_glyph_search (RGBA_Font *fn, RGBA_Font_Int **fi_ret, Eina_Unicode gl);
EAPI RGBA_Font_Glyph *evas_common_font_int_cache_glyph_get (RGBA_Font_Int *fi, FT_UInt index); EAPI RGBA_Font_Glyph *evas_common_font_int_cache_glyph_get (RGBA_Font_Int *fi, FT_UInt index);
EAPI Eina_Bool evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *fg); EAPI Eina_Bool evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *fg);
EAPI FT_UInt evas_common_get_char_index (RGBA_Font_Int* fi, Eina_Unicode gl); EAPI FT_UInt evas_common_get_char_index (RGBA_Font_Int* fi, Eina_Unicode gl);
EAPI void evas_common_font_draw_init (void);
EAPI void evas_common_font_draw_prepare (Evas_Text_Props *text_props);
EAPI void evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Gfx_Func func, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props);
EAPI Eina_Bool evas_common_font_draw_prepare_cutout(Cutout_Rects **reuse, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Gfx_Func *func);
/* load */ /* load */
EAPI void evas_common_font_dpi_set (int dpi_h, int dpi_v); EAPI void evas_common_font_dpi_set (int dpi_h, int dpi_v);
@ -85,10 +394,31 @@ EAPI int evas_common_font_query_run_font_end_get(RGBA_Font *fn, RG
EAPI void evas_common_font_ascent_descent_get(RGBA_Font *fn, const Evas_Text_Props *text_props, int *ascent, int *descent); EAPI void evas_common_font_ascent_descent_get(RGBA_Font *fn, const Evas_Text_Props *text_props, int *ascent, int *descent);
EAPI void *evas_common_font_glyph_compress(void *data, int num_grays, int pixel_mode, int pitch_data, int w, int h, int *size_ret); EAPI void *evas_common_font_glyph_compress(void *data, int num_grays, int pixel_mode, int pitch_data, int w, int h, int *size_ret);
EAPI void evas_common_font_glyph_draw(RGBA_Font_Glyph *fg, RGBA_Draw_Context *dc, RGBA_Image *dst, int dst_pitch, int dx, int dy, int dw, int dh, int cx, int cy, int cw, int ch);
EAPI DATA8 *evas_common_font_glyph_uncompress(RGBA_Font_Glyph *fg, int *wret, int *hret); EAPI DATA8 *evas_common_font_glyph_uncompress(RGBA_Font_Glyph *fg, int *wret, int *hret);
EAPI int evas_common_font_glyph_search (RGBA_Font *fn, RGBA_Font_Int **fi_ret, Eina_Unicode gl);
void evas_common_font_load_init(void); void evas_common_font_load_init(void);
void evas_common_font_load_shutdown(void); void evas_common_font_load_shutdown(void);
void evas_font_dir_cache_free(void);
const char *evas_font_dir_cache_find(char *dir, char *font);
Eina_List *evas_font_dir_available_list(const Eina_List *font_paths);
void evas_font_dir_available_list_free(Eina_List *available);
void evas_font_free(void *font);
void evas_fonts_zero_free();
void evas_fonts_zero_pressure();
void evas_font_name_parse(Evas_Font_Description *fdesc, const char *name);
int evas_font_style_find(const char *start, const char *end, Evas_Font_Style style);
Evas_Font_Description *evas_font_desc_new(void);
Evas_Font_Description *evas_font_desc_dup(const Evas_Font_Description *fdesc);
void evas_font_desc_unref(Evas_Font_Description *fdesc);
int evas_font_desc_cmp(const Evas_Font_Description *a, const Evas_Font_Description *b);
Evas_Font_Description *evas_font_desc_ref(Evas_Font_Description *fdesc);
const char *evas_font_lang_normalize(const char *lang);
void * evas_font_load(const Eina_List *font_paths, int hinting, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size, Efl_Text_Font_Bitmap_Scalable bitmap_scalable);
void evas_font_load_hinting_set(void *font, int hinting);
#undef EAPI
#define EAPI
#endif /* _EVAS_FONT_H */ #endif /* _EVAS_FONT_H */

View File

@ -1,23 +1,9 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include "evas_common_private.h"
#include "evas_private.h"
#include "evas_font_private.h" #include "evas_font_private.h"
#include "evas_blend_private.h"
#include "draw.h"
#ifdef EVAS_CSERVE2 #ifdef EVAS_CSERVE2
# include "../cserve2/evas_cs2_private.h" # include "../cserve2/evas_cs2_private.h"
#endif #endif
#include FT_OUTLINE_H
#include FT_SYNTHESIS_H
// XXX: // XXX:
// XXX: adapt cserve2 to this! // XXX: adapt cserve2 to this!
// XXX: // XXX:
@ -475,154 +461,3 @@ evas_common_font_glyph_uncompress(RGBA_Font_Glyph *fg, int *wret, int *hret)
fgo->bitmap.width, fgo->bitmap.rows); fgo->bitmap.width, fgo->bitmap.rows);
return buf; return buf;
} }
// this draws a compressed font glyph and decompresses on the fly as it
// draws, saving memory bandwidth and providing speedups
EAPI void
evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
RGBA_Draw_Context *dc,
RGBA_Image *dst_image, int dst_pitch,
int dx, int dy, int dw, int dh, int cx, int cy, int cw, int ch)
{
RGBA_Font_Glyph_Out *fgo = fg->glyph_out;
int x, y, w, h, x1, x2, y1, y2, i, *iptr;
DATA32 *dst = dst_image->image.data;
DATA32 coltab[16], col;
DATA16 mtab[16], v;
// FIXME: Use dw, dh for scaling glyphs...
(void) dw;
(void) dh;
x = dx;
y = dy;
w = fgo->bitmap.width; h = fgo->bitmap.rows;
// skip if totally clipped out
if ((y >= (cy + ch)) || ((y + h) <= cy) ||
(x >= (cx + cw)) || ((x + w) <= cx)) return;
// figure y1/y2 limit range
y1 = 0; y2 = h;
if ((y + y1) < cy) y1 = cy - y;
if ((y + y2) > (cy + ch)) y2 = cy + ch - y;
// figure x1/x2 limit range
x1 = 0; x2 = w;
if ((x + x1) < cx) x1 = cx - x;
if ((x + x2) > (cx + cw)) x2 = cx + cw - x;
col = dc->col.col;
if (dst_image->cache_entry.space == EVAS_COLORSPACE_GRY8)
{
// FIXME: Font draw not optimized for Alpha targets! SLOW!
// This is not pretty :)
DATA8 *src8, *dst8;
Draw_Func_Alpha func;
int row;
if (EINA_UNLIKELY(x < 0))
{
x1 += (-x);
x = 0;
if ((x2 - x1) <= 0) return;
}
if (EINA_UNLIKELY(y < 0))
{
y1 += (-y);
y = 0;
if ((y2 - y1) <= 0) return;
}
dst8 = dst_image->image.data8 + x + (y * dst_pitch);
func = efl_draw_alpha_func_get(dc->render_op, EINA_FALSE);
src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
if (!src8) return;
for (row = y1; row < y2; row++)
{
DATA8 *d = dst8 + ((row - y1) * dst_pitch);
DATA8 *s = src8 + (row * w) + x1;
func(d, s, x2 - x1);
}
free(src8);
}
else if (dc->clip.mask)
{
RGBA_Gfx_Func func;
DATA8 *src8, *mask;
DATA32 *buf, *ptr, *buf_ptr;
RGBA_Image *im = dc->clip.mask;
int row;
buf = alloca(sizeof(DATA32) * w * h);
// Adjust clipping info
if (EINA_UNLIKELY((x + x1) < dc->clip.mask_x))
x1 = dc->clip.mask_x - x;
if (EINA_UNLIKELY((y + y1) < dc->clip.mask_y))
y1 = dc->clip.mask_y - y;
if (EINA_UNLIKELY((x + x2) > (int)(x + x1 + im->cache_entry.w)))
x2 = x1 + im->cache_entry.w;
if (EINA_UNLIKELY((y + y2) > (int)(y + y1 + im->cache_entry.h)))
y2 = y1 + im->cache_entry.h;
// Step 1: alpha glyph drawing
src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
if (!src8) return;
// Step 2: color blending to buffer
func = evas_common_gfx_func_composite_mask_color_span_get(col, dst_image->cache_entry.flags.alpha, 1, EVAS_RENDER_COPY);
for (row = y1; row < y2; row++)
{
buf_ptr = buf + (row * w) + x1;
DATA8 *s = src8 + (row * w) + x1;
func(NULL, s, col, buf_ptr, x2 - x1);
}
free(src8);
// Step 3: masking to destination
func = evas_common_gfx_func_composite_pixel_mask_span_get(im->cache_entry.flags.alpha, im->cache_entry.flags.alpha_sparse, dst_image->cache_entry.flags.alpha, dst_pitch, dc->render_op);
for (row = y1; row < y2; row++)
{
mask = im->image.data8
+ (y + row - dc->clip.mask_y) * im->cache_entry.w
+ (x + x1 - dc->clip.mask_x);
ptr = dst + (x + x1) + ((y + row) * dst_pitch);
buf_ptr = buf + (row * w) + x1;
func(buf_ptr, mask, 0, ptr, w);
}
}
else
{
// build fast multiply + mask color tables to avoid compute. this works
// because of our very limited 4bit range of alpha values
for (i = 0; i <= 0xf; i++)
{
v = (i << 4) | i;
coltab[i] = MUL_SYM(v, col);
mtab[i] = 256 - (coltab[i] >> 24);
}
#ifdef BUILD_MMX
if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
{
#define MMX 1
#include "evas_font_compress_draw.c"
#undef MMX
}
else
#endif
#ifdef BUILD_NEON
if (evas_common_cpu_has_feature(CPU_FEATURE_NEON))
{
#define NEON 1
#include "evas_font_compress_draw.c"
#undef NEON
}
else
#endif
// Plain C
{
#include "evas_font_compress_draw.c"
}
}
}

View File

@ -1,4 +1,4 @@
#include "evas_common_private.h" #include "evas_font_draw.h"
#include "evas_private.h" #include "evas_private.h"
#include "evas_blend_private.h" #include "evas_blend_private.h"
@ -6,6 +6,7 @@
#include "evas_font_private.h" /* for Frame-Queuing support */ #include "evas_font_private.h" /* for Frame-Queuing support */
#include "evas_font_ot.h" #include "evas_font_ot.h"
#include "draw.h"
#ifdef EVAS_CSERVE2 #ifdef EVAS_CSERVE2
#include "../cserve2/evas_cs2_private.h" #include "../cserve2/evas_cs2_private.h"
@ -507,3 +508,154 @@ evas_common_font_draw_prepare_cutout(Cutout_Rects **reuse, RGBA_Image *dst, RGBA
return EINA_TRUE; return EINA_TRUE;
} }
// this draws a compressed font glyph and decompresses on the fly as it
// draws, saving memory bandwidth and providing speedups
EAPI void
evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
RGBA_Draw_Context *dc,
RGBA_Image *dst_image, int dst_pitch,
int dx, int dy, int dw, int dh, int cx, int cy, int cw, int ch)
{
RGBA_Font_Glyph_Out *fgo = fg->glyph_out;
int x, y, w, h, x1, x2, y1, y2, i, *iptr;
DATA32 *dst = dst_image->image.data;
DATA32 coltab[16], col;
DATA16 mtab[16], v;
// FIXME: Use dw, dh for scaling glyphs...
(void) dw;
(void) dh;
x = dx;
y = dy;
w = fgo->bitmap.width; h = fgo->bitmap.rows;
// skip if totally clipped out
if ((y >= (cy + ch)) || ((y + h) <= cy) ||
(x >= (cx + cw)) || ((x + w) <= cx)) return;
// figure y1/y2 limit range
y1 = 0; y2 = h;
if ((y + y1) < cy) y1 = cy - y;
if ((y + y2) > (cy + ch)) y2 = cy + ch - y;
// figure x1/x2 limit range
x1 = 0; x2 = w;
if ((x + x1) < cx) x1 = cx - x;
if ((x + x2) > (cx + cw)) x2 = cx + cw - x;
col = dc->col.col;
if (dst_image->cache_entry.space == EVAS_COLORSPACE_GRY8)
{
// FIXME: Font draw not optimized for Alpha targets! SLOW!
// This is not pretty :)
DATA8 *src8, *dst8;
Draw_Func_Alpha func;
int row;
if (EINA_UNLIKELY(x < 0))
{
x1 += (-x);
x = 0;
if ((x2 - x1) <= 0) return;
}
if (EINA_UNLIKELY(y < 0))
{
y1 += (-y);
y = 0;
if ((y2 - y1) <= 0) return;
}
dst8 = dst_image->image.data8 + x + (y * dst_pitch);
func = efl_draw_alpha_func_get(dc->render_op, EINA_FALSE);
src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
if (!src8) return;
for (row = y1; row < y2; row++)
{
DATA8 *d = dst8 + ((row - y1) * dst_pitch);
DATA8 *s = src8 + (row * w) + x1;
func(d, s, x2 - x1);
}
free(src8);
}
else if (dc->clip.mask)
{
RGBA_Gfx_Func func;
DATA8 *src8, *mask;
DATA32 *buf, *ptr, *buf_ptr;
RGBA_Image *im = dc->clip.mask;
int row;
buf = alloca(sizeof(DATA32) * w * h);
// Adjust clipping info
if (EINA_UNLIKELY((x + x1) < dc->clip.mask_x))
x1 = dc->clip.mask_x - x;
if (EINA_UNLIKELY((y + y1) < dc->clip.mask_y))
y1 = dc->clip.mask_y - y;
if (EINA_UNLIKELY((x + x2) > (int)(x + x1 + im->cache_entry.w)))
x2 = x1 + im->cache_entry.w;
if (EINA_UNLIKELY((y + y2) > (int)(y + y1 + im->cache_entry.h)))
y2 = y1 + im->cache_entry.h;
// Step 1: alpha glyph drawing
src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
if (!src8) return;
// Step 2: color blending to buffer
func = evas_common_gfx_func_composite_mask_color_span_get(col, dst_image->cache_entry.flags.alpha, 1, EVAS_RENDER_COPY);
for (row = y1; row < y2; row++)
{
buf_ptr = buf + (row * w) + x1;
DATA8 *s = src8 + (row * w) + x1;
func(NULL, s, col, buf_ptr, x2 - x1);
}
free(src8);
// Step 3: masking to destination
func = evas_common_gfx_func_composite_pixel_mask_span_get(im->cache_entry.flags.alpha, im->cache_entry.flags.alpha_sparse, dst_image->cache_entry.flags.alpha, dst_pitch, dc->render_op);
for (row = y1; row < y2; row++)
{
mask = im->image.data8
+ (y + row - dc->clip.mask_y) * im->cache_entry.w
+ (x + x1 - dc->clip.mask_x);
ptr = dst + (x + x1) + ((y + row) * dst_pitch);
buf_ptr = buf + (row * w) + x1;
func(buf_ptr, mask, 0, ptr, w);
}
}
else
{
// build fast multiply + mask color tables to avoid compute. this works
// because of our very limited 4bit range of alpha values
for (i = 0; i <= 0xf; i++)
{
v = (i << 4) | i;
coltab[i] = MUL_SYM(v, col);
mtab[i] = 256 - (coltab[i] >> 24);
}
#ifdef BUILD_MMX
if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
{
#define MMX 1
#include "evas_font_compress_draw.c"
#undef MMX
}
else
#endif
#ifdef BUILD_NEON
if (evas_common_cpu_has_feature(CPU_FEATURE_NEON))
{
#define NEON 1
#include "evas_font_compress_draw.c"
#undef NEON
}
else
#endif
// Plain C
{
#include "evas_font_compress_draw.c"
}
}
}

View File

@ -0,0 +1,18 @@
#ifndef _EVAS_FONT_DRAW_H
#define _EVAS_FONT_DRAW_
#include "evas_common_private.h"
/* draw */
typedef Eina_Bool (*Evas_Common_Font_Draw_Cb)(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h);
EAPI Eina_Bool evas_common_font_draw_cb (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, Evas_Common_Font_Draw_Cb cb);
EAPI void evas_common_font_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs);
EAPI Eina_Bool evas_common_font_rgba_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h);
EAPI void evas_common_font_draw_init (void);
EAPI void evas_common_font_draw_prepare (Evas_Text_Props *text_props);
EAPI void evas_common_font_draw_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Gfx_Func func, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props);
EAPI Eina_Bool evas_common_font_draw_prepare_cutout (Cutout_Rects **reuse, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Gfx_Func *func);
EAPI void evas_common_font_glyph_draw (RGBA_Font_Glyph *fg, RGBA_Draw_Context *dc, RGBA_Image *dst, int dst_pitch, int dx, int dy, int dw, int dh, int cx, int cy, int cw, int ch);
#endif /* _EVAS_FONT_DRAW_H */

View File

@ -3,9 +3,7 @@
#endif #endif
#include <assert.h> #include <assert.h>
#include "evas_font_ot.h"
#include "evas_common_private.h"
#include "evas_private.h"
#ifdef USE_HARFBUZZ #ifdef USE_HARFBUZZ
# include <hb.h> # include <hb.h>
@ -336,19 +334,17 @@ EAPI RGBA_Font_Int *
evas_common_font_int_memory_load(const char *source, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend, Efl_Text_Font_Bitmap_Scalable bitmap_scalable) evas_common_font_int_memory_load(const char *source, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend, Efl_Text_Font_Bitmap_Scalable bitmap_scalable)
{ {
RGBA_Font_Int *fi; RGBA_Font_Int *fi;
char *fake_name; char fake_name[PATH_MAX];
fake_name = evas_file_path_join(source, name); eina_file_path_join(fake_name, sizeof(fake_name), source, name);
fi = evas_common_font_int_find(fake_name, size, wanted_rend, bitmap_scalable); fi = evas_common_font_int_find(fake_name, size, wanted_rend, bitmap_scalable);
if (fi) if (fi)
{ {
free(fake_name);
return fi; return fi;
} }
fi = calloc(1, sizeof(RGBA_Font_Int)); fi = calloc(1, sizeof(RGBA_Font_Int));
if (!fi) if (!fi)
{ {
free(fake_name);
return NULL; return NULL;
} }
fi->src = evas_common_font_source_find(fake_name); fi->src = evas_common_font_source_find(fake_name);
@ -357,7 +353,6 @@ evas_common_font_int_memory_load(const char *source, const char *name, int size,
if (!fi->src) if (!fi->src)
{ {
free(fi); free(fi);
free(fake_name);
return NULL; return NULL;
} }
fi->size = size; fi->size = size;
@ -380,10 +375,19 @@ evas_common_font_int_memory_load(const char *source, const char *name, int size,
} }
} }
#endif #endif
free(fake_name);
return fi; return fi;
} }
static int
_file_path_is_file_helper(const char *path)
{
struct stat st;
if (stat(path, &st) == -1) return 0;
if (S_ISREG(st.st_mode)) return 1;
return 0;
}
EAPI RGBA_Font_Int * EAPI RGBA_Font_Int *
evas_common_font_int_load(const char *name, int size, evas_common_font_int_load(const char *name, int size,
Font_Rend_Flags wanted_rend, Font_Rend_Flags wanted_rend,
@ -396,7 +400,7 @@ evas_common_font_int_load(const char *name, int size,
fi = calloc(1, sizeof(RGBA_Font_Int)); fi = calloc(1, sizeof(RGBA_Font_Int));
if (!fi) return NULL; if (!fi) return NULL;
fi->src = evas_common_font_source_find(name); fi->src = evas_common_font_source_find(name);
if (!fi->src && evas_file_path_is_file(name)) if (!fi->src && _file_path_is_file_helper(name))
fi->src = evas_common_font_source_load(name); fi->src = evas_common_font_source_load(name);
if (!fi->src) if (!fi->src)

View File

@ -1,12 +1,3 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include "evas_common_private.h"
#include "evas_private.h"
#include "evas_font_private.h" #include "evas_font_private.h"
#ifdef EVAS_CSERVE2 #ifdef EVAS_CSERVE2
@ -25,6 +16,8 @@ LK(lock_font_draw); // for freetype2 API calls
LK(lock_bidi); // for evas bidi internal usage. LK(lock_bidi); // for evas bidi internal usage.
LK(lock_ot); // for evas bidi internal usage. LK(lock_ot); // for evas bidi internal usage.
int _evas_font_log_dom_global = -1;
EAPI void EAPI void
evas_common_font_init(void) evas_common_font_init(void)
{ {
@ -36,6 +29,12 @@ evas_common_font_init(void)
#else #else
35; 35;
#endif #endif
_evas_font_log_dom_global = eina_log_domain_register
("evas_font_main", EVAS_FONT_DEFAULT_LOG_COLOR);
if (_evas_font_log_dom_global < 0)
{
EINA_LOG_ERR("Can not create a module log domain.");
}
initialised++; initialised++;
if (initialised != 1) return; if (initialised != 1) return;
@ -77,6 +76,7 @@ evas_common_font_shutdown(void)
LKD(lock_font_draw); LKD(lock_font_draw);
LKD(lock_bidi); LKD(lock_bidi);
LKD(lock_ot); LKD(lock_ot);
eina_log_domain_unregister(_evas_font_log_dom_global);
} }
EAPI void EAPI void

View File

@ -1,12 +1,10 @@
#include "evas_common_private.h" #include "evas_font_private.h"
#ifdef USE_HARFBUZZ #ifdef USE_HARFBUZZ
# include <hb.h> # include <hb.h>
# include <hb-ft.h> # include <hb-ft.h>
#endif #endif
#include "evas_font_private.h"
#ifdef USE_HARFBUZZ #ifdef USE_HARFBUZZ
static const hb_script_t static const hb_script_t
_evas_script_to_harfbuzz[] = _evas_script_to_harfbuzz[] =

View File

@ -1,6 +1,10 @@
#ifndef _EVAS_FONT_OT_H #ifndef _EVAS_FONT_OT_H
# define _EVAS_FONT_OT_H # define _EVAS_FONT_OT_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
# ifdef HAVE_HARFBUZZ # ifdef HAVE_HARFBUZZ
# define OT_SUPPORT # define OT_SUPPORT
# define USE_HARFBUZZ # define USE_HARFBUZZ
@ -17,8 +21,8 @@ typedef void *Evas_Font_OT_Info;
struct _Evas_Font_OT_Info struct _Evas_Font_OT_Info
{ {
size_t source_cluster; size_t source_cluster;
Evas_Coord x_offset; int x_offset;
Evas_Coord y_offset; int y_offset;
}; };
# endif # endif
@ -28,7 +32,8 @@ struct _Evas_Font_OT_Info
# define EVAS_FONT_OT_POS_GET(a) ((a).source_cluster) # define EVAS_FONT_OT_POS_GET(a) ((a).source_cluster)
# endif # endif
# include "evas_text_utils.h" #include "evas_font.h"
EAPI int EAPI int
evas_common_font_ot_cluster_size_get(const Evas_Text_Props *props, size_t char_index); evas_common_font_ot_cluster_size_get(const Evas_Text_Props *props, size_t char_index);

View File

@ -1,10 +1,50 @@
#ifndef _EVAS_FONT_PRIVATE_H #ifndef _EVAS_FONT_PRIVATE_H
#define _EVAS_FONT_PRIVATE_H #define _EVAS_FONT_PRIVATE_H
#include "evas_font_ot.h"
#include "evas_font.h"
/* macros needed to log message through eina_log */
extern EAPI int _evas_font_log_dom_global;
#ifdef _EVAS_FONT_DEFAULT_LOG_DOM
# undef _EVAS_FONT_DEFAULT_LOG_DOM
#endif
#define _EVAS_FONT_DEFAULT_LOG_DOM _evas_font_log_dom_global
#ifdef EVAS_FONT_DEFAULT_LOG_COLOR
# undef EVAS_FONT_DEFAULT_LOG_COLOR
#endif
#define EVAS_FONT_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
#ifdef ERR
# undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_EVAS_FONT_DEFAULT_LOG_DOM, __VA_ARGS__)
#ifdef DBG
# undef DBG
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_EVAS_FONT_DEFAULT_LOG_DOM, __VA_ARGS__)
#ifdef INF
# undef INF
#endif
#define INF(...) EINA_LOG_DOM_INFO(_EVAS_FONT_DEFAULT_LOG_DOM, __VA_ARGS__)
#ifdef WRN
# undef WRN
#endif
#define WRN(...) EINA_LOG_DOM_WARN(_EVAS_FONT_DEFAULT_LOG_DOM, __VA_ARGS__)
#ifdef CRI
# undef CRI
#endif
#define CRI(...) EINA_LOG_DOM_CRIT(_EVAS_FONT_DEFAULT_LOG_DOM, __VA_ARGS__)
extern LK(lock_font_draw); // for freetype2 API calls extern LK(lock_font_draw); // for freetype2 API calls
extern LK(lock_bidi); // for fribidi API calls extern LK(lock_bidi); // for fribidi API calls
extern LK(lock_ot); // for harfbuzz calls extern LK(lock_ot); // for harfbuzz calls
# define FTLOCK() LKL(lock_font_draw) # define FTLOCK() LKL(lock_font_draw)
# define FTUNLOCK() LKU(lock_font_draw) # define FTUNLOCK() LKU(lock_font_draw)

View File

@ -1,7 +1,4 @@
#include "evas_common_private.h"
#include "language/evas_bidi_utils.h" /*defines BIDI_SUPPORT if possible */
#include "evas_font_private.h" /* for Frame-Queuing support */ #include "evas_font_private.h" /* for Frame-Queuing support */
#include "evas_font_ot.h"
/* FIXME: Check coverage according to the font and not by actually loading */ /* FIXME: Check coverage according to the font and not by actually loading */

View File

@ -1,8 +1,4 @@
#include "evas_common_private.h"
#include "evas_font_private.h" #include "evas_font_private.h"
#include "evas_text_utils.h"
#include "language/evas_bidi_utils.h"
#include "language/evas_language_utils.h"
#define PROPS_CHANGE(Props) Props->changed = EINA_TRUE; #define PROPS_CHANGE(Props) Props->changed = EINA_TRUE;

View File

@ -17,7 +17,6 @@ typedef enum
} Evas_Text_Props_Mode; } Evas_Text_Props_Mode;
# include "evas_font_ot.h" # include "evas_font_ot.h"
# include "language/evas_bidi_utils.h"
# include "language/evas_language_utils.h" # include "language/evas_language_utils.h"
/* Used for showing "malformed" or missing chars */ /* Used for showing "malformed" or missing chars */

View File

@ -63,6 +63,8 @@
#include "Evas_Internal.h" #include "Evas_Internal.h"
#include "../common/evas_font.h"
#ifdef EAPI #ifdef EAPI
# undef EAPI # undef EAPI
#endif #endif
@ -224,20 +226,6 @@ extern EAPI int _evas_log_dom_global;
# define THI(x) int x # define THI(x) int x
# define TH_MAX 8 # define TH_MAX 8
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_SIZES_H
#include FT_MODULE_H
#ifndef FT_HAS_COLOR
# define FT_HAS_COLOR(face) 0
#endif
#ifndef FT_LOAD_COLOR
# define FT_LOAD_COLOR FT_LOAD_DEFAULT
#endif
#ifdef __GNUC__ #ifdef __GNUC__
# if __GNUC__ >= 4 # if __GNUC__ >= 4
// BROKEN in gcc 4 on amd64 // BROKEN in gcc 4 on amd64
@ -430,11 +418,6 @@ typedef struct _RGBA_Draw_Context RGBA_Draw_Context;
typedef struct _RGBA_Polygon_Point RGBA_Polygon_Point; typedef struct _RGBA_Polygon_Point RGBA_Polygon_Point;
typedef struct _RGBA_Map_Point RGBA_Map_Point; typedef struct _RGBA_Map_Point RGBA_Map_Point;
typedef struct _RGBA_Map RGBA_Map; typedef struct _RGBA_Map RGBA_Map;
typedef struct _RGBA_Font RGBA_Font;
typedef struct _RGBA_Font_Int RGBA_Font_Int;
typedef struct _RGBA_Font_Source RGBA_Font_Source;
typedef struct _RGBA_Font_Glyph RGBA_Font_Glyph;
typedef struct _RGBA_Font_Glyph_Out RGBA_Font_Glyph_Out;
typedef struct _RGBA_Gfx_Compositor RGBA_Gfx_Compositor; typedef struct _RGBA_Gfx_Compositor RGBA_Gfx_Compositor;
typedef struct _RGBA_Image_Data_Map RGBA_Image_Data_Map; typedef struct _RGBA_Image_Data_Map RGBA_Image_Data_Map;
@ -478,6 +461,8 @@ typedef void (*Evas_Engine_Thread_Task_Cb)(void *engine_data, Image_Entry *ie, v
#include "../cache2/evas_cache2.h" #include "../cache2/evas_cache2.h"
#endif #endif
#include "../common/evas_font_draw.h"
/*****************************************************************************/ /*****************************************************************************/
typedef void (*Evas_Thread_Command_Cb)(void *data); typedef void (*Evas_Thread_Command_Cb)(void *data);
@ -536,20 +521,6 @@ typedef enum _CPU_Features
CPU_FEATURE_SSE3 = (1 << 7) CPU_FEATURE_SSE3 = (1 << 7)
} CPU_Features; } CPU_Features;
typedef enum _Font_Hint_Flags
{
FONT_NO_HINT,
FONT_AUTO_HINT,
FONT_BYTECODE_HINT
} Font_Hint_Flags;
typedef enum _Font_Rend_Flags
{
FONT_REND_REGULAR = 0,
FONT_REND_SLANT = (1 << 0),
FONT_REND_WEIGHT = (1 << 1),
} Font_Rend_Flags;
/*****************************************************************************/ /*****************************************************************************/
struct _Image_Entry_Flags struct _Image_Entry_Flags
@ -792,7 +763,6 @@ struct _RGBA_Draw_Context
#ifdef BUILD_PIPE_RENDER #ifdef BUILD_PIPE_RENDER
#include "../common/evas_map_image.h" #include "../common/evas_map_image.h"
#include "../common/evas_text_utils.h"
struct _RGBA_Pipe_Op struct _RGBA_Pipe_Op
{ {
@ -947,146 +917,6 @@ struct _RGBA_Map
RGBA_Map_Point pts[1]; RGBA_Map_Point pts[1];
}; };
// for fonts...
/////
typedef struct _Fash_Item_Index_Map Fash_Item_Index_Map;
typedef struct _Fash_Int_Map Fash_Int_Map;
typedef struct _Fash_Int_Map2 Fash_Int_Map2;
typedef struct _Fash_Int Fash_Int;
struct _Fash_Item_Index_Map
{
RGBA_Font_Int *fint;
int index;
};
struct _Fash_Int_Map
{
Fash_Item_Index_Map item[256];
};
struct _Fash_Int_Map2
{
Fash_Int_Map *bucket[256];
};
struct _Fash_Int
{
Fash_Int_Map2 *bucket[256];
void (*freeme) (Fash_Int *fash);
};
/////
typedef struct _Fash_Glyph_Map Fash_Glyph_Map;
typedef struct _Fash_Glyph_Map2 Fash_Glyph_Map2;
typedef struct _Fash_Glyph Fash_Glyph;
struct _Fash_Glyph_Map
{
RGBA_Font_Glyph *item[256];
};
struct _Fash_Glyph_Map2
{
Fash_Glyph_Map *bucket[256];
};
struct _Fash_Glyph
{
Fash_Glyph_Map2 *bucket[256];
void (*freeme) (Fash_Glyph *fash);
};
/////
struct _RGBA_Font
{
Eina_List *fonts;
Fash_Int *fash;
Font_Hint_Flags hinting;
int references;
LK(lock);
unsigned char sizeok : 1;
};
#include "../common/evas_font_ot.h"
struct _RGBA_Font_Int
{
EINA_INLIST;
RGBA_Font_Source *src;
Eina_Hash *kerning;
Fash_Glyph *fash;
unsigned int size;
float scale_factor;
int real_size;
int max_h;
int references;
int usage;
struct {
FT_Size size;
#ifdef USE_HARFBUZZ
void *hb_font;
#endif
} ft;
LK(ft_mutex);
Font_Hint_Flags hinting;
Font_Rend_Flags wanted_rend; /* The wanted rendering style */
Font_Rend_Flags runtime_rend; /* The rendering we need to do on runtime
in order to comply with the wanted_rend. */
Eina_List *task;
#ifdef EVAS_CSERVE2
void *cs2_handler;
#endif
int generation;
Efl_Text_Font_Bitmap_Scalable bitmap_scalable;
unsigned char sizeok : 1;
unsigned char inuse : 1;
};
struct _RGBA_Font_Source
{
const char *name;
const char *file;
void *data;
unsigned int current_size;
int data_size;
int references;
struct {
int orig_upem;
FT_Face face;
} ft;
};
/*
* laziness wins for now. The parts used from the freetpye struct are
* kept intact to avoid changing the code using it until we know exactly
* what needs to be changed
*/
struct _RGBA_Font_Glyph_Out
{
unsigned char *rle;
struct {
unsigned char *buffer;
unsigned short rows;
unsigned short width;
unsigned short pitch;
unsigned short rle_alloc : 1;
unsigned short no_free_glout : 1;
} bitmap;
int rle_size;
};
struct _RGBA_Font_Glyph
{
FT_UInt index;
Evas_Coord width;
Evas_Coord x_bear;
Evas_Coord y_bear;
FT_Glyph glyph;
RGBA_Font_Glyph_Out *glyph_out;
/* this is a problem - only 1 engine at a time can extend such a font... grrr */
void *ext_dat;
void (*ext_dat_free) (void *ext_dat);
RGBA_Font_Int *fi;
};
struct _RGBA_Gfx_Compositor struct _RGBA_Gfx_Compositor
{ {
const char *name; const char *name;
@ -1287,7 +1117,6 @@ EAPI void evas_common_blit_init (void);
EAPI void evas_common_blit_rectangle (const RGBA_Image *src, RGBA_Image *dst, int src_x, int src_y, int w, int h, int dst_x, int dst_y); EAPI void evas_common_blit_rectangle (const RGBA_Image *src, RGBA_Image *dst, int src_x, int src_y, int w, int h, int dst_x, int dst_y);
/****/ /****/
#include "../common/evas_font.h"
/****/ /****/
EAPI void evas_common_tilebuf_init (void); EAPI void evas_common_tilebuf_init (void);
@ -1321,8 +1150,6 @@ Tilebuf_Rect *evas_common_regionbuf_rects_get (Regionbuf *rb);
/****/ /****/
#include "../common/evas_pipe.h" #include "../common/evas_pipe.h"
void evas_font_dir_cache_free(void);
EAPI void evas_thread_queue_wait(void); EAPI void evas_thread_queue_wait(void);
EAPI int evas_async_events_process_blocking(void); EAPI int evas_async_events_process_blocking(void);

View File

@ -14,12 +14,10 @@
#include "../file/evas_module.h" #include "../file/evas_module.h"
#include "../file/evas_path.h" #include "../file/evas_path.h"
#include "../common/evas_text_utils.h"
#include "../common/language/evas_bidi_utils.h"
#include "../common/language/evas_language_utils.h"
#include "evas_3d_utils.h" #include "evas_3d_utils.h"
#ifdef EAPI #ifdef EAPI
# undef EAPI # undef EAPI
#endif #endif
@ -66,10 +64,6 @@ typedef struct _Evas_Aspect Evas_Aspect;
typedef struct _Evas_Border Evas_Border; typedef struct _Evas_Border Evas_Border;
typedef struct _Evas_Double_Pair Evas_Double_Pair; typedef struct _Evas_Double_Pair Evas_Double_Pair;
typedef struct _Evas_Size_Hints Evas_Size_Hints; typedef struct _Evas_Size_Hints Evas_Size_Hints;
typedef struct _Evas_Font_Dir Evas_Font_Dir;
typedef struct _Evas_Font Evas_Font;
typedef struct _Evas_Font_Alias Evas_Font_Alias;
typedef struct _Evas_Font_Description Evas_Font_Description;
typedef struct _Evas_Data_Node Evas_Data_Node; typedef struct _Evas_Data_Node Evas_Data_Node;
typedef struct _Evas_Func Evas_Func; typedef struct _Evas_Func Evas_Func;
typedef struct _Evas_Image_Save_Func Evas_Image_Save_Func; typedef struct _Evas_Image_Save_Func Evas_Image_Save_Func;
@ -505,64 +499,6 @@ struct _Evas_Canvas3D_Pick_Data
Evas_Real s, t; Evas_Real s, t;
}; };
enum _Evas_Font_Style
{
EVAS_FONT_STYLE_SLANT,
EVAS_FONT_STYLE_WEIGHT,
EVAS_FONT_STYLE_WIDTH
};
enum _Evas_Font_Slant
{
EVAS_FONT_SLANT_NORMAL,
EVAS_FONT_SLANT_OBLIQUE,
EVAS_FONT_SLANT_ITALIC
};
enum _Evas_Font_Weight
{
EVAS_FONT_WEIGHT_NORMAL,
EVAS_FONT_WEIGHT_THIN,
EVAS_FONT_WEIGHT_ULTRALIGHT,
EVAS_FONT_WEIGHT_EXTRALIGHT,
EVAS_FONT_WEIGHT_LIGHT,
EVAS_FONT_WEIGHT_BOOK,
EVAS_FONT_WEIGHT_MEDIUM,
EVAS_FONT_WEIGHT_SEMIBOLD,
EVAS_FONT_WEIGHT_BOLD,
EVAS_FONT_WEIGHT_ULTRABOLD,
EVAS_FONT_WEIGHT_EXTRABOLD,
EVAS_FONT_WEIGHT_BLACK,
EVAS_FONT_WEIGHT_EXTRABLACK
};
enum _Evas_Font_Width
{
EVAS_FONT_WIDTH_NORMAL,
EVAS_FONT_WIDTH_ULTRACONDENSED,
EVAS_FONT_WIDTH_EXTRACONDENSED,
EVAS_FONT_WIDTH_CONDENSED,
EVAS_FONT_WIDTH_SEMICONDENSED,
EVAS_FONT_WIDTH_SEMIEXPANDED,
EVAS_FONT_WIDTH_EXPANDED,
EVAS_FONT_WIDTH_EXTRAEXPANDED,
EVAS_FONT_WIDTH_ULTRAEXPANDED
};
enum _Evas_Font_Spacing
{
EVAS_FONT_SPACING_PROPORTIONAL,
EVAS_FONT_SPACING_DUAL,
EVAS_FONT_SPACING_MONO,
EVAS_FONT_SPACING_CHARCELL
};
typedef enum _Evas_Font_Style Evas_Font_Style;
typedef enum _Evas_Font_Slant Evas_Font_Slant;
typedef enum _Evas_Font_Weight Evas_Font_Weight;
typedef enum _Evas_Font_Width Evas_Font_Width;
typedef enum _Evas_Font_Spacing Evas_Font_Spacing;
/* General types - used for script type chceking */ /* General types - used for script type chceking */
#define OPAQUE_TYPE(type) struct __##type { int a; }; \ #define OPAQUE_TYPE(type) struct __##type { int a; }; \
typedef struct __##type type typedef struct __##type type
@ -1281,50 +1217,6 @@ struct _Evas_Data_Node
void *data; void *data;
}; };
struct _Evas_Font_Dir
{
Eina_Hash *lookup;
Eina_List *fonts;
Eina_List *aliases;
DATA64 dir_mod_time;
DATA64 fonts_dir_mod_time;
DATA64 fonts_alias_mod_time;
};
struct _Evas_Font
{
struct {
const char *prop[14];
} x;
struct {
const char *name;
} simple;
const char *path;
char type;
};
struct _Evas_Font_Alias
{
const char *alias;
Evas_Font *fn;
};
struct _Evas_Font_Description
{
int ref;
Eina_Stringshare *name;
Eina_Stringshare *fallbacks;
Eina_Stringshare *lang;
Eina_Stringshare *style;
Evas_Font_Slant slant;
Evas_Font_Weight weight;
Evas_Font_Width width;
Evas_Font_Spacing spacing;
Eina_Bool is_new : 1;
};
struct _Efl_Canvas_Output struct _Efl_Canvas_Output
{ {
Eo *canvas; Eo *canvas;
@ -1764,23 +1656,6 @@ void evas_object_inform_call_image_resize(Evas_Object *obj);
void evas_object_intercept_cleanup(Evas_Object *obj); void evas_object_intercept_cleanup(Evas_Object *obj);
void evas_object_grabs_cleanup(Evas_Object *obj, Evas_Object_Protected_Data *pd); void evas_object_grabs_cleanup(Evas_Object *obj, Evas_Object_Protected_Data *pd);
void evas_key_grab_free(Evas_Object *obj, Evas_Object_Protected_Data *pd, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers); void evas_key_grab_free(Evas_Object *obj, Evas_Object_Protected_Data *pd, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers);
void evas_font_dir_cache_free(void);
const char *evas_font_dir_cache_find(char *dir, char *font);
Eina_List *evas_font_dir_available_list(const Evas* evas);
void evas_font_dir_available_list_free(Eina_List *available);
void evas_font_free(Evas *evas, void *font);
void evas_fonts_zero_free(Evas *evas);
void evas_fonts_zero_pressure(Evas *evas);
void evas_font_name_parse(Evas_Font_Description *fdesc, const char *name);
int evas_font_style_find(const char *start, const char *end, Evas_Font_Style style);
Evas_Font_Description *evas_font_desc_new(void);
Evas_Font_Description *evas_font_desc_dup(const Evas_Font_Description *fdesc);
void evas_font_desc_unref(Evas_Font_Description *fdesc);
int evas_font_desc_cmp(const Evas_Font_Description *a, const Evas_Font_Description *b);
Evas_Font_Description *evas_font_desc_ref(Evas_Font_Description *fdesc);
const char *evas_font_lang_normalize(const char *lang);
void * evas_font_load(Evas *evas, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size, Efl_Text_Font_Bitmap_Scalable bitmap_scalable);
void evas_font_load_hinting_set(Evas *evas, void *font, int hinting);
void evas_object_smart_member_cache_invalidate(Evas_Object *obj, Eina_Bool pass_events, Eina_Bool freeze_events, Eina_Bool sourve_invisible); void evas_object_smart_member_cache_invalidate(Evas_Object *obj, Eina_Bool pass_events, Eina_Bool freeze_events, Eina_Bool sourve_invisible);
void evas_text_style_pad_get(Evas_Text_Style_Type style, int *l, int *r, int *t, int *b); void evas_text_style_pad_get(Evas_Text_Style_Type style, int *l, int *r, int *t, int *b);
void _evas_object_text_rehint(Evas_Object *obj); void _evas_object_text_rehint(Evas_Object *obj);