I'm on it. Thanks for letting me know. If I don't fix it in the next 
24hrs please open a task.

I have no idea why it happens, could be interesting. But anyhow, 
unrelated, doing what you do is bad and can fail in many cases. The best 
thing to do is to create a text object per line and aligning them 
according to the line geometry.

--
Tom.

On 12/08/13 16:30, ChunEon Park wrote:
> Tom.
>
> After this commit, enventor text editor  works incorrectly.
>
> As you can see , enventor uses 2 textblocks, one for line number and the 
> other one is for edc editor.
> But both line height is not exactly same even if they uses the same styles.
>
> Could you please review your fixes again based on the enventor?
>
> whenever types the "enter" to increase the line.
> you will see the entry cursor is jumped twice to be positioned.
>
>
> ------------------------------------
> -Regards, Hermet-
>
> -----Original Message-----
> From: "Tom Hacohen - Enlightenment Git"<no-re...@enlightenment.org>
> To: <enlightenment-...@lists.sourceforge.net>;
> Cc:
> Sent: 2013-08-06 (화) 17:30:20
> Subject: [EGIT] [core/efl] master 01/01: Evas textblock: Use max 
> ascent/descent at the edges of the textblock.
>
> tasn pushed a commit to branch master.
>
> commit 6583b83c7304dcc1cb3f6c869ba1a391770b677c
> Author: Tom Hacohen <tom>@stosb.com>
> Date:   Tue Aug 6 09:28:38 2013 +0100
>
>      Evas textblock: Use max ascent/descent at the edges of the textblock.
>
>      Thanks to Youngbok Shin for reporting the difference in behaviour between
>      textblock and text object.
> ---
>   src/lib/evas/canvas/evas_object_textblock.c  63 
> +++++++++++++++++++++--------
>   src/tests/evas/evas_test_textblock.c          4 +-
>   2 files changed, 49 insertions(+), 18 deletions(-)
>
> diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
> b/src/lib/evas/canvas/evas_object_textblock.c
> index 8f49861..ec58bf6 100644
> --- a/src/lib/evas/canvas/evas_object_textblock.c
> +++ b/src/lib/evas/canvas/evas_object_textblock.c
> @@ -2577,17 +2577,47 @@ _layout_item_ascent_descent_adjust(const Evas_Object 
> *eo_obj,
>
>      _layout_format_ascent_descent_adjust(eo_obj, maxascent, maxdescent, 
> it->format);
>
> -   if ((it->type == EVAS_TEXTBLOCK_ITEM_TEXT) &&
> -         (position == TEXTBLOCK_POSITION_START))
> +   if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
>        {
> -        int asc = 0, desc = 0;
> -        evas_common_font_ascent_descent_get((void *) it->format->font.font,
> -              &_ITEM_TEXT(it)->text_props, &asc, &desc);
> +        void *fi = _ITEM_TEXT(it)->text_props.font_instance;
> +
> +        if (position == TEXTBLOCK_POSITION_START)
> +          {
> +             int asc = 0;
> +
> +             if (fi)
> +               {
> +                  asc = evas_common_font_instance_max_ascent_get(fi);
> +               }
> +             else
> +               {
> +                  Evas_Object_Protected_Data *obj =
> +                     eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
> +                  asc = ENFN->font_max_ascent_get(ENDT, 
> it->format->font.font);
> +               }
>
> -        if (maxascent && (asc > *maxascent))
> -           *maxascent = asc;
> -        if (maxdescent && (desc < *maxdescent))
> -           *maxdescent = desc;
> +             if (maxascent && (asc > *maxascent))
> +                *maxascent = asc;
> +          }
> +        else if (position == TEXTBLOCK_POSITION_END)
> +          {
> +             int desc = 0;
> +
> +             if (fi)
> +               {
> +                  desc = evas_common_font_instance_max_descent_get(fi);
> +               }
> +             else
> +               {
> +                  Evas_Object_Protected_Data *obj =
> +                     eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
> +                  desc =
> +                     ENFN->font_max_descent_get(ENDT, it->format->font.font);
> +               }
> +
> +             if (maxdescent && (desc < *maxdescent))
> +                *maxdescent = desc;
> +          }
>        }
>   }
>
> @@ -10204,13 +10234,13 @@ static void
>   _size_native_calc_paragraph_size(const Evas_Object *eo_obj,
>         const Evas_Object_Textblock *o,
>         const Evas_Object_Textblock_Paragraph *par,
> +      Textblock_Position *position,
>         Evas_Coord *_w, Evas_Coord *_h)
>   {
>      Eina_List *i;
>      Evas_Object_Textblock_Item *it;
>      Eina_List *line_items = NULL;
>      Evas_Coord w = 0, y = 0, wmax = 0, h = 0, ascent = 0, descent = 0;
> -   Textblock_Position position = TEXTBLOCK_POSITION_START;
>
>      EINA_LIST_FOREACH(par->logical_items, i, it)
>        {
> @@ -10222,7 +10252,7 @@ _size_native_calc_paragraph_size(const Evas_Object 
> *eo_obj,
>                         _IS_PARAGRAPH_SEPARATOR(o, fi->item)))
>                  {
>                     _size_native_calc_line_finalize(eo_obj, line_items, 
> &ascent,
> -                        &descent, &w, position);
> +                        &descent, &w, *position);
>
>                     if (ascent + descent > h)
>                        h = ascent + descent;
> @@ -10232,7 +10262,7 @@ _size_native_calc_paragraph_size(const Evas_Object 
> *eo_obj,
>                        wmax = w;
>                     h = 0;
>                     ascent = descent = 0;
> -                  position = TEXTBLOCK_POSITION_ELSE;
> +                  *position = TEXTBLOCK_POSITION_ELSE;
>                     line_items = eina_list_free(line_items);
>                  }
>                else
> @@ -10242,7 +10272,7 @@ _size_native_calc_paragraph_size(const Evas_Object 
> *eo_obj,
>                      * according to the current format. */
>                     if (it && (ascent + descent == 0))
>                        _layout_item_ascent_descent_adjust(eo_obj, &ascent,
> -                           &descent, it, position);
> +                           &descent, it, *position);
>
>                     _layout_calculate_format_item_size(eo_obj, fi, &ascent,
>                           &descent, &fy, &fw, &fh);
> @@ -10251,11 +10281,11 @@ _size_native_calc_paragraph_size(const Evas_Object 
> *eo_obj,
>           else
>             {
>                _layout_item_ascent_descent_adjust(eo_obj, &ascent,
> -                   &descent, it, position);
> +                   &descent, it, *position);
>             }
>        }
>
> -   _size_native_calc_line_finalize(eo_obj, line_items, &ascent, &descent, 
> &w, position);
> +   _size_native_calc_line_finalize(eo_obj, line_items, &ascent, &descent, 
> &w, *position);
>
>      line_items = eina_list_free(line_items);
>
> @@ -10286,13 +10316,14 @@ _textblock_size_native_get(Eo *eo_obj, void *_pd, 
> va_list *list)
>        {
>           Evas_Coord wmax = 0, hmax = 0;
>           Evas_Object_Textblock_Paragraph *par;
> +        Textblock_Position position = TEXTBLOCK_POSITION_START;
>           /* We just want the layout objects to update, should probably
>            * split that. */
>           if (!o->formatted.valid) _relayout(eo_obj);
>           EINA_INLIST_FOREACH(o->paragraphs, par)
>             {
>                Evas_Coord tw, th;
> -             _size_native_calc_paragraph_size(eo_obj, o, par, &tw, &th);
> +             _size_native_calc_paragraph_size(eo_obj, o, par, &position, 
> &tw, &th);
>                if (tw > wmax)
>                   wmax = tw;
>                hmax += th;
> diff --git a/src/tests/evas/evas_test_textblock.c 
> b/src/tests/evas/evas_test_textblock.c
> index 03332b4..9e0a11c 100644
> --- a/src/tests/evas/evas_test_textblock.c
> +++ b/src/tests/evas/evas_test_textblock.c
> @@ -2616,8 +2616,8 @@ START_TEST(evas_textblock_size)
>      evas_object_textblock_size_native_get(tb, &nw, &nh);
>      fail_if((w != nw)  (h2 != nh));
>
> -   /* Two lines == double the height */
> -   fail_if(h * 2 != h2);
> +   /* Two lines != double the height */
> +   fail_if(h * 2 == h2);
>
>      evas_object_textblock_text_markup_set(tb, buf);
>
>



------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to