tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=19cde8f194457aa0d8fb422356db8a6cbc54bde0

commit 19cde8f194457aa0d8fb422356db8a6cbc54bde0
Author: Tom Hacohen <[email protected]>
Date:   Wed Jan 29 14:36:02 2014 +0000

    Evas font: Added support for the freetype spacing tag.
    
    This doesn't work nicely, as for some reason fontconfig doesn't work
    nicely with ':spacing=mono' without a font name.
    Doesn't work with fc-match either. It does work with fc-list, but that's
    not what we'd like to use. It could be just an issue with my local
    fontconfig configuration.
    
    This fixes T865 although the problem is now with freetype.
---
 src/lib/evas/canvas/evas_font_dir.c | 23 ++++++++++++++++++++++-
 src/lib/evas/include/evas_private.h | 10 ++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_font_dir.c 
b/src/lib/evas/canvas/evas_font_dir.c
index 51db3ad..37ea7bf 100644
--- a/src/lib/evas/canvas/evas_font_dir.c
+++ b/src/lib/evas/canvas/evas_font_dir.c
@@ -290,6 +290,14 @@ static int _fc_width_map[] =
 };
 # endif
 
+static int _fc_spacing_map[] =
+{
+   FC_PROPORTIONAL,
+   FC_DUAL,
+   FC_MONO,
+   FC_CHARCELL
+};
+
 #endif
 
 struct _Style_Map
@@ -334,6 +342,14 @@ static Style_Map _style_slant_map[] =
      {"italic", EVAS_FONT_SLANT_ITALIC}
 };
 
+static Style_Map _style_spacing_map[] =
+{
+     {"proportional", EVAS_FONT_SPACING_PROPORTIONAL},
+     {"dualwidth", EVAS_FONT_SPACING_DUAL},
+     {"monospace", EVAS_FONT_SPACING_MONO},
+     {"charcell", EVAS_FONT_SPACING_CHARCELL}
+};
+
 #define _STYLE_MAP_LEN(x) (sizeof(x) / sizeof(*(x)))
 /**
  * @internal
@@ -439,7 +455,7 @@ evas_font_desc_cmp(const Evas_Font_Description *a,
    /* FIXME: Do actual comparison, i.e less than and bigger than. */
    return !((a->name == b->name) && (a->weight == b->weight) &&
          (a->slant == b->slant) && (a->width == b->width) &&
-         (a->lang == b->lang));
+         (a->spacing == b->spacing) && (a->lang == b->lang));
 }
 
 void
@@ -483,6 +499,10 @@ evas_font_name_parse(Evas_Font_Description *fdesc, const 
char *name)
         else if (!strncmp(name, ":width=", 7))
           {
              _SET_STYLE(width);
+          }
+        else if (!strncmp(name, ":spacing=", 9))
+          {
+             _SET_STYLE(spacing);
 #undef _SET_STYLE
           }
         else if (!strncmp(name, ":lang=", 6))
@@ -715,6 +735,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, 
const char *source,
         p_nm = FcPatternBuild (NULL,
               FC_WEIGHT, FcTypeInteger, _fc_weight_map[fdesc->weight],
               FC_SLANT,  FcTypeInteger, _fc_slant_map[fdesc->slant],
+              FC_SPACING,  FcTypeInteger, _fc_spacing_map[fdesc->spacing],
 #ifdef FC_WIDTH
               FC_WIDTH,  FcTypeInteger, _fc_width_map[fdesc->width],
 #endif
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index a3cc06b..95dd249 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -92,10 +92,19 @@ enum _Evas_Font_Width
    EVAS_FONT_WIDTH_ULTRAEXPANDED
 };
 
+enum _Evas_Font_Spacing
+{
+   EVAS_FONT_SPACING_PROPORTIONAL,
+   EVAS_FONT_SPACING_DUAL,
+   EVAS_FONT_SPACING_MONO,
+   EVAS_FONT_SPACING_CHARCELL
+};
+
 typedef enum _Evas_Font_Style               Evas_Font_Style;
 typedef enum _Evas_Font_Slant               Evas_Font_Slant;
 typedef enum _Evas_Font_Weight              Evas_Font_Weight;
 typedef enum _Evas_Font_Width               Evas_Font_Width;
+typedef enum _Evas_Font_Spacing             Evas_Font_Spacing;
 
 /* General types - used for script type chceking */
 #define OPAQUE_TYPE(type) struct __##type { int a; }; \
@@ -713,6 +722,7 @@ struct _Evas_Font_Description
    Evas_Font_Slant slant;
    Evas_Font_Weight weight;
    Evas_Font_Width width;
+   Evas_Font_Spacing spacing;
 
    Eina_Bool is_new : 1;
 };

-- 


Reply via email to