raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2ce33e73a7d48d4b54a075c07f12c0162972f350

commit 2ce33e73a7d48d4b54a075c07f12c0162972f350
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Tue Jun 28 10:49:37 2016 +0900

    evas: add pattern "style" when evas query fonts via fontconfig
    
    Summary:
    Some fonts can have weird style and weight value.
    If a font has a style name as "medium" and a weight value as "semi-bold",
    Evas can't load the font using "font=Somefont:style=Medium".
    It only can be load with "font=Somefont:style=SemiBold" or
    "font=Somefont:weight=SemiBold".
    On the other hand, it could be loaded when I tested the following commands.
    fc-match -s ":family=Somefont:style=Medium" or
    fc-match -s ":family=Somefont:weight=SemiBold"
    
    Evas also should load font based on font's style name.
    @fix
    
    Test Plan: N/A
    
    Reviewers: tasn, herdsman, cedric, woohyun, raster
    
    Reviewed By: raster
    
    Subscribers: Blackmole, z-wony, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D4108
---
 src/lib/evas/canvas/evas_font_dir.c | 5 +++++
 src/lib/evas/include/evas_private.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/lib/evas/canvas/evas_font_dir.c 
b/src/lib/evas/canvas/evas_font_dir.c
index 75546eb..1369dfe 100644
--- a/src/lib/evas/canvas/evas_font_dir.c
+++ b/src/lib/evas/canvas/evas_font_dir.c
@@ -420,6 +420,7 @@ evas_font_desc_unref(Evas_Font_Description *fdesc)
    if (--(fdesc->ref) == 0)
      {
         eina_stringshare_del(fdesc->name);
+        eina_stringshare_del(fdesc->style);
         eina_stringshare_del(fdesc->fallbacks);
         eina_stringshare_del(fdesc->lang);
         free(fdesc);
@@ -506,6 +507,7 @@ evas_font_name_parse(Evas_Font_Description *fdesc, const 
char *name)
 #define _SET_STYLE(x, len) \
              fdesc->x = _evas_font_style_find_internal(name + len, tend, \
                    _style_##x##_map, _STYLE_MAP_LEN(_style_##x##_map));
+             eina_stringshare_replace_length(&(fdesc->style), name + 7, tend - 
(name + 7));
              _SET_STYLE(slant, 7);
              _SET_STYLE(weight, 7);
              _SET_STYLE(width, 7);
@@ -804,6 +806,9 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, 
const char *source,
               NULL);
         FcPatternAddString (p_nm, FC_FAMILY, (FcChar8*) fdesc->name);
 
+        if (fdesc->style)
+          FcPatternAddString (p_nm, FC_STYLE, (FcChar8*) fdesc->style);
+
         /* Handle font fallbacks */
         if (fdesc->fallbacks)
           {
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index f8d3e9b..394fa58 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1211,6 +1211,7 @@ struct _Evas_Font_Description
    const char *name;
    const char *fallbacks;
    const char *lang;
+   const char *style;
 
    Evas_Font_Slant slant;
    Evas_Font_Weight weight;

-- 


Reply via email to