diff options
author | Ton Roosendaal <ton@blender.org> | 2007-12-24 21:38:03 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-12-24 21:38:03 +0300 |
commit | c79966be52e251cc7b1028ea4d3012b44eb6a8af (patch) | |
tree | f4007ee279b01ad9075971fd63159a02aa29d904 /source/blender/blenkernel/intern/font.c | |
parent | a1c8543f2acd7086d412cb794b32f96794b00659 (diff) |
Blenkernel for 2.5 project, changes mainly are because of disabling
bad level calls. (which is not finished at all)
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r-- | source/blender/blenkernel/intern/font.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index fc11b3d234d..2a2547fd839 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -73,6 +73,8 @@ struct SelBox *selboxes= NULL; +static ListBase ttfdata= {NULL, NULL}; + /* UTF-8 <-> wchar transformations */ void chtoutf8(unsigned long c, char *o) @@ -253,22 +255,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) { @@ -292,7 +318,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); @@ -305,7 +331,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) { @@ -385,7 +411,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); } } |