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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-04 23:34:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-04 23:34:38 +0400
commit3d204744147c136a2d57ca3ba52e424b50ea48c2 (patch)
tree479508a40e6c27b38d2641a75ae44c1adedca13c /source/blender/blenkernel/intern/font.c
parent97e9659c537359f24a49b5cf9d8dcbb13947cb36 (diff)
style cleanup
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r--source/blender/blenkernel/intern/font.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 17d48841f95..02e5dc02746 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -260,7 +260,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
BLI_strncpy(filename, name, sizeof(filename));
pf = get_builtin_packedfile();
- is_builtin = 1;
+ is_builtin = TRUE;
}
else {
char dir[FILE_MAXDIR];
@@ -271,7 +271,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
pf = newPackedFile(NULL, name, bmain->name);
tpf = newPackedFile(NULL, name, bmain->name);
- is_builtin = 0;
+ is_builtin = FALSE;
}
if (pf) {
@@ -398,7 +398,8 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
}
-static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx)
+static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo *info,
+ float ofsx, float ofsy, float rot, int charidx)
{
BezTriple *bezt1, *bezt2;
Nurb *nu1 = NULL, *nu2 = NULL;
@@ -424,8 +425,8 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
/* make a copy at distance ofsx, ofsy with shear*/
fsize = cu->fsize;
shear = cu->shear;
- si = (float)sin(rot);
- co = (float)cos(rot);
+ si = sinf(rot);
+ co = cosf(rot);
che = find_vfont_char(vfd, character);
@@ -577,7 +578,7 @@ struct CharTrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int
short cnr = 0, lnr = 0, wsnr = 0;
wchar_t *mem, *tmp, ascii;
- /* renark: do calculations including the trailing '\0' of a string
+ /* remark: do calculations including the trailing '\0' of a string
* because the cursor can be at that location */
if (ob->type != OB_FONT) return NULL;
@@ -704,7 +705,10 @@ makebreak:
twidth = char_width(cu, che, info);
/* Calculate positions */
- if ((tb->w != 0.0f) && (ct->dobreak == 0) && ((xof - (tb->x / cu->fsize) + twidth) * cu->fsize) > tb->w + cu->xof * cu->fsize) {
+ if ((tb->w != 0.0f) &&
+ (ct->dobreak == 0) &&
+ (((xof - (tb->x / cu->fsize) + twidth) * cu->fsize) > tb->w + cu->xof * cu->fsize))
+ {
// 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] == '-') {
@@ -730,6 +734,7 @@ makebreak:
}
}
}
+
if (ascii == '\n' || ascii == '\r' || ascii == 0 || ct->dobreak) {
ct->xof = xof;
ct->yof = yof;
@@ -799,15 +804,18 @@ makebreak:
wsfac = cu->wordspace;
wsnr++;
}
- else wsfac = 1.0f;
+ else {
+ wsfac = 1.0f;
+ }
/* Set the width of the character */
twidth = char_width(cu, che, info);
xof += (twidth * wsfac * (1.0f + (info->kern / 40.0f)) ) + xtrax;
- if (sb)
+ if (sb) {
sb->w = (xof * cu->fsize) - sb->w;
+ }
}
ct++;
}
@@ -926,11 +934,14 @@ makebreak:
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) {
+ distfac = 1.0f;
+ }
}
- else distfac = 1.0;
-
+ else {
+ distfac = 1.0;
+ }
+
distfac /= (maxx - minx);
timeofs += distfac * cu->xof; /* not cyclic */
@@ -959,10 +970,10 @@ makebreak:
mul_v3_fl(vec, sizefac);
- ct->rot = (float)(M_PI - atan2(rotvec[1], rotvec[0]));
+ ct->rot = (float)M_PI - atan2f(rotvec[1], rotvec[0]);
- si = (float)sin(ct->rot);
- co = (float)cos(ct->rot);
+ si = sinf(ct->rot);
+ co = cosf(ct->rot);
yof = ct->yof;
@@ -1025,21 +1036,21 @@ makebreak:
f = cu->editfont->textcurs[0];
f[0] = cu->fsize * (-0.1f * co + ct->xof);
- f[1] = cu->fsize * (0.1f * si + ct->yof);
+ f[1] = cu->fsize * ( 0.1f * si + ct->yof);
- f[2] = cu->fsize * (0.1f * co + ct->xof);
+ f[2] = cu->fsize * ( 0.1f * co + ct->xof);
f[3] = cu->fsize * (-0.1f * si + ct->yof);
- f[4] = cu->fsize * (0.1f * co + 0.8f * si + ct->xof);
+ f[4] = cu->fsize * ( 0.1f * co + 0.8f * si + ct->xof);
f[5] = cu->fsize * (-0.1f * si + 0.8f * co + ct->yof);
f[6] = cu->fsize * (-0.1f * co + 0.8f * si + ct->xof);
- f[7] = cu->fsize * (0.1f * si + 0.8f * co + ct->yof);
+ f[7] = cu->fsize * ( 0.1f * si + 0.8f * co + ct->yof);
}
MEM_freeN(linedata);
- MEM_freeN(linedata2);
+ MEM_freeN(linedata2);
MEM_freeN(linedata3);
MEM_freeN(linedata4);
@@ -1070,7 +1081,8 @@ makebreak:
float ulwidth, uloverlap = 0.0f;
if ((i < (slen - 1)) && (mem[i + 1] != '\n') && (mem[i + 1] != '\r') &&
- ((mem[i + 1] != ' ') || (custrinfo[i + 1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i + 1].flag & CU_CHINFO_WRAP) == 0))
+ ((mem[i + 1] != ' ') || (custrinfo[i + 1].flag & CU_CHINFO_UNDERLINE)) &&
+ ((custrinfo[i + 1].flag & CU_CHINFO_WRAP) == 0))
{
uloverlap = xtrax + 0.1f;
}