Fix N_SE-17540 font size issue
authorSoonmin Jung <sm0415.jung@samsung.com>
Mon, 7 Jan 2013 07:56:33 +0000 (16:56 +0900)
committerSoonmin Jung <sm0415.jung@samsung.com>
Mon, 7 Jan 2013 07:56:33 +0000 (16:56 +0900)
Change-Id: I5bd616840ae7ecc61eface575b2a6749850b7443

composer/include/msg-ui-composer-common.h
composer/include/msg-ui-composer-data.h
composer/src/ui-composer/msg-ui-composer-body-page.c
composer/src/ui-composer/msg-ui-composer-common.c
composer/src/ui-composer/msg-ui-composer-subject.c

index e60a11f..6cd4e25 100755 (executable)
@@ -77,6 +77,7 @@ int msg_ui_composer_get_keypad_height(Evas_Object *entry);
 void msg_ui_composer_change_body_scroll_size(MSG_COMPOSER_VIEW_DATA_S *cd, int keypad_height);
 void msg_ui_composer_make_default_body_size(MSG_COMPOSER_VIEW_DATA_S *cd);
 
+int msg_ui_composer_get_font_size(int type);
 void msg_ui_composer_apply_font_size(MSG_COMPOSER_VIEW_DATA_S *cd, bool update_subject);
 
 #endif/*__MSG_COMPOSER_COMMON_H__*/
index 3e35ae6..f17a45a 100755 (executable)
@@ -279,6 +279,11 @@ enum {
        COMPOSER_ADDR_TYPE_EMAIL
 };
 
+enum {
+       COMPOSER_TYPE_SUBJECT = 0,
+       COMPOSER_TYPE_BODY
+};
+
 typedef enum {
        COMPOSER_CONTENT_CREATION_NONE,
        COMPOSER_CONTENT_CREATION_ALLOWED,
index 339c33e..528ca39 100755 (executable)
@@ -421,7 +421,15 @@ static Evas_Object *__msg_ui_composer_body_page_create(MSG_COMPOSER_VIEW_DATA_S
        }
 
        /* fix font size */
-       elm_entry_text_style_user_push(entry, "DEFAULT='font_size=36'");
+       char font_style[DEF_BUF_LEN_S + 1] = {0,};
+       int font_size = msg_ui_composer_get_font_size(COMPOSER_TYPE_BODY);
+
+       if (font_size > 0)
+               snprintf(font_style, sizeof(font_style), "DEFAULT='font_size=%d'", font_size);
+       else
+               snprintf(font_style, sizeof(font_style), "DEFAULT='font_size=%d'", MSGC_BODY_FONT_SIZE);
+
+       elm_entry_text_style_user_push(entry, font_style);
 
        evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
index ec76352..3c04209 100755 (executable)
@@ -1348,6 +1348,55 @@ void msg_ui_composer_entry_imf_state_cb(void * data, Ecore_IMF_Context *ctx, int
        D_LEAVE;
 }
 
+int msg_ui_composer_get_font_size(int type)
+{
+       D_ENTER;
+
+       int font_size = 0;
+       int converted_size = -1;
+
+       if (type == COMPOSER_TYPE_BODY) {
+               int index = 0;
+
+               if (msg_common_get_font_size(&index) == FALSE) {
+                       D_EMSG("msg_common_get_font_size() is failed !!");
+                       return -1;
+               } else {
+                       D_MSG("selected font_size index = %d", index);
+               }
+
+               font_size = msg_common_get_font_size_from_index(index);
+
+               if (font_size == -1) {
+                       D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+                       return -1;
+               }
+
+               converted_size = (MSGC_BODY_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+       } else if (type == COMPOSER_TYPE_SUBJECT) {
+               int access_font_index = 0;
+
+               /* get accessibility font index */
+               if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &access_font_index) < 0) {
+                       D_EMSG("vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE) is failed !!");
+                       access_font_index = MSG_SYS_FONT_SIZE_INDEX_NORMAL;     /* 1 */
+               }
+
+               font_size = msg_common_get_font_size_from_index(access_font_index);
+               if (font_size == -1) {
+                       D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+                       return -1;
+               }
+
+               converted_size = (MSGC_SUBJECT_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+       } else {
+               D_EMSG("Invalid type");
+       }
+
+       D_LEAVE;
+       return converted_size;
+}
+
 void msg_ui_composer_apply_font_size(MSG_COMPOSER_VIEW_DATA_S *cd, bool update_subject)
 {
        D_ENTER;
index cab8a9d..8b8f1e4 100755 (executable)
@@ -344,7 +344,13 @@ Evas_Object *msg_ui_composer_create_subject_entry(Evas_Object *parent, MSG_COMPO
        evas_object_size_hint_align_set(entry, 0.0, EVAS_HINT_FILL);
        /* fix font size */
        char font_style[DEF_BUF_LEN_S + 1] = {0,};
-       snprintf(font_style, sizeof(font_style), "DEFAULT='font_size=%d'", MSGC_SUBJECT_FONT_SIZE);
+       int font_size = msg_ui_composer_get_font_size(COMPOSER_TYPE_SUBJECT);
+
+       if (font_size > 0)
+               snprintf(font_style, sizeof(font_style), "DEFAULT='font_size=%d'", font_size);
+       else
+               snprintf(font_style, sizeof(font_style), "DEFAULT='font_size=%d'", MSGC_SUBJECT_FONT_SIZE);
+
        elm_entry_text_style_user_push(entry, font_style);
 
        evas_object_show(entry);