#include "script_port.h"
#define TEXT_CLASS "tizen"
+#define DEFAULT_FONT_SIZE -100
#define BASE_WIDTH 720.0f
#define PUBLIC __attribute__((visibility("default")))
int font_size;
} s_info = {
.font_name = NULL,
- .font_size = 1,
+ .font_size = -100,
};
static inline double scale_get(void)
static void update_font_cb(void *data)
{
- elm_config_font_overlay_set(TEXT_CLASS, s_info.font_name, s_info.font_size);
- DbgPrint("Update text class %s (%s, %d)\n", TEXT_CLASS, s_info.font_name, s_info.font_size);
+ elm_config_font_overlay_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
+ DbgPrint("Update text class %s (%s, %d)\n", TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
}
-static void font_changed_cb(system_settings_key_e key, void *user_data)
+static void font_changed_cb(keynode_t *node, void *user_data)
{
- int ret;
char *font_name;
- ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
- if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name)
+ font_name = vconf_get_str("db/setting/accessibility/font_name");
+ if (!font_name) {
+ ErrPrint("Invalid font name (NULL)\n");
return;
+ }
if (s_info.font_name && !strcmp(s_info.font_name, font_name)) {
- DbgPrint("Font is not changed\n");
+ DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
free(font_name);
return;
}
if (s_info.font_name) {
+ DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
free(s_info.font_name);
s_info.font_name = NULL;
}
s_info.font_name = font_name;
- DbgPrint("Font name is changed to %s\n", s_info.font_name);
+ DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name);
/*!
* \NOTE
update_font_cb(NULL);
}
+static inline int convert_font_size(int size)
+{
+ switch (size) {
+ case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
+ size = -80;
+ break;
+ case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
+ size = -100;
+ break;
+ case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
+ size = -150;
+ break;
+ case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
+ size = -190;
+ break;
+ case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
+ size = -250;
+ break;
+ default:
+ size = -100;
+ break;
+ }
+
+ DbgPrint("Return size: %d\n", size);
+ return size;
+}
+
static void font_size_cb(system_settings_key_e key, void *user_data)
{
int size;
if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE)
return;
+ size = convert_font_size(size);
+
if (size == s_info.font_size) {
DbgPrint("Font size is not changed\n");
return;
PUBLIC int script_init(void)
{
int ret;
+ int size = DEFAULT_FONT_SIZE;
char *argv[] = {
"livebox.edje",
NULL,
access_cb(NULL, NULL);
- ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE, font_changed_cb, NULL);
+ ret = vconf_notify_key_changed("db/setting/accessibility/font_name", font_changed_cb, NULL);
DbgPrint("System font is changed: %d\n", ret);
ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, font_size_cb, NULL);
DbgPrint("System font size is changed: %d\n", ret);
- ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &s_info.font_name);
- if (ret == SYSTEM_SETTINGS_ERROR_NONE)
- DbgPrint("Current font: %s\n", s_info.font_name);
+ s_info.font_name = vconf_get_str("db/setting/accessibility/font_name");
+ DbgPrint("Current font: %s\n", s_info.font_name);
- ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &s_info.font_size);
- if (ret == SYSTEM_SETTINGS_ERROR_NONE)
- DbgPrint("Current size: %d\n", s_info.font_size);
+ ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size);
+ s_info.font_size = convert_font_size(size);
+ DbgPrint("Current size: %d\n", s_info.font_size);
return LB_STATUS_SUCCESS;
}