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:
authorJacques Lucke <jacques@blender.org>2021-09-29 13:40:36 +0300
committerJacques Lucke <jacques@blender.org>2021-09-29 13:40:36 +0300
commit0c32e3b312212196b2748327713ab3bc31825412 (patch)
treebb9dfe106f118d525aeda75cfc382aaf0f84c270 /source/blender/blenkernel/intern/font.c
parent4cf4bb2664ebe145dac9715bbbfcc2b96f5ff175 (diff)
Fix T91756: String to Curve node produces NaN when size is zero
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r--source/blender/blenkernel/intern/font.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 1053b727cbc..0e159418724 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -34,6 +34,7 @@
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BLI_math_base_safe.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
@@ -794,8 +795,8 @@ static bool vfont_to_curve(Object *ob,
bool ok = false;
const float font_size = cu->fsize * iter_data->scale_to_fit;
const bool word_wrap = iter_data->word_wrap;
- const float xof_scale = cu->xof / font_size;
- const float yof_scale = cu->yof / font_size;
+ const float xof_scale = safe_divide(cu->xof, font_size);
+ const float yof_scale = safe_divide(cu->yof, font_size);
int last_line = -1;
/* Length of the text disregarding \n breaks. */
float current_line_length = 0.0f;
@@ -889,7 +890,7 @@ static bool vfont_to_curve(Object *ob,
linedist = cu->linedist;
curbox = 0;
- textbox_scale(&tb_scale, &cu->tb[curbox], 1.0f / font_size);
+ textbox_scale(&tb_scale, &cu->tb[curbox], safe_divide(1.0f, font_size));
use_textbox = (tb_scale.w != 0.0f);
xof = MARGIN_X_MIN;