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:
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r--source/blender/blenkernel/intern/font.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 73199cebe36..cf2521509b5 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -148,7 +148,7 @@ static PackedFile *get_builtin_packedfile(void)
void *mem = MEM_mallocN(builtin_font_size, "vfd_builtin");
memcpy(mem, builtin_font_data, builtin_font_size);
-
+
return newPackedFileMemory(mem, builtin_font_size);
}
}
@@ -205,7 +205,7 @@ static VFontData *vfont_get_data(VFont *vfont)
pf = get_builtin_packedfile();
}
}
-
+
if (pf) {
vfont->data = BLI_vfontdata_from_freetypefont(pf);
if (pf != vfont->packedfile) {
@@ -246,10 +246,10 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
PackedFile *pf;
PackedFile *temp_pf = NULL;
bool is_builtin;
-
+
if (STREQ(filepath, FO_BUILTIN_NAME)) {
BLI_strncpy(filename, filepath, sizeof(filename));
-
+
pf = get_builtin_packedfile();
is_builtin = true;
}
@@ -257,7 +257,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
BLI_split_file_part(filepath, filename, sizeof(filename));
pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
-
+
is_builtin = false;
}
@@ -291,7 +291,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
freePackedFile(pf);
}
}
-
+
return vfont;
}
@@ -348,13 +348,13 @@ static VFont *which_vfont(Curve *cu, CharInfo *info)
VFont *BKE_vfont_builtin_get(void)
{
VFont *vfont;
-
+
for (vfont = G_MAIN->vfont.first; vfont; vfont = vfont->id.next) {
if (BKE_vfont_is_builtin(vfont)) {
return vfont;
}
}
-
+
return BKE_vfont_load(G_MAIN, FO_BUILTIN_NAME);
}
@@ -368,7 +368,7 @@ static void build_underline(Curve *cu, ListBase *nubase, const rctf *rect,
{
Nurb *nu2;
BPoint *bp;
-
+
nu2 = (Nurb *) MEM_callocN(sizeof(Nurb), "underline_nurb");
nu2->resolu = cu->resolu;
nu2->bezt = NULL;
@@ -454,7 +454,7 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI
co = cosf(rot);
che = find_vfont_char(vfd, character);
-
+
/* Select the glyph data */
if (che)
nu1 = che->nurbsbase.first;
@@ -488,10 +488,10 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI
}
memcpy(bezt2, bezt1, i * sizeof(struct BezTriple));
nu2->bezt = bezt2;
-
+
if (shear != 0.0f) {
bezt2 = nu2->bezt;
-
+
for (i = nu2->pntsu; i > 0; i--) {
bezt2->vec[0][0] += shear * bezt2->vec[0][1];
bezt2->vec[1][0] += shear * bezt2->vec[1][1];
@@ -544,10 +544,10 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI
fp[7] = (fp[7] + ofsy) * fsize;
bezt2++;
}
-
+
BLI_addtail(nubase, nu2);
}
-
+
nu1 = nu1->next;
}
}
@@ -557,7 +557,7 @@ int BKE_vfont_select_get(Object *ob, int *r_start, int *r_end)
Curve *cu = ob->data;
EditFont *ef = cu->editfont;
int start, end, direction;
-
+
if ((ob->type != OB_FONT) || (ef == NULL)) return 0;
BLI_assert(ef->len >= 0);
@@ -681,7 +681,7 @@ bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, int mode, ListBase *r_nubase,
/* The VFont Data can not be found */
if (!vfd) return ok;
-
+
if (ef) {
slen = ef->len;
mem = ef->textbuf;
@@ -734,9 +734,9 @@ bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, int mode, ListBase *r_nubase,
/* We assume the worst case: 1 character per line (is freed at end anyway) */
lineinfo = MEM_malloc_arrayN((slen * 2 + 1), sizeof(*lineinfo), "lineinfo");
-
+
linedist = cu->linedist;
-
+
curbox = 0;
textbox_scale(&tb_scale, &cu->tb[curbox], 1.0f / cu->fsize);
use_textbox = (tb_scale.w != 0.0f);
@@ -886,7 +886,7 @@ makebreak:
}
else if (ascii == 9) { /* TAB */
float tabfac;
-
+
ct->xof = xof;
ct->yof = yof;
ct->linenr = lnr;
@@ -911,27 +911,27 @@ makebreak:
sb->h = linedist * cu->fsize;
sb->w = xof * cu->fsize;
}
-
+
if (ascii == 32) {
- wsfac = cu->wordspace;
+ wsfac = cu->wordspace;
wsnr++;
}
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) {
sb->w = (xof * cu->fsize) - sb->w;
}
}
ct++;
}
-
+
cu->lines = 1;
for (i = 0; i <= slen; i++) {
ascii = mem[i];
@@ -1092,7 +1092,7 @@ makebreak:
copy_m3_m4(cmat, cu->textoncurve->obmat);
mul_m3_m3m3(cmat, cmat, imat3);
sizefac = normalize_v3(cmat[0]) / cu->fsize;
-
+
minx = miny = 1.0e20f;
maxx = maxy = -1.0e20f;
ct = chartransdata;
@@ -1102,17 +1102,17 @@ makebreak:
if (miny > ct->yof) miny = ct->yof;
if (maxy < ct->yof) maxy = ct->yof;
}
-
+
/* we put the x-coordinaat exact at the curve, the y is rotated */
-
+
/* length correction */
distfac = sizefac * cu->textoncurve->curve_cache->path->totdist / (maxx - minx);
timeofs = 0.0f;
-
+
if (distfac > 1.0f) {
/* path longer than text: spacemode involves */
distfac = 1.0f / distfac;
-
+
if (cu->spacemode == CU_ALIGN_X_RIGHT) {
timeofs = 1.0f - distfac;
}
@@ -1128,14 +1128,14 @@ makebreak:
}
distfac /= (maxx - minx);
-
+
timeofs += distfac * cu->xof; /* not cyclic */
-
+
ct = chartransdata;
for (i = 0; i < slen; i++, ct++) {
float ctime, dtime, vec[4], tvec[4], rotvec[3];
float si, co;
-
+
/* rotate around center character */
info = &custrinfo[i];
ascii = mem[i];
@@ -1144,7 +1144,7 @@ makebreak:
}
che = find_vfont_char(vfd, ascii);
-
+
twidth = char_width(cu, che, info);
dtime = distfac * 0.5f * twidth;
@@ -1156,16 +1156,16 @@ makebreak:
/* vec, tvec need 4 items */
where_on_path(cu->textoncurve, ctime, vec, tvec, NULL, NULL, NULL);
where_on_path(cu->textoncurve, ctime + dtime, tvec, rotvec, NULL, NULL, NULL);
-
+
mul_v3_fl(vec, sizefac);
-
+
ct->rot = (float)M_PI - atan2f(rotvec[1], rotvec[0]);
si = sinf(ct->rot);
co = cosf(ct->rot);
yof = ct->yof;
-
+
ct->xof = vec[0] + si * yof;
ct->yof = vec[1] + co * yof;
@@ -1224,29 +1224,29 @@ makebreak:
}
}
}
-
+
/* cursor first */
if (ef) {
float si, co;
-
+
ct = &chartransdata[ef->pos];
si = sinf(ct->rot);
co = cosf(ct->rot);
f = ef->textcurs[0];
-
+
f[0] = cu->fsize * (-0.1f * co + ct->xof);
f[1] = cu->fsize * ( 0.1f * si + ct->yof);
-
+
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[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);
-
+
}
if (mode == FO_SELCHANGE) {
@@ -1258,7 +1258,7 @@ makebreak:
if (mode == FO_EDIT) {
/* make nurbdata */
BKE_nurbList_free(r_nubase);
-
+
ct = chartransdata;
for (i = 0; i < slen; i++) {
unsigned int cha = (unsigned int) mem[i];