Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_style.c
| Show First 20 Lines • Show All 464 Lines • ▼ Show 20 Lines | void uiStyleInit(void) | ||||
| for (font = U.uifonts.first; font; font = font->next) { | for (font = U.uifonts.first; font; font = font->next) { | ||||
| if (font->uifont_id == UIFONT_DEFAULT) { | if (font->uifont_id == UIFONT_DEFAULT) { | ||||
| #ifdef WITH_INTERNATIONAL | #ifdef WITH_INTERNATIONAL | ||||
| int font_size = datatoc_bfont_ttf_size; | int font_size = datatoc_bfont_ttf_size; | ||||
| uchar *font_ttf = (uchar *)datatoc_bfont_ttf; | uchar *font_ttf = (uchar *)datatoc_bfont_ttf; | ||||
| static int last_font_size = 0; | static int last_font_size = 0; | ||||
| /* use unicode font for translation */ | /* use unicode font if available */ | ||||
| if (U.transopts & USER_DOTRANSLATE) { | |||||
| font_ttf = BLF_get_unifont(&font_size); | font_ttf = BLF_get_unifont(&font_size); | ||||
| if (!font_ttf) { | if (!font_ttf) { | ||||
| /* fall back if not found */ | /* fall back if not found */ | ||||
| font_size = datatoc_bfont_ttf_size; | font_size = datatoc_bfont_ttf_size; | ||||
| font_ttf = (uchar *)datatoc_bfont_ttf; | font_ttf = (uchar *)datatoc_bfont_ttf; | ||||
| } | } | ||||
| } | |||||
| /* relload only if needed */ | /* relload only if needed */ | ||||
| if (last_font_size != font_size) { | if (last_font_size != font_size) { | ||||
| BLF_unload("default"); | BLF_unload("default"); | ||||
| last_font_size = font_size; | last_font_size = font_size; | ||||
| } | } | ||||
| font->blf_id = BLF_load_mem("default", font_ttf, font_size); | font->blf_id = BLF_load_mem("default", font_ttf, font_size); | ||||
| Show All 27 Lines | #endif | ||||
| } | } | ||||
| if (style == NULL) { | if (style == NULL) { | ||||
| ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT); | ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT); | ||||
| } | } | ||||
| #ifdef WITH_INTERNATIONAL | #ifdef WITH_INTERNATIONAL | ||||
| /* use unicode font for text editor and interactive console */ | /* use unicode font for text editor and interactive console */ | ||||
| if (U.transopts & USER_DOTRANSLATE) { | |||||
| monofont_ttf = BLF_get_unifont_mono(&monofont_size); | monofont_ttf = BLF_get_unifont_mono(&monofont_size); | ||||
| if (!monofont_ttf) { | if (!monofont_ttf) { | ||||
| /* fall back if not found */ | /* fall back if not found */ | ||||
| monofont_size = datatoc_bmonofont_ttf_size; | monofont_size = datatoc_bmonofont_ttf_size; | ||||
| monofont_ttf = (uchar *)datatoc_bmonofont_ttf; | monofont_ttf = (uchar *)datatoc_bmonofont_ttf; | ||||
| } | } | ||||
| } | |||||
| #endif | #endif | ||||
| /* XXX, this should be moved into a style, | /* XXX, this should be moved into a style, | ||||
| * but for now best only load the monospaced font once. */ | * but for now best only load the monospaced font once. */ | ||||
| BLI_assert(blf_mono_font == -1); | BLI_assert(blf_mono_font == -1); | ||||
| if (U.font_path_ui_mono[0]) { | if (U.font_path_ui_mono[0]) { | ||||
| blf_mono_font = BLF_load_unique(U.font_path_ui_mono); | blf_mono_font = BLF_load_unique(U.font_path_ui_mono); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines | |||||