Merging trunk up to r39145.
[blender-staging.git] / source / blender / editors / interface / interface_style.c
index 8d4b42091207f9c6b705249bf5d31ae60efd03db..704b9ae3a804cacf1e770e46aa28295bd37ce5bf 100644 (file)
@@ -295,6 +295,7 @@ void uiStyleInit(void)
 {
        uiFont *font= U.uifonts.first;
        uiStyle *style= U.uistyles.first;
+       int defaultFontId = -1;
        
        /* recover from uninitialized dpi */
        if(U.dpi == 0)
@@ -314,6 +315,7 @@ void uiStyleInit(void)
                
                if(font->uifont_id==UIFONT_DEFAULT) {
                        font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+                       defaultFontId = font->blf_id;
                }               
                else {
                        font->blf_id= BLF_load(font->filename);
@@ -351,6 +353,14 @@ void uiStyleInit(void)
                blf_mono_font_render= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
 
        BLF_size(blf_mono_font_render, 12, 72);
+       
+       /* also another copy of default for rendering else we get threading problems */
+       if (defaultFontId != -1) {
+               if (blf_default_font_render == -1)
+                       blf_default_font_render= BLF_load_mem_unique("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+                       
+               BLF_size(blf_default_font_render, 12, 72);
+       }
 }
 
 void uiStyleFontSet(uiFontStyle *fs)