2 * @defgroup Fonts Elementary Fonts
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).
12 typedef struct _Elm_Text_Class
18 typedef struct _Elm_Font_Overlay
20 const char *text_class;
25 typedef struct _Elm_Font_Properties
29 } Elm_Font_Properties;
32 * Get Elementary's list of supported text classes.
34 * @return The text classes list, with @c Elm_Text_Class blobs as data.
37 * Release the list with elm_text_classes_list_free().
39 EAPI const Eina_List *elm_text_classes_list_get(void);
42 * Free Elementary's list of supported text classes.
46 * @see elm_text_classes_list_get().
48 EAPI void elm_text_classes_list_free(const Eina_List *list);
51 * Get Elementary's list of font overlays, set with
52 * elm_font_overlay_set().
54 * @return The font overlays list, with @c Elm_Font_Overlay blobs as
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.
63 * @see elm_font_overlay_set() and elm_font_overlay_unset().
65 EAPI const Eina_List *elm_font_overlay_list_get(void);
68 * Set a font overlay for a given Elementary text class.
70 * @param text_class Text class name
71 * @param font Font name and style string
72 * @param size Font size
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().
80 EAPI void elm_font_overlay_set(const char *text_class, const char *font, Evas_Font_Size size);
83 * Unset a font overlay for a given Elementary text class.
85 * @param text_class Text class name
89 * This will bring back text elements belonging to text class
90 * @p text_class back to their default font settings.
92 EAPI void elm_font_overlay_unset(const char *text_class);
95 * Apply the changes made with elm_font_overlay_set() and
96 * elm_font_overlay_unset() on the current Elementary window.
100 * This applies all font overlays set to all objects in the UI.
102 EAPI void elm_font_overlay_apply(void);
105 * Apply the changes made with elm_font_overlay_set() and
106 * elm_font_overlay_unset() on all Elementary application windows.
110 * This applies all font overlays set to all objects in the UI.
112 // XXX: deprecate and replace with elm_config_all_flush()
113 EAPI void elm_font_overlay_all_apply(void);
116 * Translate a font (family) name string in fontconfig's font names
117 * syntax into an @c Elm_Font_Properties struct.
119 * @param font The font name and styles string
120 * @return the font properties struct
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).
128 EAPI Elm_Font_Properties *elm_font_properties_get(const char *font);
131 * Free font properties return by elm_font_properties_get().
133 * @param efp the font properties struct
137 EAPI void elm_font_properties_free(Elm_Font_Properties *efp);
140 * Translate a font name, bound to a style, into fontconfig's font names
143 * @param name The font (family) name
144 * @param style The given style (may be @c NULL)
146 * @return the font name and style string
150 * @note The reverse translation can be achived with
151 * elm_font_properties_get(), for one style only (single font
152 * instance, not family).
154 EAPI const char *elm_font_fontconfig_name_get(const char *name, const char *style);
157 * Free the font string return by elm_font_fontconfig_name_get().
159 * @param name the font properties struct
163 EAPI void elm_font_fontconfig_name_free(const char *name);
166 * Create a font hash table of available system fonts.
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.
172 * @param list The list of available system fonts, as returned by
173 * evas_font_available_list().
174 * @return the font hash.
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.
182 EAPI Eina_Hash *elm_font_available_hash_add(Eina_List *list);
185 * Free the hash return by elm_font_available_hash_add().
187 * @param hash the hash to be freed.
191 EAPI void elm_font_available_hash_del(Eina_Hash *hash);