Font Setting
Tizen provides various methods for setting fonts of the application text. Basically, all UI components have a default font, which can be changed according to the system settings.
The font handling methods include:
- Setting the font for a UI component using the Elementary Fonts API (in mobile and wearable applications)
- Setting the font using EDC
- Changing the font and text size using the Edje Class: Text API (in mobile and wearable applications)
In the application, you can set a system-wide font and font size to text(textblock) parts with text classes (except tizen). When the system applies a new system-wide font and font size to the application, the font size of text(textblock) parts with the tizen text class are not affected.
The following words in the text_class definition are reserved for the system:
- button
- label
- entry
- title_bar
- list_item
- grid_item
- toolbar_item
- menu_item
- tizen
Set a specific ratio to a given font size for each object through the text class. If you give a negative value as font size, it is used as the percentage of the originally given font size. The following example code show set the font size as 150% of the given font size.
elm_config_font_overlay_set("my_class", "TizenSans:style=Bold", -150); elm_config_font_overlay_apply();
Applying System Font Settings
Tizen provides a special "Tizen" font name. The "Tizen" font name does not match with any specific font; it is just an alias for a system-defined font (system font). When you create a text(textblock) part with the "Tizen" font name in the application's EDC, the system font is loaded into the user application when those objects are created. Additionally, you can apply the system font to a text or textblock part by using the text class, as described above.
The following EDC example shows how to apply the system font to a TEXT or TEXTBLOCK part by using the "Tizen" font name and the tizen text class. As font name is "Tizen" and the font size is set to 36, the system font is loaded in size 36. If the system setting changes, this part loads the new system font. However, its font size is not changed, because the text class is tizen.
description { text { font: "Tizen:style=Regular"; font_size: 36; text_class: "tizen"; } }
If the part has a predefined text classes other than tizen, its font size is resized as well.
description { text { font: "Tizen:style=Regular"; font_size: 36; text_class: "label"; } }
Supported Font Styles
The font styles supported by the EFL are listed in the following table.
Font feature | Style attribute |
---|---|
font_style | normal |
oblique | |
italic | |
font_width | normal |
ultracondensed | |
extracondensed | |
condensed | |
semicondensed | |
semiexpanded | |
expanded | |
extraexpanded | |
ultraexpanded | |
font_weight | normal |
thin | |
ultralight | |
light | |
book | |
medium | |
semibold | |
bold | |
ultrabold | |
black | |
extrablack |
The style attributes are not case-sensitive (however, the font feature names are).
If you set the weight or width attribute to style=, it is processed to the right attribute.
font=TizenSans:style=Bold // Textblock "TizenSans:style=Bold"; // Text font <font=TizenSans:style=Bold> // Markup tag
You can also use each attribute separately:
font=TizenSans font_style=Regular font_weight=Bold // Textblock <font=TizenSans font_style=Regular font_weight=Bold> // Markup tag