summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_font_dir.c
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2016-06-28 10:49:37 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-06-28 13:32:49 +0900
commit2ce33e73a7d48d4b54a075c07f12c0162972f350 (patch)
treec9f15c18e4f3a40420af7e72b0a8f8440cd930ec /src/lib/evas/canvas/evas_font_dir.c
parent4afcd8516848369d7e5f330deb91eae31c66b2c2 (diff)
downloadefl-2ce33e73a7d48d4b54a075c07f12c0162972f350.tar.gz
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
Diffstat (limited to 'src/lib/evas/canvas/evas_font_dir.c')
-rw-r--r--src/lib/evas/canvas/evas_font_dir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_font_dir.c b/src/lib/evas/canvas/evas_font_dir.c
index 75546ebf50..1369dfe267 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)
{