Enlightenment CVS committal
Author : shorne
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/common
Modified Files:
Makefile.am evas_font_draw.c evas_font_load.c
Added Files:
evas_array_hash.c
Log Message:
Add font charmap caching
* TODO: store cache on disc, for faster cache loading (this requires EET to
support arrays)
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- Makefile.am 17 Jan 2006 03:47:35 -0000 1.16
+++ Makefile.am 22 Apr 2006 11:08:01 -0000 1.17
@@ -53,6 +53,7 @@
evas_scale_smooth.c \
evas_tiler.c \
evas_regionbuf.c \
+evas_array_hash.c \
evas_blend_ops.h
EXTRA_DIST = \
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_font_draw.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- evas_font_draw.c 17 Apr 2006 01:57:11 -0000 1.24
+++ evas_font_draw.c 22 Apr 2006 11:08:01 -0000 1.25
@@ -62,20 +62,67 @@
{
RGBA_Font_Int *fi;
int index;
-
+
fi = l->data;
- if (!fi->ft.size)
+
+ if (fi->src->charmap) /* Charmap loaded, FI/FS blank */
{
- if (!fi->src->ft.face)
- evas_common_font_source_load_complete(fi->src);
- evas_common_font_int_load_complete(fi);
+ index = evas_common_array_hash_search(fi->src->charmap, gl);
+ if (index != 0)
+ {
+ evas_common_font_source_load_complete(fi->src);
+ evas_common_font_int_load_complete(fi);
+
+ evas_common_array_hash_free(fi->src->charmap);
+ fi->src->charmap = NULL;
+
+ *fi_ret = fi;
+ return index;
+ }
+ }
+ else if (!fi->src->ft.face) /* Charmap not loaded, FI/FS blank */
+ {
+ if (evas_common_font_source_load_complete(fi->src));
+ return 0;
+
+ index = FT_Get_Char_Index(fi->src->ft.face, gl);
+ if (index == 0)
+ {
+ /* Load Hash */
+ FT_ULong charcode;
+ FT_UInt gindex;
+
+ fi->src->charmap = evas_common_array_hash_new();
+ charcode = FT_Get_First_Char(fi->src->ft.face, &gindex );
+ while ( gindex != 0 )
+ {
+ evas_common_array_hash_add(fi->src->charmap, charcode,
gindex);
+ charcode = FT_Get_Next_Char(fi->src->ft.face, charcode,
&gindex );
+ }
+
+ /* Free face */
+ FT_Done_Face(fi->src->ft.face);
+ fi->src->ft.face = NULL;
+ }
+ else
+ {
+ evas_common_font_int_load_complete(fi);
+
+ *fi_ret = fi;
+ return index;
+ }
}
-
- index = FT_Get_Char_Index(fi->src->ft.face, gl);
- if (index != 0)
+ else /* Charmap not loaded, FS loaded */
{
- *fi_ret = fi;
- return index;
+ index = FT_Get_Char_Index(fi->src->ft.face, gl);
+ if (index != 0)
+ {
+ if (!fi->ft.size)
+ evas_common_font_int_load_complete(fi);
+
+ *fi_ret = fi;
+ return index;
+ }
}
}
return 0;
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_font_load.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- evas_font_load.c 9 Apr 2006 02:36:03 -0000 1.34
+++ evas_font_load.c 22 Apr 2006 11:08:01 -0000 1.35
@@ -64,8 +64,8 @@
evas_common_font_source_load_complete(RGBA_Font_Source *fs)
{
int error;
-
- error = FT_New_Face(evas_ft_lib, fs->name, 0, &(fs->ft.face));
+
+ error = FT_New_Face(evas_ft_lib, fs->file, 0, &(fs->ft.face));
if (error) return error;
error = FT_Select_Charmap(fs->ft.face, ft_encoding_unicode);
@@ -105,6 +105,7 @@
fonts_src = evas_object_list_remove(fonts_src, fs);
FT_Done_Face(fs->ft.face);
+ if (fs->charmap) evas_common_array_hash_free(fs->charmap);
if (fs->name) evas_stringshare_del(fs->name);
free(fs);
}
@@ -546,3 +547,4 @@
}
return NULL;
}
+
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs