summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_font_dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas/evas_font_dir.c')
-rw-r--r--src/lib/evas/canvas/evas_font_dir.c49
1 files changed, 43 insertions, 6 deletions
diff --git a/src/lib/evas/canvas/evas_font_dir.c b/src/lib/evas/canvas/evas_font_dir.c
index 3d4c7b9..5b945dc 100644
--- a/src/lib/evas/canvas/evas_font_dir.c
+++ b/src/lib/evas/canvas/evas_font_dir.c
@@ -429,12 +429,50 @@ static Style_Map _style_spacing_map[] =
429}; 429};
430 430
431#define _STYLE_MAP_LEN(x) (sizeof(x) / sizeof(*(x))) 431#define _STYLE_MAP_LEN(x) (sizeof(x) / sizeof(*(x)))
432
433/**
434 * @internal
435 * Find the string from the map at a style
436 * @return the string at a style type
437 */
438static const char*
439_evas_font_style_find_str_internal(int type, Style_Map _map[], size_t map_len)
440{
441 size_t i;
442 for ( i = 0; i < map_len; i++ )
443 {
444 if (_map[i].type == type)
445 return _map[i].name;
446 }
447 return NULL;
448}
449
450const char*
451evas_font_style_find_str(int type, Evas_Font_Style style)
452{
453#define _RET_STYLE(x) \
454 return _evas_font_style_find_str_internal(type, \
455 _style_##x##_map, _STYLE_MAP_LEN(_style_##x##_map));
456 switch (style)
457 {
458 case EVAS_FONT_STYLE_SLANT:
459 _RET_STYLE(slant);
460 case EVAS_FONT_STYLE_WEIGHT:
461 _RET_STYLE(weight);
462 case EVAS_FONT_STYLE_WIDTH:
463 _RET_STYLE(width);
464 default:
465 return NULL;
466 }
467#undef _RET_STYLE
468}
469
432/** 470/**
433 * @internal 471 * @internal
434 * Find a certain attribute from the map in the style. 472 * Find a certain attribute from the map in the style.
435 * @return the index of the found one. 473 * @return the index of the found one.
436 */ 474 */
437static int 475static unsigned int
438_evas_font_style_find_internal(const char *style, const char *style_end, 476_evas_font_style_find_internal(const char *style, const char *style_end,
439 Style_Map _map[], size_t map_len) 477 Style_Map _map[], size_t map_len)
440{ 478{
@@ -462,7 +500,7 @@ _evas_font_style_find_internal(const char *style, const char *style_end,
462 return 0; 500 return 0;
463} 501}
464 502
465int 503unsigned int
466evas_font_style_find(const char *start, const char *end, 504evas_font_style_find(const char *start, const char *end,
467 Evas_Font_Style style) 505 Evas_Font_Style style)
468{ 506{
@@ -1264,10 +1302,9 @@ object_text_font_cache_dir_add(char *dir)
1264 char *p; 1302 char *p;
1265 1303
1266 fn->type = 0; 1304 fn->type = 0;
1267 strcpy(tmp2, file); 1305 p = strrchr(file, '.');
1268 p = strrchr(tmp2, '.'); 1306 if (p) fn->simple.name = eina_stringshare_add_length(file, p - file);
1269 if (p) *p = 0; 1307 else fn->simple.name = eina_stringshare_add(file);
1270 fn->simple.name = eina_stringshare_add(tmp2);
1271 eina_file_path_join(tmp2, PATH_MAX, dir, file); 1308 eina_file_path_join(tmp2, PATH_MAX, dir, file);
1272 fn->path = eina_stringshare_add(tmp2); 1309 fn->path = eina_stringshare_add(tmp2);
1273 fd->fonts = eina_list_append(fd->fonts, fn); 1310 fd->fonts = eina_list_append(fd->fonts, fn);