Page MenuHomePhabricator

[text.fit: 0 1;] in Edje for multiline Textblock part does not work properly.
Open, NormalPublic

Description

Edje is using only efl_canvas_text_size_native_get() for calculation of fit option.
But, it can't handle a case for multiline textblock part.
It needs to be changed to use efl_canvas_text_size_formatted_get().
Also, the code needs to be changed to take care of ellipsis cases.

The following EDC code is a sample for multiline textblock with fit.
Even if you change min size of size_range, Edje will not shrink its size to show whole textblock.
Please, paste the following code to Enventor.

collections {

base_scale: 1.0;
group { "main";
   styles {
      style { "my_style";
         base: "font=Sans font_size=30 color=#ffffffff wrap=mixed";
      }
   }
   parts {
      textblock { "elm.text";
         desc { "default";
            text {
               style: "my_style";
               fit: 0 1;
               size: 30;
               size_range: 10 30;
               text: "Hello Tizen!!! Hello Tizen!!! Hello Tizen!!!Hello Tizen!!! Hello Tizen!!! Hello Tizen!!! Hello Tizen!!! Hello Tizen!!! Hello Tizen!!!";
            }
         }
      }
   }
}

}

id213sin created this task.Jul 13 2017, 1:10 AM

errr... if the textblock is set to min: 1 N (1min horizontally) it has to use native size as min size... because this EXPLICITLY says "make the minimum width the native width of my text content" and that means as it is defined/formatted. min: 0 1 would use formatted size vertically as min (horizontally one).

so fit is the new tag you are adding for new options here? might it not be better we EXTEND min to have 0,1 AND more values so 0 == NONE, 1 == NATIVE, 2 == FORMATTED, etc (we can have edje_cc understand the enums too).

id213sin added a comment.EditedJul 13 2017, 4:26 AM

@raster
Hmm, I didn't think about adding new options for NATIVE or FORMATTED.

I think we can follow how horizontal "fit" option is working for Textblock.
It works on pretty good logical base for singleline and multiline Textblock.
The follow EDC code is an example for horizontally "fit" Textblock.

textblock { "elm.text";
   desc { "default";
      text {
         style: "my_style";
         fit: 1 0;
         size: 30;
         size_range: 10 80;
         /* "fit" option will decide font_size as fit(?) as possible.
           * If "fit" reached end of size_range, it will just decide size.
           * Then, the logic for text.min/max calculation will figure out min/max result based on given size.
           * It actually work well. */
         min: 1 0; 
         text: "Hello Tizen!!! Hello Tizen!!! Hello Tizen!!!Hello Tizen!!! Hello Tizen!!! Hello Tizen!!! Hello Tizen!!! Hello Tizen!!! Hello Tizen!!!";
      }
   }
}

In the example, Edje will set horizontal min size based on font_size 10 which is a end value of size_range.

  1. "fit" tried to shrink or expand Textblock to fit with a given size. => font size is set as 10.
  2. "min" tried to expand part's min size according to text and given font size 10.

So, this is what I want to implement for VERTICAL case. With consideration for ellipsis.

oh sorry. forgot to reply...

ummm.... i'm not sure what you want. you want. could you draw up some sketches/examples of what you mean?

jykeon added a subscriber: jykeon.Sep 28 2017, 12:45 AM
jykeon removed a subscriber: jykeon.
bu5hm4n triaged this task as Normal priority.Jun 11 2018, 2:09 AM
zmike edited projects, added Restricted Project; removed efl.Jun 11 2018, 6:57 AM
bu5hm4n edited projects, added efl: widgets; removed Restricted Project.Jun 11 2018, 9:15 AM