diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-03 10:04:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-03 10:08:23 +0400 |
commit | 15bc30f4ee49c69f3ed6f92701a0f5cd52d306c5 (patch) | |
tree | fc77fe7096673256d90c512267adb58eb53c23de /source/blender/blenloader/intern/writefile.c | |
parent | a5cb2229abbc7d43f34dabea332afd33614fc0db (diff) |
Text3d: store number of characters and utf8 length separately
EditFont's use of Curve.len was very confusing, in editmode it
represented the number of characters, in object mode the number of
bytes. add Curve.len_wchar and keep track of both.
Also don't convert the editmode text into utf8 on every keystroke.
Now this is done on exiting editmode or save - to match most other
object types.
This also fixes curves 'body_format' being reported with an invalid size.
Diffstat (limited to 'source/blender/blenloader/intern/writefile.c')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 9ffe4dae82a..beb8d584e41 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1664,12 +1664,8 @@ static void write_curves(WriteData *wd, ListBase *idbase) if (cu->adt) write_animdata(wd, cu->adt); if (cu->vfont) { - /* TODO, sort out 'cu->len', in editmode its character, object mode its bytes */ - size_t len_bytes; - size_t len_chars = BLI_strlen_utf8_ex(cu->str, &len_bytes); - - writedata(wd, DATA, len_bytes + 1, cu->str); - writestruct(wd, DATA, "CharInfo", len_chars + 1, cu->strinfo); + writedata(wd, DATA, cu->len + 1, cu->str); + writestruct(wd, DATA, "CharInfo", cu->len_wchar + 1, cu->strinfo); writestruct(wd, DATA, "TextBox", cu->totbox, cu->tb); } else { |