Merge "gengrid TC modified"
[framework/uifw/elementary.git] / tests / debian / libelm-dev / usr / include / elementary-0 / elm_fonts.h
1 /**
2  * @defgroup Fonts Elementary Fonts
3  *
4  * These are functions dealing with font rendering, selection and the
5  * like for Elementary applications. One might fetch which system
6  * fonts are there to use and set custom fonts for individual classes
7  * of UI items containing text (text classes).
8  *
9  * @{
10  */
11
12 typedef struct _Elm_Text_Class
13 {
14    const char *name;
15    const char *desc;
16 } Elm_Text_Class;
17
18 typedef struct _Elm_Font_Overlay
19 {
20    const char    *text_class;
21    const char    *font;
22    Evas_Font_Size size;
23 } Elm_Font_Overlay;
24
25 typedef struct _Elm_Font_Properties
26 {
27    const char *name;
28    Eina_List  *styles;
29 } Elm_Font_Properties;
30
31 /**
32  * Get Elementary's list of supported text classes.
33  *
34  * @return The text classes list, with @c Elm_Text_Class blobs as data.
35  * @ingroup Fonts
36  *
37  * Release the list with elm_text_classes_list_free().
38  */
39 EAPI const Eina_List *elm_text_classes_list_get(void);
40
41 /**
42  * Free Elementary's list of supported text classes.
43  *
44  * @ingroup Fonts
45  *
46  * @see elm_text_classes_list_get().
47  */
48 EAPI void             elm_text_classes_list_free(const Eina_List *list);
49
50 /**
51  * Get Elementary's list of font overlays, set with
52  * elm_font_overlay_set().
53  *
54  * @return The font overlays list, with @c Elm_Font_Overlay blobs as
55  * data.
56  *
57  * @ingroup Fonts
58  *
59  * For each text class, one can set a <b>font overlay</b> for it,
60  * overriding the default font properties for that class coming from
61  * the theme in use. There is no need to free this list.
62  *
63  * @see elm_font_overlay_set() and elm_font_overlay_unset().
64  */
65 EAPI const Eina_List *elm_font_overlay_list_get(void);
66
67 /**
68  * Set a font overlay for a given Elementary text class.
69  *
70  * @param text_class Text class name
71  * @param font Font name and style string
72  * @param size Font size
73  *
74  * @ingroup Fonts
75  *
76  * @p font has to be in the format returned by
77  * elm_font_fontconfig_name_get(). @see elm_font_overlay_list_get()
78  * and elm_font_overlay_unset().
79  */
80 EAPI void             elm_font_overlay_set(const char *text_class, const char *font, Evas_Font_Size size);
81
82 /**
83  * Unset a font overlay for a given Elementary text class.
84  *
85  * @param text_class Text class name
86  *
87  * @ingroup Fonts
88  *
89  * This will bring back text elements belonging to text class
90  * @p text_class back to their default font settings.
91  */
92 EAPI void             elm_font_overlay_unset(const char *text_class);
93
94 /**
95  * Apply the changes made with elm_font_overlay_set() and
96  * elm_font_overlay_unset() on the current Elementary window.
97  *
98  * @ingroup Fonts
99  *
100  * This applies all font overlays set to all objects in the UI.
101  */
102 EAPI void             elm_font_overlay_apply(void);
103
104 /**
105  * Apply the changes made with elm_font_overlay_set() and
106  * elm_font_overlay_unset() on all Elementary application windows.
107  *
108  * @ingroup Fonts
109  *
110  * This applies all font overlays set to all objects in the UI.
111  */
112 // XXX: deprecate and replace with elm_config_all_flush()
113 EAPI void             elm_font_overlay_all_apply(void);
114
115 /**
116  * Translate a font (family) name string in fontconfig's font names
117  * syntax into an @c Elm_Font_Properties struct.
118  *
119  * @param font The font name and styles string
120  * @return the font properties struct
121  *
122  * @ingroup Fonts
123  *
124  * @note The reverse translation can be achived with
125  * elm_font_fontconfig_name_get(), for one style only (single font
126  * instance, not family).
127  */
128 EAPI Elm_Font_Properties *elm_font_properties_get(const char *font);
129
130 /**
131  * Free font properties return by elm_font_properties_get().
132  *
133  * @param efp the font properties struct
134  *
135  * @ingroup Fonts
136  */
137 EAPI void             elm_font_properties_free(Elm_Font_Properties *efp);
138
139 /**
140  * Translate a font name, bound to a style, into fontconfig's font names
141  * syntax.
142  *
143  * @param name The font (family) name
144  * @param style The given style (may be @c NULL)
145  *
146  * @return the font name and style string
147  *
148  * @ingroup Fonts
149  *
150  * @note The reverse translation can be achived with
151  * elm_font_properties_get(), for one style only (single font
152  * instance, not family).
153  */
154 EAPI const char      *elm_font_fontconfig_name_get(const char *name, const char *style);
155
156 /**
157  * Free the font string return by elm_font_fontconfig_name_get().
158  *
159  * @param name the font properties struct
160  *
161  * @ingroup Fonts
162  */
163 EAPI void             elm_font_fontconfig_name_free(const char *name);
164
165 /**
166  * Create a font hash table of available system fonts.
167  *
168  * One must call it with @p list being the return value of
169  * evas_font_available_list(). The hash will be indexed by font
170  * (family) names, being its values @c Elm_Font_Properties blobs.
171  *
172  * @param list The list of available system fonts, as returned by
173  * evas_font_available_list().
174  * @return the font hash.
175  *
176  * @ingroup Fonts
177  *
178  * @note The user is supposed to get it populated at least with 3
179  * default font families (Sans, Serif, Monospace), which should be
180  * present on most systems.
181  */
182 EAPI Eina_Hash       *elm_font_available_hash_add(Eina_List *list);
183
184 /**
185  * Free the hash return by elm_font_available_hash_add().
186  *
187  * @param hash the hash to be freed.
188  *
189  * @ingroup Fonts
190  */
191 EAPI void             elm_font_available_hash_del(Eina_Hash *hash);
192
193 /**
194  * @}
195  */