summaryrefslogtreecommitdiff
path: root/legacy/edje/src/lib
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2011-02-27 18:09:03 +0000
committerTom Hacohen <tom@stosb.com>2011-02-27 18:09:03 +0000
commit7bf5ba8a7bb3368d90e5e92968f29c5279b9a12d (patch)
tree175cbca4164affc5f40e0c74870f9827dfcb6214 /legacy/edje/src/lib
parent54f4d4bf2f8e1dcc40da31a3947163e0465329b4 (diff)
Edje text: Added size_range to limit the font size range.
This lets you limit the allowed sizes of the TEXT part (font sizes) to a specific range. This is especially useful in combination with the "fit" property. SVN revision: 57395
Diffstat (limited to 'legacy/edje/src/lib')
-rw-r--r--legacy/edje/src/lib/edje_data.c4
-rw-r--r--legacy/edje/src/lib/edje_private.h2
-rw-r--r--legacy/edje/src/lib/edje_text.c12
3 files changed, 16 insertions, 2 deletions
diff --git a/legacy/edje/src/lib/edje_data.c b/legacy/edje/src/lib/edje_data.c
index b10c988..23881b7 100644
--- a/legacy/edje/src/lib/edje_data.c
+++ b/legacy/edje/src/lib/edje_data.c
@@ -563,6 +563,8 @@ _edje_edd_init(void)
563 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.text_class", text.text_class, EET_T_STRING); 563 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.text_class", text.text_class, EET_T_STRING);
564 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.style", text.style, EET_T_STRING); 564 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.style", text.style, EET_T_STRING);
565 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING); 565 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
566 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size_range_min", text.size_range_min, EET_T_INT);
567 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size_range_max", text.size_range_max, EET_T_INT);
566 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING); 568 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
567 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT); 569 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
568 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR); 570 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
@@ -593,6 +595,8 @@ _edje_edd_init(void)
593 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING); 595 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
594 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING); 596 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
595 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT); 597 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
598 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size_range_min", text.size_range_min, EET_T_INT);
599 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size_range_max", text.size_range_max, EET_T_INT);
596 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR); 600 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
597 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR); 601 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR);
598 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR); 602 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR);
diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h
index 16e20e9..f2236be 100644
--- a/legacy/edje/src/lib/edje_private.h
+++ b/legacy/edje/src/lib/edje_private.h
@@ -862,6 +862,8 @@ struct _Edje_Part_Description_Spec_Text
862 unsigned char min_y; /* if text size should be part min size */ 862 unsigned char min_y; /* if text size should be part min size */
863 unsigned char max_x; /* if text size should be part max size */ 863 unsigned char max_x; /* if text size should be part max size */
864 unsigned char max_y; /* if text size should be part max size */ 864 unsigned char max_y; /* if text size should be part max size */
865 int size_range_min;
866 int size_range_max; /* -1 means, no bound. */
865}; 867};
866 868
867struct _Edje_Part_Description_Spec_Box 869struct _Edje_Part_Description_Spec_Box
diff --git a/legacy/edje/src/lib/edje_text.c b/legacy/edje/src/lib/edje_text.c
index 655288f..ba9ecb8 100644
--- a/legacy/edje/src/lib/edje_text.c
+++ b/legacy/edje/src/lib/edje_text.c
@@ -539,9 +539,17 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
539 size = current - 1; 539 size = current - 1;
540 } 540 }
541 } 541 }
542 if (size < 1) size = 1;
543 542
544 if (!chosen_desc->text.fit_x) 543 /* Make sure the size is in range */
544 if (size < 1)
545 size = 1;
546 else if ((size > chosen_desc->text.size_range_max) &&
547 (chosen_desc->text.size_range_max > 0))
548 size = chosen_desc->text.size_range_max;
549 else if (size < chosen_desc->text.size_range_min)
550 size = chosen_desc->text.size_range_min;
551
552 /* Handle ellipsis */
545 { 553 {
546 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path); 554 if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
547 else evas_object_text_font_source_set(ep->object, NULL); 555 else evas_object_text_font_source_set(ep->object, NULL);