summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-03-21 07:43:39 +0000
committerSung-jae Park <nicesj.park@samsung.com>2013-03-21 07:43:39 +0000
commit160817bf2cadc6bb920736af680eec9ab4a78828 (patch)
tree516917bf4d99f6be41d59850ac861a7606d69031
parent4146343da1479918ca43395d6071c259ec43cdaa (diff)
downloadlivebox-edje-160817bf2cadc6bb920736af680eec9ab4a78828.tar.gz
livebox-edje-160817bf2cadc6bb920736af680eec9ab4a78828.tar.bz2
livebox-edje-160817bf2cadc6bb920736af680eec9ab4a78828.zip
Fix the bug of font-style changing code
Change-Id: I4b562fc7127b2dfdb28cd34043484a8bb7663aa6
-rw-r--r--packaging/liblivebox-edje.spec2
-rw-r--r--src/script_port.c73
2 files changed, 48 insertions, 27 deletions
diff --git a/packaging/liblivebox-edje.spec b/packaging/liblivebox-edje.spec
index 9fe7faa..64e16fc 100644
--- a/packaging/liblivebox-edje.spec
+++ b/packaging/liblivebox-edje.spec
@@ -1,6 +1,6 @@
Name: liblivebox-edje
Summary: EDJE Script loader for the data provider master
-Version: 0.2.8
+Version: 0.3.0
Release: 1
Group: framework/livebox
License: Flora License
diff --git a/src/script_port.c b/src/script_port.c
index 0afb6b3..85bab86 100644
--- a/src/script_port.c
+++ b/src/script_port.c
@@ -528,11 +528,6 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
}
DbgPrint("Size: %dx%d\n", w, h);
- evas_object_data_set(img, "part_w", (void *)part_w);
- evas_object_data_set(img, "part_h", (void *)part_h);
- evas_object_data_set(img, "w", (void *)w);
- evas_object_data_set(img, "h", (void *)h);
-
evas_object_image_load_size_set(img, w, h);
evas_object_image_load_region_set(img, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h);
evas_object_image_fill_set(img, 0, 0, part_w, part_h);
@@ -683,7 +678,6 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
return -EFAULT;
}
- //edje_object_text_class_set(obj, TEXT_CLASS, s_info.font, s_info.size);
if (!edje_object_file_set(obj, path, group)) {
int err;
const char *errmsg;
@@ -886,7 +880,6 @@ PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
return -EFAULT;
}
- //edje_object_text_class_set(edje, TEXT_CLASS, s_info.font, s_info.size);
DbgPrint("Load edje: %s - %s\n", handle->file, handle->group);
if (!edje_object_file_set(edje, handle->file, handle->group)) {
int err;
@@ -931,41 +924,55 @@ PUBLIC int script_unload(void *_handle, Evas *e)
return 0;
}
+static inline int update_font(const char *font)
+{
+ Eina_List *list;
+ char *text;
+ int cache;
+
+ cache = evas_common_font_cache_get();
+ evas_common_font_cache_set(0);
+ evas_common_font_flush();
+
+ list = edje_text_class_list();
+ EINA_LIST_FREE(list, text) {
+ if (!strncasecmp(text, TEXT_CLASS, strlen(TEXT_CLASS))) {
+ edje_text_class_del(text);
+ edje_text_class_set(text, s_info.font, s_info.size);
+ DbgPrint("Update text class %s (%s, %d)\n", text, s_info.font, s_info.size);
+ } else {
+ DbgPrint("Skip text class %s\n", text);
+ }
+ }
+ DbgPrint("Font for text_class is updated\n");
+
+ evas_common_font_cache_set(cache);
+ return 0;
+}
+
static Eina_Bool property_cb(void *data, int type, void *event)
{
Ecore_X_Event_Window_Property *info = (Ecore_X_Event_Window_Property *)event;
if (info->atom == ecore_x_atom_get("FONT_TYPE_change") || info->atom == ecore_x_atom_get("BADA_FONT_change")) {
- Eina_List *list;
- char *text;
char *font;
- int cache;
font = vconf_get_str("db/setting/accessibility/font_name");
if (!font)
return ECORE_CALLBACK_PASS_ON;
+ if (s_info.font && !strcmp(s_info.font, font)) {
+ DbgPrint("Font is not changed (%s)\n", font);
+ free(font);
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
if (s_info.font)
free(s_info.font);
s_info.font = font;
- cache = evas_common_font_cache_get();
- evas_common_font_cache_set(0);
- evas_common_font_flush();
-
- list = edje_text_class_list();
- EINA_LIST_FREE(list, text) {
- if (!strncasecmp(text, TEXT_CLASS, strlen(TEXT_CLASS))) {
- edje_text_class_del(text);
- edje_text_class_set(text, s_info.font, s_info.size);
- DbgPrint("Update text class %s (%s, %d)\n", text, s_info.font, s_info.size);
- } else {
- DbgPrint("Skip text class %s\n", text);
- }
- }
-
- evas_common_font_cache_set(cache);
+ update_font(font);
}
return ECORE_CALLBACK_PASS_ON;
@@ -982,7 +989,21 @@ static void font_name_cb(keynode_t *node, void *user_data)
if (!font)
return;
+ if (s_info.font && !strcmp(s_info.font, font)) {
+ DbgPrint("Font is not changed\n");
+ return;
+ }
+
DbgPrint("Font changed to %s\n", font);
+
+ if (s_info.font)
+ free(s_info.font);
+
+ s_info.font = strdup(font);
+ if (!s_info.font)
+ ErrPrint("Heap: %s\n", strerror(errno));
+
+ update_font(font);
}
static void font_size_cb(keynode_t *node, void *user_data)