diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-26 19:33:42 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-26 19:33:42 +0300 |
commit | cf0820d6285c3a9379dd529ee50dcf39e2efa21c (patch) | |
tree | 08fb7672ce9f8e355ca2e99f6a52a14e3584f986 /source/blender/editors/interface/interface_style.c | |
parent | 782d7b312ff6799258fb318e2aa5bbd64dbd2a9d (diff) |
change monospace font to be an extern, not good final design but better then loading the same font 3 times.
need to load twice still because render may use the font in a thread.
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 0baee38d396..f7079c04a66 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -264,6 +264,9 @@ void UI_DrawString(float x, float y, const char *str) BLF_disable(style->widget.uifont_id, BLF_KERNING_DEFAULT); } +int blf_mono_font= -1; +int blf_mono_font_render= -1; + /* ************** init exit ************************ */ /* called on each startup.blend read */ @@ -314,6 +317,20 @@ void uiStyleInit(void) if(style==NULL) { ui_style_new(&U.uistyles, "Default Style"); } + + // XXX, this should be moved into a style, but for now best only load the monospaced font once. + if (blf_mono_font == -1) + blf_mono_font= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size); + + BLF_aspect(blf_mono_font, 1.0); + BLF_size(blf_mono_font, 12, 72); + + /* second for rendering else we get threading problems */ + if (blf_mono_font_render == -1) + blf_mono_font_render= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size); + + BLF_aspect(blf_mono_font_render, 1.0); + BLF_size(blf_mono_font_render, 12, 72); } void uiStyleFontSet(uiFontStyle *fs) |