summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-01-29 14:36:02 +0000
committerTom Hacohen <tom@stosb.com>2014-01-29 14:36:22 +0000
commit19cde8f194457aa0d8fb422356db8a6cbc54bde0 (patch)
treefb9867c5ddc118a87418876e204f7070516964d7 /src
parent2cb9db171ead5bc9920234e27c2e12b7c7b3883a (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_font_dir.c23
-rw-r--r--src/lib/evas/include/evas_private.h10
2 files changed, 32 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_font_dir.c b/src/lib/evas/canvas/evas_font_dir.c
index 51db3ad051..37ea7bf5b1 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[] =
290}; 290};
291# endif 291# endif
292 292
293static int _fc_spacing_map[] =
294{
295 FC_PROPORTIONAL,
296 FC_DUAL,
297 FC_MONO,
298 FC_CHARCELL
299};
300
293#endif 301#endif
294 302
295struct _Style_Map 303struct _Style_Map
@@ -334,6 +342,14 @@ static Style_Map _style_slant_map[] =
334 {"italic", EVAS_FONT_SLANT_ITALIC} 342 {"italic", EVAS_FONT_SLANT_ITALIC}
335}; 343};
336 344
345static Style_Map _style_spacing_map[] =
346{
347 {"proportional", EVAS_FONT_SPACING_PROPORTIONAL},
348 {"dualwidth", EVAS_FONT_SPACING_DUAL},
349 {"monospace", EVAS_FONT_SPACING_MONO},
350 {"charcell", EVAS_FONT_SPACING_CHARCELL}
351};
352
337#define _STYLE_MAP_LEN(x) (sizeof(x) / sizeof(*(x))) 353#define _STYLE_MAP_LEN(x) (sizeof(x) / sizeof(*(x)))
338/** 354/**
339 * @internal 355 * @internal
@@ -439,7 +455,7 @@ evas_font_desc_cmp(const Evas_Font_Description *a,
439 /* FIXME: Do actual comparison, i.e less than and bigger than. */ 455 /* FIXME: Do actual comparison, i.e less than and bigger than. */
440 return !((a->name == b->name) && (a->weight == b->weight) && 456 return !((a->name == b->name) && (a->weight == b->weight) &&
441 (a->slant == b->slant) && (a->width == b->width) && 457 (a->slant == b->slant) && (a->width == b->width) &&
442 (a->lang == b->lang)); 458 (a->spacing == b->spacing) && (a->lang == b->lang));
443} 459}
444 460
445void 461void
@@ -483,6 +499,10 @@ evas_font_name_parse(Evas_Font_Description *fdesc, const char *name)
483 else if (!strncmp(name, ":width=", 7)) 499 else if (!strncmp(name, ":width=", 7))
484 { 500 {
485 _SET_STYLE(width); 501 _SET_STYLE(width);
502 }
503 else if (!strncmp(name, ":spacing=", 9))
504 {
505 _SET_STYLE(spacing);
486#undef _SET_STYLE 506#undef _SET_STYLE
487 } 507 }
488 else if (!strncmp(name, ":lang=", 6)) 508 else if (!strncmp(name, ":lang=", 6))
@@ -715,6 +735,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
715 p_nm = FcPatternBuild (NULL, 735 p_nm = FcPatternBuild (NULL,
716 FC_WEIGHT, FcTypeInteger, _fc_weight_map[fdesc->weight], 736 FC_WEIGHT, FcTypeInteger, _fc_weight_map[fdesc->weight],
717 FC_SLANT, FcTypeInteger, _fc_slant_map[fdesc->slant], 737 FC_SLANT, FcTypeInteger, _fc_slant_map[fdesc->slant],
738 FC_SPACING, FcTypeInteger, _fc_spacing_map[fdesc->spacing],
718#ifdef FC_WIDTH 739#ifdef FC_WIDTH
719 FC_WIDTH, FcTypeInteger, _fc_width_map[fdesc->width], 740 FC_WIDTH, FcTypeInteger, _fc_width_map[fdesc->width],
720#endif 741#endif
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index a3cc06be60..95dd24983e 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
92 EVAS_FONT_WIDTH_ULTRAEXPANDED 92 EVAS_FONT_WIDTH_ULTRAEXPANDED
93}; 93};
94 94
95enum _Evas_Font_Spacing
96{
97 EVAS_FONT_SPACING_PROPORTIONAL,
98 EVAS_FONT_SPACING_DUAL,
99 EVAS_FONT_SPACING_MONO,
100 EVAS_FONT_SPACING_CHARCELL
101};
102
95typedef enum _Evas_Font_Style Evas_Font_Style; 103typedef enum _Evas_Font_Style Evas_Font_Style;
96typedef enum _Evas_Font_Slant Evas_Font_Slant; 104typedef enum _Evas_Font_Slant Evas_Font_Slant;
97typedef enum _Evas_Font_Weight Evas_Font_Weight; 105typedef enum _Evas_Font_Weight Evas_Font_Weight;
98typedef enum _Evas_Font_Width Evas_Font_Width; 106typedef enum _Evas_Font_Width Evas_Font_Width;
107typedef enum _Evas_Font_Spacing Evas_Font_Spacing;
99 108
100/* General types - used for script type chceking */ 109/* General types - used for script type chceking */
101#define OPAQUE_TYPE(type) struct __##type { int a; }; \ 110#define OPAQUE_TYPE(type) struct __##type { int a; }; \
@@ -713,6 +722,7 @@ struct _Evas_Font_Description
713 Evas_Font_Slant slant; 722 Evas_Font_Slant slant;
714 Evas_Font_Weight weight; 723 Evas_Font_Weight weight;
715 Evas_Font_Width width; 724 Evas_Font_Width width;
725 Evas_Font_Spacing spacing;
716 726
717 Eina_Bool is_new : 1; 727 Eina_Bool is_new : 1;
718}; 728};