fix NULL check for getenv("LANGUAGE")
[blender.git] / source / blender / editors / datafiles / bunifont.ttf.c
1 /** \file blender/editors/datafiles/bunifont.ttf.c
2  *  \ingroup eddatafiles
3  */
4 /* DataToC output of file <bfont_ttf> */
5
6 #include <stdio.h>
7 #include "BLI_path_util.h"
8 #include "BLI_string.h"
9 #include "BLI_fileops.h"
10 #include "BLI_memarena.h"
11 #include "MEM_guardedalloc.h"
12
13 const int datatoc_bunifont_ttf_size = 16179552;
14 static char* datatoc_bunifont_ttf = 0;
15
16 static char unifont_path[1024];
17 const char unifont_filename[]="unifont.ttf.gz";
18
19 char *get_datatoc_bunifont_ttf(void)
20 {
21     if( datatoc_bunifont_ttf==NULL )
22     {
23         char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
24         BLI_snprintf( unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename );
25
26         if( BLI_exists(unifont_path) )
27         {
28                         datatoc_bunifont_ttf = (char*)MEM_mallocN( datatoc_bunifont_ttf_size, "get_datatoc_bunifont_ttf" );
29                         BLI_ungzip_to_mem( unifont_path, datatoc_bunifont_ttf, datatoc_bunifont_ttf_size );
30         }
31     }
32     return datatoc_bunifont_ttf;
33 }
34
35 void free_datatoc_bunifont_ttf(void)
36 {
37         if( datatoc_bunifont_ttf!=NULL )
38                 MEM_freeN( datatoc_bunifont_ttf );
39 }