Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-24 11:02:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-24 11:02:19 +0400
commit619a8b6952b63108c95c031683102f45bd049cd4 (patch)
tree79090a899322ba47ffe9866a9169f70d81766f46 /source
parent1424a171a464f79073da2a00c2b5bfa66bf00bc4 (diff)
bugfix [#24357] Font folder can be specified but is not opened
- open operator was incorrectly checking if the font path was set. - rna ID editable check was also incorrect, checking the ID name rather then the filename. - use define FO_BUILTIN_NAME rather then "<builtin>".
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/font.c18
-rw-r--r--source/blender/blenkernel/intern/packedFile.c2
-rw-r--r--source/blender/blenlib/intern/bpath.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c4
-rw-r--r--source/blender/editors/curve/editfont.c7
-rw-r--r--source/blender/editors/interface/interface_draw.c12
-rw-r--r--source/blender/makesdna/DNA_vfont_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_ID.c4
8 files changed, 27 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 131b16b319e..58917e75a43 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -305,7 +305,7 @@ static VFontData *vfont_get_data(VFont *vfont)
if (!vfont->data) {
PackedFile *pf;
- if (BLI_streq(vfont->name, "<builtin>")) {
+ if (strcmp(vfont->name, FO_BUILTIN_NAME)==0) {
pf= get_builtin_packedfile();
} else {
if (vfont->packedfile) {
@@ -342,7 +342,7 @@ static VFontData *vfont_get_data(VFont *vfont)
if(!pf) {
printf("Font file doesn't exist: %s\n", vfont->name);
- strcpy(vfont->name, "<builtin>");
+ strcpy(vfont->name, FO_BUILTIN_NAME);
pf= get_builtin_packedfile();
}
}
@@ -367,7 +367,7 @@ VFont *load_vfont(char *name)
int is_builtin;
struct TmpFont *tmpfnt;
- if (BLI_streq(name, "<builtin>")) {
+ if (strcmp(name, FO_BUILTIN_NAME)==0) {
strcpy(filename, name);
pf= get_builtin_packedfile();
@@ -403,8 +403,8 @@ VFont *load_vfont(char *name)
vfont->packedfile = pf;
}
- // Do not add <builtin> to temporary listbase
- if(strcmp(filename, "<builtin>"))
+ // Do not add FO_BUILTIN_NAME to temporary listbase
+ if(strcmp(filename, FO_BUILTIN_NAME))
{
tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
tmpfnt->pf= tpf;
@@ -443,10 +443,10 @@ VFont *get_builtin_font(void)
VFont *vf;
for (vf= G.main->vfont.first; vf; vf= vf->id.next)
- if (BLI_streq(vf->name, "<builtin>"))
+ if (strcmp(vf->name, FO_BUILTIN_NAME)==0)
return vf;
- return load_vfont("<builtin>");
+ return load_vfont(FO_BUILTIN_NAME);
}
static VChar *find_vfont_char(VFontData *vfd, intptr_t character)
@@ -781,10 +781,10 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
/*
* The character wasn't in the current curve base so load it
- * But if the font is <builtin> then do not try loading since
+ * But if the font is FO_BUILTIN_NAME then do not try loading since
* whole font is in the memory already
*/
- if(che == NULL && strcmp(vfont->name, "<builtin>")) {
+ if(che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME)) {
BLI_vfontchar_from_freetypefont(vfont, ascii);
}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 33f1949c5ac..e8223caed41 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -227,7 +227,7 @@ void packAll(Main *bmain, ReportList *reports)
}
for(vf=bmain->vfont.first; vf; vf=vf->id.next)
- if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, "<builtin>") != 0)
+ if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0)
vf->packedfile = newPackedFile(reports, vf->name);
for(sound=bmain->sound.first; sound; sound=sound->id.next)
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 862df4103a7..8711857f83a 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -171,7 +171,7 @@ static struct VFont *vf_stepdata__internal(struct VFont *vf, int step_next) {
vf = vf->id.next;
while (vf) {
- if (vf->packedfile==NULL && BLI_streq(vf->name, "<builtin>")==0) {
+ if (vf->packedfile==NULL && strcmp(vf->name, FO_BUILTIN_NAME)!=0) {
break;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c40448aab19..b50b1bcf57c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7269,8 +7269,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
for (vf= main->vfont.first; vf; vf= vf->id.next) {
- if (BLI_streq(vf->name+strlen(vf->name)-6, ".Bfont")) {
- strcpy(vf->name, "<builtin>");
+ if (strcmp(vf->name+strlen(vf->name)-6, ".Bfont")==0) {
+ strcpy(vf->name, FO_BUILTIN_NAME);
}
}
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 44a664b5f30..13678b0dfe5 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1696,7 +1696,8 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
cu = ob->data;
font = cu->vfont;
}
- path = (font && font->name)? font->name: U.fontdir;
+ printf("%s\n", font->name);
+ path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir;
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
@@ -1737,7 +1738,7 @@ static int font_unlink_poll(bContext *C)
if (ob->type != OB_FONT) return 0;
cu = ob->data;
- if (cu && strcmp(cu->vfont->name, "<builtin>")==0) return 0;
+ if (cu && strcmp(cu->vfont->name, FO_BUILTIN_NAME)==0) return 0;
return 1;
}
@@ -1755,7 +1756,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (strcmp(font->name, "<builtin>")==0) {
+ if (strcmp(font->name, FO_BUILTIN_NAME)==0) {
BKE_report(op->reports, RPT_WARNING, "Can't unlink the default builtin font.");
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 81b04fea062..768be97f930 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -517,7 +517,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int charmax = G.charmax;
/* <builtin> font in use. There are TTF <builtin> and non-TTF <builtin> fonts */
- if(!strcmp(G.selfont->name, "<builtin>"))
+ if(!strcmp(G.selfont->name, FO_BUILTIN_NAME))
{
if(G.ui_international == TRUE)
{
@@ -548,8 +548,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
cs = G.charstart;
- /* Set the font, in case it is not <builtin> font */
- if(G.selfont && strcmp(G.selfont->name, "<builtin>"))
+ /* Set the font, in case it is not FO_BUILTIN_NAME font */
+ if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME))
{
char tmpStr[256];
@@ -605,9 +605,9 @@ static void ui_draw_but_CHARTAB(uiBut *but)
memset(wstr, 0, sizeof(wchar_t)*2);
memset(ustr, 0, 16);
- // Set the font to be either unicode or <builtin>
+ // Set the font to be either unicode or FO_BUILTIN_NAME
wstr[0] = cs;
- if(strcmp(G.selfont->name, "<builtin>"))
+ if(strcmp(G.selfont->name, FO_BUILTIN_NAME))
{
wcs2utf8s((char *)ustr, (wchar_t *)wstr);
}
@@ -624,7 +624,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
}
- if((G.selfont && strcmp(G.selfont->name, "<builtin>")) || (G.selfont && !strcmp(G.selfont->name, "<builtin>") && G.ui_international == TRUE))
+ if((G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) || (G.selfont && !strcmp(G.selfont->name, FO_BUILTIN_NAME) && G.ui_international == TRUE))
{
float wid;
float llx, lly, llz, urx, ury, urz;
diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h
index 0ea60c732cf..e342ef1cd79 100644
--- a/source/blender/makesdna/DNA_vfont_types.h
+++ b/source/blender/makesdna/DNA_vfont_types.h
@@ -55,5 +55,6 @@ typedef struct VFont {
#define FO_PAGEDOWN 9
#define FO_SELCHANGE 10
+#define FO_BUILTIN_NAME "<builtin>"
#endif
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 4321f8aa711..bc803415c7c 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -29,6 +29,7 @@
#include "RNA_define.h"
#include "DNA_ID.h"
+#include "DNA_vfont_types.h"
#include "WM_types.h"
@@ -98,7 +99,8 @@ static int rna_ID_name_editable(PointerRNA *ptr)
ID *id= (ID*)ptr->data;
if (GS(id->name) == ID_VF) {
- if (strcmp(id->name+2, "<builtin>")==0)
+ VFont *vf= (VFont *)id;
+ if (strcmp(vf->name, FO_BUILTIN_NAME)==0)
return 0;
}