Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/canvas
Modified Files:
evas_object_text.c
Log Message:
added in loading froms from memory buffers at the engine level, and now an
api to set a font "source" (blank is normal filing system) but the source can
be a device or file etc. in this case it currently supports eet files as the
source and then the font name is used as a key in th eet file as to where to
find the font - edb support would be trivial to add. :) if the font is not
found in the "source" it falls back to the font path etc.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/canvas/evas_object_text.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- evas_object_text.c 13 Jan 2004 02:24:03 -0000 1.20
+++ evas_object_text.c 23 Jan 2004 02:13:28 -0000 1.21
@@ -1,6 +1,9 @@
#include "evas_common.h"
#include "evas_private.h"
#include "Evas.h"
+#ifdef BUILD_FONT_LOADER_EET
+#include <Eet.h>
+#endif
/* private magic number for text objects */
static const char o_type[] = "text";
@@ -15,6 +18,7 @@
struct {
char *text;
char *font;
+ char *source;
Evas_Font_Size size;
} cur, prev;
char changed : 1;
@@ -507,6 +511,53 @@
*
*/
void
+evas_object_text_font_source_set(Evas_Object *obj, const char *font_source)
+{
+ Evas_Object_Text *o;
+
+ MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
+ return;
+ MAGIC_CHECK_END();
+ o = (Evas_Object_Text *)(obj->object_data);
+ MAGIC_CHECK(o, Evas_Object_Text, MAGIC_OBJ_TEXT);
+ return;
+ MAGIC_CHECK_END();
+ if ((o->cur.source) && (font_source) &&
+ (!strcmp(o->cur.source, font_source)))
+ return;
+ if (o->cur.source) free(o->cur.source);
+ if (font_source) o->cur.source = strdup(font_source);
+ else o->cur.source = NULL;
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ *
+ */
+const char *
+evas_object_text_font_source_get(Evas_Object *obj)
+{
+ Evas_Object_Text *o;
+
+ MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
+ return NULL;
+ MAGIC_CHECK_END();
+ o = (Evas_Object_Text *)(obj->object_data);
+ MAGIC_CHECK(o, Evas_Object_Text, MAGIC_OBJ_TEXT);
+ return NULL;
+ MAGIC_CHECK_END();
+ return o->cur.source;
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ *
+ */
+void
evas_object_text_font_set(Evas_Object *obj, const char *font, Evas_Font_Size size)
{
Evas_Object_Text *o;
@@ -542,18 +593,61 @@
{
Evas_List *l;
- for (l = obj->layer->evas->font_path; l; l = l->next)
+#ifdef BUILD_FONT_LOADER_EET
+ if (o->cur.source)
{
- char *f_file;
-
- f_file = object_text_font_cache_find(l->data, (char *)font);
- if (f_file)
+ Eet_File *ef;
+ char *fake_name;
+
+ fake_name = evas_file_path_join(o->cur.source, font);
+ if (fake_name)
{
- o->engine_data =
obj->layer->evas->engine.func->font_load(obj->layer->evas->engine.data.output,
- f_file,
size);
- if (o->engine_data) break;
+ o->engine_data =
+ obj->layer->evas->engine.func->font_load
+ (obj->layer->evas->engine.data.output, fake_name,
+ size);
+ if (!o->engine_data)
+ {
+ /* read original!!! */
+ ef = eet_open(o->cur.source, EET_FILE_MODE_READ);
+ if (ef)
+ {
+ void *fdata;
+ int fsize = 0;
+
+ fdata = eet_read(ef, font, &fsize);
+ if ((fdata) && (fsize > 0))
+ {
+ o->engine_data =
+ obj->layer->evas->engine.func->font_memory_load
+ (obj->layer->evas->engine.data.output,
+ fake_name, size, fdata, fsize);
+ free(fdata);
+ }
+ eet_close(ef);
+ }
+ }
+ free(fake_name);
+ }
+ }
+ if (!o->engine_data)
+ {
+#endif
+ for (l = obj->layer->evas->font_path; l; l = l->next)
+ {
+ char *f_file;
+
+ f_file = object_text_font_cache_find(l->data, (char *)font);
+ if (f_file)
+ {
+ o->engine_data =
obj->layer->evas->engine.func->font_load(obj->layer->evas->engine.data.output,
+
f_file, size);
+ if (o->engine_data) break;
+ }
}
+#ifdef BUILD_FONT_LOADER_EET
}
+#endif
}
if (o->cur.font) free(o->cur.font);
if (font) o->cur.font = strdup(font);
@@ -1206,6 +1300,7 @@
/* free obj */
if (o->cur.text) free(o->cur.text);
if (o->cur.font) free(o->cur.font);
+ if (o->cur.source) free(o->cur.source);
if (o->engine_data)
obj->layer->evas->engine.func->font_free(obj->layer->evas->engine.data.output,
o->engine_data);
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs