Fixing Bug: 3273, Removing my goto calls from font.c.
This commit is contained in:
@@ -663,7 +663,14 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfd= vfont_get_data(vfont);
|
vfd= vfont_get_data(vfont);
|
||||||
if(!vfd) goto errcse;
|
|
||||||
|
/* The VFont Data can not be found */
|
||||||
|
if(!vfd)
|
||||||
|
{
|
||||||
|
if(mem)
|
||||||
|
MEM_freeN(mem);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* calc offset and rotation of each char */
|
/* calc offset and rotation of each char */
|
||||||
ct = chartransdata =
|
ct = chartransdata =
|
||||||
@@ -730,29 +737,44 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* No VFont found */
|
||||||
|
if (vfont==0)
|
||||||
|
{
|
||||||
|
if(mem)
|
||||||
|
MEM_freeN(mem);
|
||||||
|
MEM_freeN(chartransdata);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (vfont==0) goto errcse;
|
if (vfont != oldvfont) {
|
||||||
if (vfont != oldvfont) {
|
vfd= vfont_get_data(vfont);
|
||||||
vfd= vfont_get_data(vfont);
|
oldvfont = vfont;
|
||||||
oldvfont = vfont;
|
}
|
||||||
}
|
|
||||||
if (!vfd) goto errcse;
|
|
||||||
|
|
||||||
// The character wasn't found, propably ascii = 0, then the width shall be 0 as well
|
/* VFont Data for VFont couldn't be found */
|
||||||
if(!che)
|
if (!vfd)
|
||||||
{
|
{
|
||||||
twidth = 0;
|
if(mem)
|
||||||
}
|
MEM_freeN(mem);
|
||||||
else
|
MEM_freeN(chartransdata);
|
||||||
{
|
return 0;
|
||||||
twidth = che->width;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate positions
|
// The character wasn't found, propably ascii = 0, then the width shall be 0 as well
|
||||||
if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) {
|
if(!che)
|
||||||
// fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
|
{
|
||||||
for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) {
|
twidth = 0;
|
||||||
if (mem[j]==' ' || mem[j]=='-') {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
twidth = che->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate positions
|
||||||
|
if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) {
|
||||||
|
// fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
|
||||||
|
for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) {
|
||||||
|
if (mem[j]==' ' || mem[j]=='-') {
|
||||||
ct -= (i-(j-1));
|
ct -= (i-(j-1));
|
||||||
cnr -= (i-(j-1));
|
cnr -= (i-(j-1));
|
||||||
if (mem[j] == ' ') wsnr--;
|
if (mem[j] == ' ') wsnr--;
|
||||||
@@ -762,19 +784,19 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
ct[1].dobreak = 1;
|
ct[1].dobreak = 1;
|
||||||
cu->strinfo[i+1].flag |= CU_WRAP;
|
cu->strinfo[i+1].flag |= CU_WRAP;
|
||||||
goto makebreak;
|
goto makebreak;
|
||||||
}
|
}
|
||||||
if (chartransdata[j].dobreak) {
|
if (chartransdata[j].dobreak) {
|
||||||
// fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]);
|
// fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]);
|
||||||
ct->dobreak= 1;
|
ct->dobreak= 1;
|
||||||
cu->strinfo[i+1].flag |= CU_WRAP;
|
cu->strinfo[i+1].flag |= CU_WRAP;
|
||||||
ct -= 1;
|
ct -= 1;
|
||||||
cnr -= 1;
|
cnr -= 1;
|
||||||
i--;
|
i--;
|
||||||
xof = ct->xof;
|
xof = ct->xof;
|
||||||
goto makebreak;
|
goto makebreak;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(ascii== '\n' || ascii== '\r' || ascii==0 || ct->dobreak) {
|
if(ascii== '\n' || ascii== '\r' || ascii==0 || ct->dobreak) {
|
||||||
ct->xof= xof;
|
ct->xof= xof;
|
||||||
ct->yof= yof;
|
ct->yof= yof;
|
||||||
@@ -825,11 +847,11 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
ct->charnr= cnr++;
|
ct->charnr= cnr++;
|
||||||
|
|
||||||
if (selboxes && (i>=selstart) && (i<=selend)) {
|
if (selboxes && (i>=selstart) && (i<=selend)) {
|
||||||
sb = &(selboxes[i-selstart]);
|
sb = &(selboxes[i-selstart]);
|
||||||
sb->y = yof*cu->fsize-linedist*cu->fsize*0.1;
|
sb->y = yof*cu->fsize-linedist*cu->fsize*0.1;
|
||||||
sb->h = linedist*cu->fsize;
|
sb->h = linedist*cu->fsize;
|
||||||
sb->w = xof*cu->fsize;
|
sb->w = xof*cu->fsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ascii==32) {
|
if (ascii==32) {
|
||||||
wsfac = cu->wordspace;
|
wsfac = cu->wordspace;
|
||||||
@@ -1159,7 +1181,6 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
return chartransdata;
|
return chartransdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
errcse:
|
|
||||||
if(mem)
|
if(mem)
|
||||||
MEM_freeN(mem);
|
MEM_freeN(mem);
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
#include "BKE_utildefines.h"
|
#include "BKE_utildefines.h"
|
||||||
#include "BKE_font.h"
|
#include "BKE_font.h"
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
|
#include "datatoc.h" /* std font */
|
||||||
|
|
||||||
#include "BIF_gl.h"
|
#include "BIF_gl.h"
|
||||||
#include "BIF_graphics.h"
|
#include "BIF_graphics.h"
|
||||||
@@ -1717,6 +1718,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
|||||||
wchar_t wstr[2];
|
wchar_t wstr[2];
|
||||||
unsigned char ustr[16];
|
unsigned char ustr[16];
|
||||||
PackedFile *pf;
|
PackedFile *pf;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
/* Calculate the size of the button */
|
/* Calculate the size of the button */
|
||||||
width = abs(but->x2 - but->x1);
|
width = abs(but->x2 - but->x1);
|
||||||
@@ -1824,6 +1826,21 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
|||||||
ex = but->x1 + butw;
|
ex = but->x1 + butw;
|
||||||
}
|
}
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
|
|
||||||
|
/* Return Font Settings to original */
|
||||||
|
if(U.fontsize && U.fontname[0])
|
||||||
|
{
|
||||||
|
result = FTF_SetFont(U.fontname, 0, U.fontsize);
|
||||||
|
}
|
||||||
|
else if (U.fontsize)
|
||||||
|
{
|
||||||
|
result = FTF_SetFont(datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
result = FTF_SetFont(datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // INTERNATIONAL
|
#endif // INTERNATIONAL
|
||||||
|
|||||||
Reference in New Issue
Block a user