i18n: replace gnu unifont with droid sans font
[blender.git] / source / blender / blenkernel / intern / font.c
index 6898615c7537b045cbd1eff58b979599715ee2d1..0a94b4e3fd1496cadb06dcb06da328a4f165bd17 100644 (file)
@@ -255,6 +255,29 @@ static PackedFile *get_builtin_packedfile(void)
        }
 }
 
+#ifdef INTERNATIONAL
+const char unifont_filename[]="droidsans.ttf.gz";
+static unsigned char *unifont_ttf= NULL;
+static int unifont_size= 0;
+
+unsigned char *BKE_font_get_unifont(int *unifont_size_r)
+{
+       if(unifont_ttf==NULL) {
+               char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
+               char unifont_path[1024];
+
+               BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
+
+               unifont_ttf= BLI_ungzip_to_mem(unifont_path, &unifont_size);
+       }
+
+       *unifont_size_r= unifont_size;
+
+       return unifont_ttf;
+}
+
+#endif
+
 void free_ttfont(void)
 {
        struct TmpFont *tf;
@@ -265,6 +288,9 @@ void free_ttfont(void)
                tf->vfont= NULL;
        }
        BLI_freelistN(&ttfdata);
+
+       if(unifont_ttf)
+               MEM_freeN(unifont_ttf);
 }
 
 struct TmpFont *vfont_find_tmpfont(VFont *vfont)