2 # include "elementary_config.h"
9 #include <Elementary.h>
13 _elm_font_properties_get(Eina_Hash **font_hash,
16 Elm_Font_Properties *efp = NULL;
19 s1 = strchr(font, ':');
22 char *s2, *name, *style;
26 name = calloc(sizeof(char), len + 1);
27 strncpy(name, font, len);
29 /* get subname (should be english) */
30 s2 = strchr(name, ',');
34 name = realloc(name, sizeof(char) * len + 1);
35 memset(name, 0, sizeof(char) * len + 1);
36 strncpy(name, font, len);
39 if (!strncmp(s1, ELM_FONT_TOKEN_STYLE, strlen(ELM_FONT_TOKEN_STYLE)))
41 style = s1 + strlen(ELM_FONT_TOKEN_STYLE);
43 if (font_hash) efp = eina_hash_find(*font_hash, name);
46 efp = calloc(1, sizeof(Elm_Font_Properties));
47 efp->name = eina_stringshare_add(name);
51 *font_hash = eina_hash_string_superfast_new(NULL);
52 eina_hash_add(*font_hash, name, efp);
55 s2 = strchr(style, ',');
62 style = calloc(sizeof(char), len + 1);
63 strncpy(style, style_old, len);
64 efp->styles = eina_list_append(efp->styles,
65 eina_stringshare_add(style));
69 efp->styles = eina_list_append(efp->styles,
70 eina_stringshare_add(style));
76 if (font_hash) efp = eina_hash_find(*font_hash, font);
79 efp = calloc(1, sizeof(Elm_Font_Properties));
80 efp->name = eina_stringshare_add(font);
84 *font_hash = eina_hash_string_superfast_new(NULL);
85 eina_hash_add(*font_hash, font, efp);
92 /* FIXME: do we really need it? */
94 _elm_font_available_hash_add(Eina_Hash *font_hash,
95 const char *full_name)
97 _elm_font_properties_get(&font_hash, full_name);
102 _elm_font_properties_free(Elm_Font_Properties *efp)
106 EINA_LIST_FREE(efp->styles, str)
107 if (str) eina_stringshare_del(str);
109 if (efp->name) eina_stringshare_del(efp->name);
114 _font_hash_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
116 Elm_Font_Properties *efp;
119 _elm_font_properties_free(efp);
124 _elm_font_available_hash_del(Eina_Hash *hash)
126 eina_hash_foreach(hash, _font_hash_free_cb, NULL);
127 eina_hash_free(hash);