Page MenuHomePhabricator

How to apply font, font_size, text color and etc to efl_ui_text according to its theme?
Open, HighPublic

Description

"efl_ui_text" have two main parts.
And here is difference between the both parts.

  1. "elm.text" swallow - main text => Have hard coded default font, font size, color. It can't changed by theme. But, it can be managed by text interface without efl_part() function calls.
  1. "elm.guide" textblock - guide text. => All text properties are managed by Edje. It can be(or will be?) managed by text interface with efl_part() function calls.

Problems

  1. "elm.text" Text properties can't be managed by theme.
  1. Even if we create a way to change text properties on "elm.text", it is confusing to use. Because of different way to change text properties of the both parts. But, if solution can be simple and pretty for "elm.text", it does not matter.

(NEW) 3. In legacy theme, font / text color could be changed according to state changes. (By listening event signals: focused, unfocused, diabled ...)
All these stuff could be applied in EDC with some programs and descriptions of states.
For, efl_ui_text, do we need to change font properties from each smart event callbacks?

id213sin created this task.Jan 29 2018, 1:50 AM
id213sin updated the task description. (Show Details)Jan 29 2018, 1:57 AM

Hi,

Defaults

Regarding default font, size and color, I have been meaning to do something similar to the following:
https://git.enlightenment.org/core/efl.git/tree/data/elementary/themes/edc/elm/code.edc

It uses

data {
   item: "font.name" "Mono";
   item: "font.size" "10";
}

When the theme is applied, this data can be read and applied on the Ui.Text object. The same can be done for another "guide text" swallow part.

For overriding the text during runtime, the overrides need to be stored and reapplied in the cases that the theme is reapplied during runtime (e.g. if it changes) - so need a bit extra storage for the defaults.

efl_part

In order to support the guide text, Ui.Text needs to override efl_part calls to the "text" and "guide text" objects, and implement the required Efl.Text.* API redirecting calls.

We will require:

  • EFL_PART_OVERRIDE definition for ui_text
  • An efl_ui_text_part.eo class that will override the Efl.Text.* APIs The implementation will resolve the respective object (main text or guide text)

@id213sin, does this sound ok to you?

id213sin updated the task description. (Show Details)Jan 29 2018, 10:31 PM

@herdsman

data {

item: "font.name" "Mono";
item: "font.size" "10";

}

When the theme is applied, this data can be read and applied on the Ui.Text object. The same can be done for another "guide text" swallow part.

Can we apply it without (NEW) #3 problem? In Tizen, we have different colors for focused, unfocused (default), disabled on both text parts.

In order to support the guide text, Ui.Text needs to override efl_part calls to the "text" and "guide text" objects, and implement the required Efl.Text.* API redirecting calls.

Actually, I hoped a common way to use/modify text/font properties across of whole widgets which have text parts. (ex: entry, check, radio, popup, list item and etc ...)
For example, calling efl_text_* interfaces on a widget, it changes main text part which is already implemented in EDC as a Textblock part.
And other text parts can be changed by calling efl_text_* with efl_part.
For now, it seems like that efl_ui_text have been managed in unique way. Or are you planning to change all text parts with same way of efl_ui_text?

Sorry for expanding topic to whole widgets. :(

@herdsman

data {

item: "font.name" "Mono";
item: "font.size" "10";

}

When the theme is applied, this data can be read and applied on the Ui.Text object. The same can be done for another "guide text" swallow part.

Can we apply it without (NEW) #3 problem? In Tizen, we have different colors for focused, unfocused (default), disabled on both text parts.

data {
   item: "font.name_focused" "Mono";
   item: "font.size_focused" "10";
   item: "font.color_focused" "#fff";

   item: "font.name_unfocused" "Mono";
   item: "font.size_unfocused" "10";
   item: "font.color_unfocused" "#252525ff";

   item: "font.name_unfocused" "Mono";
   item: "font.size_unfocused" "10";
   item: "font.color_disabled" "#181818ff";

   item: "font.name_guide_focused" "Mono";
   item: "font.size_guide_focused" "10";
   item: "font.color_guide_focused" "#fff";

...
}

The widget will update the color according to its state (keep track via callbacks).

In order to support the guide text, Ui.Text needs to override efl_part calls to the "text" and "guide text" objects, and implement the required Efl.Text.* API redirecting calls.

Actually, I hoped a common way to use/modify text/font properties across of whole widgets which have text parts. (ex: entry, check, radio, popup, list item and etc ...)
For example, calling efl_text_* interfaces on a widget, it changes main text part which is already implemented in EDC as a Textblock part.
And other text parts can be changed by calling efl_text_* with efl_part.
For now, it seems like that efl_ui_text have been managed in unique way. Or are you planning to change all text parts with same way of efl_ui_text?

Sorry for expanding topic to whole widgets. :(

Actually, I hoped a common way to use/modify text/font properties across of whole widgets which have text parts. (ex: entry, check, radio, popup, list item and etc ...)
For example, calling efl_text_* interfaces on a widget, it changes main text part which is already implemented in EDC as a Textblock part.
And other text parts can be changed by calling efl_text_* with efl_part.
For now, it seems like that efl_ui_text have been managed in unique way. Or are you planning to change all text parts with same way of efl_ui_text?

Ui Text is missing this feature but will support it. Whether there is an underlying TEXTBLOCK edje part or something else shouldn't affect the way the user manipulates the widget. The part logic will route the calls to the appropriate places.

Though, I feel I may have not understand your question..

bu5hm4n added a project: Restricted Project.Jun 11 2018, 1:35 AM
bu5hm4n triaged this task as High priority.
zmike edited projects, added Restricted Project; removed efl.Jun 11 2018, 6:53 AM
bu5hm4n edited projects, added efl: widgets; removed Restricted Project.Jun 11 2018, 9:10 AM
zmike edited projects, added efl: docs; removed efl (efl-1.21), Restricted Project.Jun 15 2018, 7:26 AM