Attempt at providing the best possible flexibility and usefulness with
"Flush": - There are now two modes, "Flush" and "Justify". Justify only flushes a line when it is *terminated* either by wordwrap or by Enter. - "Flush" *always* flushes the line, also when it's still being entered. This mode can be used for things like this: http://pub.intrr.org/flush.png ..while "Justify" would not flush the second line. - Fixed "Flush" squeezing all characters on the same spot if the textframe was set to 0 width
This commit is contained in:
@@ -374,7 +374,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
||||
TextBox *tb;
|
||||
int curbox;
|
||||
int selstart, selend;
|
||||
SelBox *sb= NULL;
|
||||
SelBox *sb= NULL; /* to please gcc */
|
||||
|
||||
/* renark: do calculations including the trailing '\0' of a string
|
||||
because the cursor can be at that location */
|
||||
@@ -399,7 +399,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
||||
|
||||
linedata= MEM_mallocN(sizeof(float)*(slen+2),"buildtext2");
|
||||
linedata2= MEM_mallocN(sizeof(float)*(slen+2),"buildtext3");
|
||||
linedata3= MEM_mallocN(sizeof(float)*(slen+2),"buildtext4");
|
||||
linedata3= MEM_callocN(sizeof(float)*(slen+2),"buildtext4");
|
||||
|
||||
linedist= cu->linedist;
|
||||
|
||||
@@ -539,14 +539,16 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
||||
ct->xof+= linedata[ct->linenr];
|
||||
ct++;
|
||||
}
|
||||
} else if(cu->spacemode==CU_FLUSH) {
|
||||
} else if((cu->spacemode==CU_FLUSH || cu->spacemode==CU_FORCEFLUSH) &&
|
||||
(cu->tb[0].w != 0.0)) {
|
||||
for(i=0;i<lnr;i++)
|
||||
if(linedata2[i]>1)
|
||||
linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1);
|
||||
for (i=0; i<=slen; i++) {
|
||||
for (j=i; (cu->str[j]) && (cu->str[j]!='\n') &&
|
||||
(cu->str[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
|
||||
if ((cu->str[j]!='\r') && (cu->str[j]!='\n') && (chartransdata[j].dobreak!=0)) {
|
||||
if ((cu->str[j]!='\r') && (cu->str[j]!='\n') &&
|
||||
(cu->spacemode==CU_FORCEFLUSH || (chartransdata[j].dobreak!=0))) {
|
||||
ct->xof+= ct->charnr*linedata[ct->linenr];
|
||||
}
|
||||
ct++;
|
||||
@@ -594,7 +596,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
||||
else if(cu->spacemode==CU_MIDDLE) {
|
||||
timeofs= (1.0f-distfac)/2.0f;
|
||||
}
|
||||
else if(cu->spacemode==CU_FLUSH) distfac= 1.0f;
|
||||
else if(cu->spacemode==CU_FLUSH || cu->spacemode==CU_FORCEFLUSH) distfac= 1.0f;
|
||||
|
||||
}
|
||||
else distfac= 1.0;
|
||||
|
||||
@@ -213,6 +213,7 @@ typedef struct IpoCurve {
|
||||
#define CU_MIDDLE 1
|
||||
#define CU_RIGHT 2
|
||||
#define CU_FLUSH 3
|
||||
#define CU_FORCEFLUSH 4
|
||||
|
||||
/* flag (nurb) */
|
||||
#define CU_SMOOTH 1
|
||||
|
||||
@@ -1088,13 +1088,13 @@ static void editing_panel_font_type(Object *ob, Curve *cu)
|
||||
MEM_freeN(strp);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Left", 480,135,53,20, &cu->spacemode, 0.0,0.0, 0, 0, "Left align the text from the object centre");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Middle", 535,135,55,20, &cu->spacemode, 0.0,1.0, 0, 0, "Middle align the text from the object centre");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Right", 592,135,53,20, &cu->spacemode, 0.0,2.0, 0, 0, "Right align the text from the object centre");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Flush", 647,135,53,20, &cu->spacemode, 0.0,3.0, 0, 0, "Fill characters to maximum linewidth. (Multiple lines required)");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Left", 480,135,47,20, &cu->spacemode, 0.0,0.0, 0, 0, "Left align the text from the object centre");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Center", 527,135,47,20, &cu->spacemode, 0.0,1.0, 0, 0, "Middle align the text from the object centre");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Right", 574,135,47,20, &cu->spacemode, 0.0,2.0, 0, 0, "Right align the text from the object centre");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Justify", 621,135,47,20, &cu->spacemode, 0.0,3.0, 0, 0, "Fill completed lines to maximum textframe width");
|
||||
uiDefButS(block, ROW,B_MAKEFONT, "Flush", 668,135,47,20, &cu->spacemode, 0.0,4.0, 0, 0, "Always fill to maximum textframe width");
|
||||
uiDefBut(block, BUT, B_TOUPPER, "ToUpper", 715,135,78,20, 0, 0, 0, 0, 0, "Toggle between upper and lower case in editmode");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiDefButS(block, TOG|BIT|9,B_FASTFONT, "Fast Edit", 715,105,78,20, &cu->flag, 0, 0, 0, 0, "Don't fill polygons while editing");
|
||||
|
||||
uiDefIDPoinBut(block, test_obpoin_but, B_TEXTONCURVE, "TextOnCurve:", 480,105,220,19, &cu->textoncurve, "Apply a deforming curve to the text");
|
||||
|
||||
Reference in New Issue
Block a user