Canvas text: favor font name parsing over set properties
authorDaniel Hirt <hirt.danny@gmail.com>
Sun, 8 Oct 2017 11:00:24 +0000 (14:00 +0300)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 10 Nov 2017 18:29:27 +0000 (10:29 -0800)
Since font names can also specify styles like weight, width etc, we
should parse the font name AFTER setting the respective properties to
the font description, so it can override some if required.

This allows, for example, the following operation:

efl_text_font_weight_set(obj, EFL_TEXT_FONT_WEIGHT_NORMAL);
efl_text_font_set(obj, "Sans:Bold");

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/evas/canvas/evas_object_textblock.c

index 0b375e4..251d1ad 100644 (file)
@@ -3385,7 +3385,6 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
                }
              fmt->font.fdesc = evas_font_desc_new();
 
-             evas_font_name_parse(fmt->font.fdesc, _FMT_INFO(font));
              eina_stringshare_replace(&(fmt->font.fdesc->lang),
                    evas_font_lang_normalize("auto"));
              eina_stringshare_replace(&(fmt->font.fdesc->fallbacks),
@@ -3396,6 +3395,7 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
              fmt->font.fdesc->slant = _FMT_INFO(font_slant);
              fmt->font.fdesc->width = _FMT_INFO(font_width);
              fmt->font.fdesc->lang = _FMT_INFO(font_lang);
+             evas_font_name_parse(fmt->font.fdesc, _FMT_INFO(font));
              fmt->font.font = evas_font_load(evas_obj->layer->evas->font_path,
                                              evas_obj->layer->evas->hinting,
                                              fmt->font.fdesc,