2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <sys/types.h>
32 #include <libxml/xmlmemory.h>
33 #include <libxml/parser.h>
36 #include <Elementary.h>
38 #include <system_settings.h>
39 #include <system_settings_private.h>
41 #define SMALL_FONT_DPI (-80)
42 #define MIDDLE_FONT_DPI (-100)
43 #define LARGE_FONT_DPI (-150)
44 #define HUGE_FONT_DPI (-190)
45 #define GIANT_FONT_DPI (-250)
47 #define SETTING_FONT_CONF_FILE "/opt/etc/fonts/conf.avail/99-slp.conf"
48 #define SETTING_STR_SLP_LEN 256
50 static char* _get_cur_font();
51 static void __font_size_set();
52 static int __font_size_get();
54 static void font_config_set(char *font_name);
55 static void font_config_set_notification();
58 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
59 * @return the ringtone file path specified by user in normal case
60 * if it's not accessable, return the default ringtone path
62 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
65 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
66 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
69 // check to see if it's accessable -> OK
70 // no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR
71 int is_load = _is_file_accessible(vconf_value);
74 } else { // not zero on errro
75 //*value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
76 //*value = strdup("ERROR");
77 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
80 //*value = vconf_value;
81 return SYSTEM_SETTINGS_ERROR_NONE;
85 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
88 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, &vconf_value)) {
89 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
92 return SYSTEM_SETTINGS_ERROR_NONE;
96 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
99 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
100 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
102 *value = vconf_value;
103 return SYSTEM_SETTINGS_ERROR_NONE;
107 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
111 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
112 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
114 *value = vconf_value;
116 return SYSTEM_SETTINGS_ERROR_NONE;
121 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
125 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
126 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
128 *value = (void*)vconf_value;
130 return SYSTEM_SETTINGS_ERROR_NONE;
135 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
137 char* font_name = _get_cur_font();
138 *value = (void*)font_name;
140 return SYSTEM_SETTINGS_ERROR_NONE;
144 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
148 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
149 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
151 *value = (void*)vconf_value;
153 return SYSTEM_SETTINGS_ERROR_NONE;
156 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
160 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
161 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
163 *value = (void*)vconf_value;
165 return SYSTEM_SETTINGS_ERROR_NONE;
168 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
172 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
173 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
175 *value = (void*)vconf_value;
177 return SYSTEM_SETTINGS_ERROR_NONE;
179 ////////////////////////////////////////////////////////////////////////////////////////////////////
181 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
184 vconf_value = (char*)value;
186 int is_load = _is_file_accessible(vconf_value);
189 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
190 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
193 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
196 return SYSTEM_SETTINGS_ERROR_NONE;
200 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
203 vconf_value = (char*)value;
204 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, vconf_value)) {
205 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
208 return SYSTEM_SETTINGS_ERROR_NONE;
212 int _is_file_accessible(const char * path)
214 int ret = access(path ,R_OK);
217 SETTING_TRACE("found the file %s", path);
226 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
229 vconf_value = (char*)value;
231 // error handling here
232 if (_is_file_accessible(vconf_value) != 0)
233 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
235 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
236 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
239 return SYSTEM_SETTINGS_ERROR_NONE;
242 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
245 vconf_value = (char*)value;
247 // error handling here
248 if (_is_file_accessible(vconf_value) != 0)
249 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
251 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
252 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
255 return SYSTEM_SETTINGS_ERROR_NONE;
258 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
262 vconf_value = (int*)value;
264 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
265 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
268 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
269 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
273 return SYSTEM_SETTINGS_ERROR_NONE;
278 void *font_conf_doc_parse(char *doc_name, char *font_name)
280 xmlDocPtr doc = NULL;
281 xmlNodePtr cur = NULL;
282 xmlNodePtr cur2 = NULL;
283 xmlNodePtr cur3 = NULL;
286 doc = xmlParseFile(doc_name);
288 cur = xmlDocGetRootElement(doc);
296 if(xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
302 cur = cur->xmlChildrenNode;
304 Eina_Bool is_changed = EINA_FALSE;
307 if((!xmlStrcmp(cur->name, (const xmlChar *)"match")))
309 cur2 = cur->xmlChildrenNode;
312 if((!xmlStrcmp(cur2->name, (const xmlChar *)"edit")))
314 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
315 /* if name is not 'family', break */
316 if (xmlStrcmp(name, (const xmlChar *)"family"))
325 cur3 = cur2->xmlChildrenNode;
328 if((!xmlStrcmp(cur3->name, (const xmlChar *)"string")))
330 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
331 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
334 is_changed = EINA_TRUE;
341 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias")))
343 cur2 = cur->xmlChildrenNode;
346 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family")))
348 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
349 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
352 is_changed = EINA_TRUE;
353 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer")))
355 cur3 = cur2->xmlChildrenNode;
358 if((!xmlStrcmp(cur3->name, (const xmlChar *)"family")))
360 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
361 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
364 is_changed = EINA_TRUE;
366 break; /* just set first element, so break */
386 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
388 char* font_name = NULL;
389 font_name = (char*)value;
391 font_config_set(font_name);
392 font_config_set_notification();
395 vconf_value = (char*)value;
396 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
397 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
400 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
402 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
407 return SYSTEM_SETTINGS_ERROR_NONE;
410 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
413 vconf_value = (bool*)value;
414 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
415 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
417 return SYSTEM_SETTINGS_ERROR_NONE;
420 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
423 vconf_value = (bool*)value;
424 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
425 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
427 return SYSTEM_SETTINGS_ERROR_NONE;
431 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
434 vconf_value = (bool*)value;
435 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
436 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
438 return SYSTEM_SETTINGS_ERROR_NONE;
441 /////////////////////////////////////////////////////////////////////////////////////////////////
444 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
446 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
449 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
451 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
454 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
456 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
459 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
461 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, 0);
464 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
466 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
469 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
471 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
474 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
476 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET,SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
479 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
481 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
484 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
486 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE,SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
489 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
491 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
494 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
496 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL,SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
499 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
501 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
504 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
506 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE,SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1,user_data);
509 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
511 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
516 * @todo need to add custom event notification method
518 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
520 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME,SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
523 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
525 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME,2);
528 // TODO : 2th argument, callback, is not in use.
529 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
531 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data );
534 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
536 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
539 static char* _get_cur_font()
541 xmlDocPtr doc = NULL;
542 xmlNodePtr cur = NULL;
543 xmlNodePtr cur2 = NULL;
544 xmlNodePtr cur3 = NULL;
547 char *font_name = NULL;
549 doc = xmlParseFile(SETTING_FONT_CONF_FILE);
551 cur = xmlDocGetRootElement(doc);
559 if(xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
565 cur = cur->xmlChildrenNode;
569 if((!xmlStrcmp(cur->name, (const xmlChar *)"match")))
571 cur2 = cur->xmlChildrenNode;
574 if((!xmlStrcmp(cur2->name, (const xmlChar *)"edit")))
576 cur3 = cur2->xmlChildrenNode;
579 if((!xmlStrcmp(cur3->name, (const xmlChar *)"string")))
581 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
583 font_name = g_strdup((char *)key);
604 static void font_config_set_notification()
607 Ecore_X_Window ecore_win = ecore_x_window_root_first_get();
608 Ecore_X_Atom atom = ecore_x_atom_get("FONT_TYPE_change");
609 ecore_x_window_prop_string_set(ecore_win, atom, "tizen");
612 static void font_config_set(char *font_name)
614 Eina_List *text_classes = NULL;
615 Elm_Text_Class *etc = NULL;
616 const Eina_List *l = NULL;
617 Eina_List *fo_list = NULL;
618 Elm_Font_Overlay *efo = NULL;
619 int font_size = __font_size_get();
622 text_classes = elm_config_text_classes_list_get();
624 fo_list = (Eina_List *)elm_config_font_overlay_list_get();
626 Eina_List *ll = NULL;
627 Eina_List *l_next = NULL;
629 Eina_Bool slp_medium_exist = EINA_FALSE;
630 Eina_Bool slp_roman_exist = EINA_FALSE;
631 Eina_Bool slp_bold_exist = EINA_FALSE;
632 Eina_Bool slp_regular_exist = EINA_FALSE;
635 Eina_Bool tizen_exist = EINA_FALSE;
637 EINA_LIST_FOREACH_SAFE(fo_list, ll, l_next, efo)
639 if (!strcmp(efo->text_class, "tizen_medium")) {
640 elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
641 slp_medium_exist = EINA_TRUE;
642 } else if (!strcmp(efo->text_class, "tizen_roman")) {
643 elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
644 slp_roman_exist = EINA_TRUE;
645 } else if (!strcmp(efo->text_class, "tizen_bold")) {
646 elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
647 slp_bold_exist = EINA_TRUE;
648 } else if (!strcmp(efo->text_class, "tizen_regular")) {
649 elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
650 slp_regular_exist = EINA_TRUE;
654 if (!strcmp(efo->text_class, "tizen")) {
655 elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
656 tizen_exist = EINA_TRUE;
661 /* if slp_XX do not exist, need to set them, font size is -100(100%) */
662 if (slp_medium_exist == EINA_FALSE) {
663 elm_config_font_overlay_set("tizen_medium", (const char*)font_name, MIDDLE_FONT_DPI);
665 if (slp_roman_exist == EINA_FALSE) {
666 elm_config_font_overlay_set("tizen_roman", (const char*)font_name, MIDDLE_FONT_DPI);
668 if (slp_bold_exist == EINA_FALSE) {
669 elm_config_font_overlay_set("tizen_bold", (const char*)font_name, MIDDLE_FONT_DPI);
671 if (slp_regular_exist == EINA_FALSE) {
672 elm_config_font_overlay_set("tizen_regular", (const char*)font_name, MIDDLE_FONT_DPI);
676 if (tizen_exist == EINA_FALSE) {
677 elm_config_font_overlay_set("tizen", (const char*)font_name, MIDDLE_FONT_DPI);
680 elm_config_font_overlay_set("tizen", (const char*)font_name, MIDDLE_FONT_DPI);
683 elm_config_font_overlay_set("tizen", (const char*)font_name, MIDDLE_FONT_DPI);
685 EINA_LIST_FOREACH(text_classes, l, etc)
690 EINA_LIST_FOREACH(fo_list, ll, efo)
692 if (!strcmp(etc->name, efo->text_class)) {
696 elm_config_font_overlay_set(etc->name, (const char*)font_name, size);
699 elm_config_font_overlay_apply();
700 elm_config_all_flush();
701 // elm_config_engine_set("software_x11");
703 elm_config_text_classes_list_free(text_classes);
707 vconf_set_str(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, font_name);
710 static void __font_size_set()
712 Eina_List *text_classes = NULL;
713 Elm_Text_Class *etc = NULL;
714 const Eina_List *l = NULL;
715 int font_size = __font_size_get();
716 char *font_name = _get_cur_font();
718 if (font_size == -1) {
722 text_classes = elm_config_text_classes_list_get();
724 EINA_LIST_FOREACH(text_classes, l, etc)
726 elm_config_font_overlay_set(etc->name, font_name, font_size);
729 elm_config_font_overlay_apply();
730 elm_config_all_flush();
732 elm_config_text_classes_list_free(text_classes);
737 static int __font_size_get()
742 int vconf_value = -1;
743 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
747 switch(vconf_value) {
748 case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
749 font_size = SMALL_FONT_DPI;
751 case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
752 font_size = MIDDLE_FONT_DPI;
754 case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
755 font_size = LARGE_FONT_DPI;
757 case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
758 font_size = HUGE_FONT_DPI;
760 case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
761 font_size = GIANT_FONT_DPI;
764 font_size = MIDDLE_FONT_DPI;