From 3d6564740af62a3faf65bc0198dc18f6b0d7d3dc Mon Sep 17 00:00:00 2001 From: Alexander Ewering Date: Fri, 11 Nov 2005 15:19:15 +0000 Subject: [PATCH] Fix "Copy Attributes -> Font Settings" to copy the new vars (wordspace, underline stuff) as well. Attempt at fixing editmode undo, but not successful. I'll create a bug- report and assign it to Mika, because I only understand "train station" (German saying :-) when looking at the code. --- source/blender/src/editfont.c | 23 +++++++++++++---------- source/blender/src/editobject.c | 3 +++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c index 8d1aa5818fd..35b9f8fd7c4 100644 --- a/source/blender/src/editfont.c +++ b/source/blender/src/editfont.c @@ -1226,16 +1226,18 @@ static void undoFont_to_editFont(void *strv) { Curve *cu= G.obedit->data; char *str= strv; - - utf8towchar_(textbuf, str); - - cu->pos= *((short *)str); - cu->len= wcslen(textbuf); - memcpy(textbufinfo, str+2+cu->len+1, cu->len*sizeof(CharInfo)); + cu->pos= *((short *)str); + cu->len= *((short *)(str+2)); + + memcpy(textbuf, str+4, cu->len+1); + memcpy(textbufinfo, str+4+cu->len+1, cu->len*sizeof(CharInfo)); + cu->selstart = cu->selend = 0; DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); + update_string(cu); + allqueue(REDRAWVIEW3D, 0); } @@ -1244,12 +1246,13 @@ static void *editFont_to_undoFont(void) Curve *cu= G.obedit->data; char *str; - str= MEM_callocN(MAXTEXT+4+(MAXTEXT+4)*sizeof(CharInfo), "string undo"); - - wcs2utf8s(str, textbuf); + str= MEM_callocN(MAXTEXT+6+(MAXTEXT+4)*sizeof(CharInfo), "string undo"); + memcpy(str+4, textbuf, cu->len+1); + memcpy(str+4+cu->len+1, textbufinfo, cu->len*sizeof(CharInfo)); + *((short *)str)= cu->pos; - memcpy(str+2+cu->len+1, textbufinfo, cu->len*sizeof(CharInfo)); + *((short *)(str+2))= cu->len; return str; } diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 12f11e6a37c..1db335c6482 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -2723,6 +2723,9 @@ void copy_attr(short event) cu1->xof= cu->xof; cu1->yof= cu->yof; cu1->textoncurve= cu->textoncurve; + cu1->wordspace= cu->wordspace; + cu1->ulpos= cu->ulpos; + cu1->ulheight= cu->ulheight; if(cu1->vfont) cu1->vfont->id.us--; cu1->vfont= cu->vfont; id_us_plus((ID *)cu1->vfont);