diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-09-12 19:00:30 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-11-27 02:47:33 +0300 |
commit | 8e65e38649f4a926e3c08cb414ff4789454d0f07 (patch) | |
tree | 9a915d8673ed52d5dbab65a24dddc308bfa71c9f /source/blender/makesdna/DNA_curve_types.h | |
parent | 63db89b5c1e451889ccfd2acae0fabe83e427e6a (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/makesdna/DNA_curve_types.h')
-rw-r--r-- | source/blender/makesdna/DNA_curve_types.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index b8b1066e1a9..0cf60a98376 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -225,11 +225,12 @@ typedef struct Curve { /* edit, index in active nurb (BPoint or BezTriple) */ int actvert; - char pad[4]; + char overflow; + char spacemode, align_y; + char pad[3]; /* font part */ short lines; - char spacemode, align_y; float spacing, linedist, shear, fsize, wordspace, ulpos, ulheight; float xof, yof; float linewidth; @@ -264,6 +265,8 @@ typedef struct Curve { char bevfac1_mapping, bevfac2_mapping; char pad2[2]; + float fsize_realtime; + float pad3; void *batch_cache; } Curve; @@ -340,6 +343,13 @@ enum { CU_ALIGN_Y_BOTTOM = 4, }; +/* Curve.overflow. */ +enum { + CU_OVERFLOW_NONE = 0, + CU_OVERFLOW_SCALE = 1, + CU_OVERFLOW_TRUNCATE = 2, +}; + /* Nurb.flag */ enum { CU_SMOOTH = 1 << 0, @@ -457,13 +467,14 @@ typedef enum eBezTriple_KeyframeType { /* CharInfo.flag */ enum { - /* note: CU_CHINFO_WRAP and CU_CHINFO_SMALLCAPS_TEST are set dynamically */ + /* note: CU_CHINFO_WRAP, CU_CHINFO_SMALLCAPS_TEST and CU_CHINFO_TRUNCATE are set dynamically */ CU_CHINFO_BOLD = 1 << 0, CU_CHINFO_ITALIC = 1 << 1, CU_CHINFO_UNDERLINE = 1 << 2, CU_CHINFO_WRAP = 1 << 3, /* wordwrap occurred here */ CU_CHINFO_SMALLCAPS = 1 << 4, CU_CHINFO_SMALLCAPS_CHECK = 1 << 5, /* set at runtime, checks if case switching is needed */ + CU_CHINFO_OVERFLOW = 1 << 6, /* Set at runtime, indicates char that doesn't fit in text boxes. */ }; /* mixed with KEY_LINEAR but define here since only curve supports */ |