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>2013-12-28 12:04:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-12-28 12:06:45 +0400
commit1a91b8bd5d6ad6a2a4fa62ae7719da01741849f4 (patch)
tree2a7b13c3b34467ff0c1c770a769ace059936f233 /source/blender/blenkernel/intern/font.c
parent961d0409c89dff01fd4c2c5f9d6e0406068e7552 (diff)
Fix for 3d fonts loading the character of the string terminator.
also remove redundant call to wcslen and ensure FT_Init_FreeType runs once the font loads.
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r--source/blender/blenkernel/intern/font.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 0839ed82a8d..40da6e01d4c 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -524,10 +524,7 @@ struct CharTrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int
utf8len = BLI_strlen_utf8(cu->str);
mem = MEM_mallocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem");
- BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1);
-
- /* Count the wchar_t string length */
- slen = wcslen(mem);
+ slen = BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1);
if (cu->ulheight == 0.0f)
cu->ulheight = 0.05f;
@@ -597,20 +594,19 @@ makebreak:
if (vfont == NULL) break;
- che = find_vfont_char(vfd, ascii);
+ if (i != slen) {
+ che = find_vfont_char(vfd, ascii);
- /*
- * The character wasn't in the current curve base so load it
- * But if the font is built-in then do not try loading since
- * whole font is in the memory already
- */
- if (che == NULL && BKE_vfont_is_builtin(vfont) == FALSE) {
- BLI_vfontchar_from_freetypefont(vfont, ascii);
+ /*
+ * The character wasn't in the current curve base so load it
+ * But if the font is built-in then do not try loading since
+ * whole font is in the memory already
+ */
+ if (che == NULL && BKE_vfont_is_builtin(vfont) == false) {
+ che = BLI_vfontchar_from_freetypefont(vfont, ascii);
+ }
}
- /* Try getting the character again from the list */
- che = find_vfont_char(vfd, ascii);
-
/* No VFont found */
if (vfont == NULL) {
if (mem)