diff options
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r-- | source/blender/blenkernel/intern/font.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 52275e507dd..a8a97742c24 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -53,7 +53,6 @@ #include "DNA_scene_types.h" #include "BKE_utildefines.h" -#include "BKE_bad_level_calls.h" #include "BKE_packedFile.h" @@ -70,6 +69,8 @@ struct SelBox *selboxes= NULL; +static ListBase ttfdata= {NULL, NULL}; + /* UTF-8 <-> wchar transformations */ void chtoutf8(unsigned long c, char *o) @@ -270,22 +271,46 @@ static PackedFile *get_builtin_packedfile(void) } } -static VFontData *vfont_get_data(VFont *vfont) +void free_ttfont(void) +{ + struct TmpFont *tf; + + tf= ttfdata.first; + while(tf) { + freePackedFile(tf->pf); + tf->pf= NULL; + tf->vfont= NULL; + tf= tf->next; + } + BLI_freelistN(&ttfdata); +} + +struct TmpFont *vfont_find_tmpfont(VFont *vfont) { struct TmpFont *tmpfnt = NULL; - PackedFile *tpf; if(vfont==NULL) return NULL; // Try finding the font from font list - tmpfnt = G.ttfdata.first; - + tmpfnt = ttfdata.first; while(tmpfnt) { if(tmpfnt->vfont == vfont) break; tmpfnt = tmpfnt->next; } + return tmpfnt; +} + +static VFontData *vfont_get_data(VFont *vfont) +{ + struct TmpFont *tmpfnt = NULL; + PackedFile *tpf; + + if(vfont==NULL) return NULL; + + // Try finding the font from font list + tmpfnt = vfont_find_tmpfont(vfont); // And then set the data if (!vfont->data) { @@ -309,7 +334,7 @@ static VFontData *vfont_get_data(VFont *vfont) tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font"); tmpfnt->pf= tpf; tmpfnt->vfont= vfont; - BLI_addtail(&G.ttfdata, tmpfnt); + BLI_addtail(&ttfdata, tmpfnt); } } else { pf= newPackedFile(vfont->name); @@ -322,7 +347,7 @@ static VFontData *vfont_get_data(VFont *vfont) tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font"); tmpfnt->pf= tpf; tmpfnt->vfont= vfont; - BLI_addtail(&G.ttfdata, tmpfnt); + BLI_addtail(&ttfdata, tmpfnt); } } if(!pf) { @@ -376,8 +401,6 @@ VFont *load_vfont(char *name) if (pf) { VFontData *vfd; - - waitcursor(1); #ifdef WITH_FREETYPE2 vfd= BLI_vfontdata_from_freetypefont(pf); @@ -402,7 +425,7 @@ VFont *load_vfont(char *name) tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font"); tmpfnt->pf= tpf; tmpfnt->vfont= vfont; - BLI_addtail(&G.ttfdata, tmpfnt); + BLI_addtail(&ttfdata, tmpfnt); } } @@ -411,7 +434,7 @@ VFont *load_vfont(char *name) freePackedFile(pf); } - waitcursor(0); + //XXX waitcursor(0); } return vfont; |