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:
authorDalai Felinto <dfelinto@gmail.com>2018-09-12 19:00:30 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-11-27 02:47:33 +0300
commit8e65e38649f4a926e3c08cb414ff4789454d0f07 (patch)
tree9a915d8673ed52d5dbab65a24dddc308bfa71c9f /source/blender/makesrna/intern/rna_curve.c
parent63db89b5c1e451889ccfd2acae0fabe83e427e6a (diff)
Font textbox overflow: Different methods
Sometimes the text doesn't fit. What to do in this case? * Overflow: The default behaviour still is to overflow the text. * Truncated: If any text box is defined we can also not draw the text that goes outside the text boxes. * Scale to Fit: For single-text box texts we can scale down the text until it fits. To support textboxes we are bisecting the scale until we find a good match. Right now the hardcoded iteration limit is 20, and the threshold 0.0001f. An alternative in the future would be to tackle this by integrating existing layout engines such as HarfBuzz. Note: Scale to fit won't work for multiple text-boxes if any of them has either width or height as zero. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D3874 Feature development sponsored by Viddyoze.
Diffstat (limited to 'source/blender/makesrna/intern/rna_curve.c')
-rw-r--r--source/blender/makesrna/intern/rna_curve.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index e9671754288..41849f3efe7 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -974,6 +974,13 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
{0, NULL, 0, NULL, NULL}
};
+ static const EnumPropertyItem prop_overflow_items[] = {
+ {CU_OVERFLOW_NONE, "NONE", 0, "Overflow", "Let the text overflow outside the text boxes"},
+ {CU_OVERFLOW_SCALE, "SCALE", 0, "Scale to Fit", "Scale down the text to fit inside the text boxes"},
+ {CU_OVERFLOW_TRUNCATE, "TRUNCATE", 0, "Truncate", "Truncate the text that would go outside the text boxes"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* Enums */
prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spacemode");
@@ -987,6 +994,14 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
RNA_def_property_ui_text(prop, "Text Vertical Align", "Text vertical align from the object center");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "overflow");
+ RNA_def_property_enum_items(prop, prop_overflow_items);
+ RNA_def_property_enum_default(prop, CU_OVERFLOW_NONE);
+ RNA_def_property_ui_text(prop, "Textbox Overflow",
+ "Handle the text behaviour when it doesn't fit in the text boxes");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
/* number values */
prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fsize");