diff options
author | Alexander Ewering <blender@instinctive.de> | 2005-08-29 16:46:07 +0400 |
---|---|---|
committer | Alexander Ewering <blender@instinctive.de> | 2005-08-29 16:46:07 +0400 |
commit | a07394ef2cfd8cb54e68e8bfb1e7210ee4b2b1b4 (patch) | |
tree | 2fcb1b06b7e8dd989510190b8242203c9175905a /source/blender/src/editfont.c | |
parent | c921ee25cc71decc843b230fb28a7fb195fb6786 (diff) |
More text object fancyness, and fixes:
- "Flush" is now split into two seperate Alignment modes "Flush" and
"Justify":
- Justify does exactly the same as a normal word processor's justify
function does, and in addition, it uses *whitespace* instead of
*character spacing* (kerning) to fill lines. Much more readable.
- Flush is pretty much the old Blender "Flush" mode - and as such it
uses character spacing to fill lines. Just as Justify, this only
works with at least one textframe.
- Underlining for text objects. Not a lot to explain. New button "U" in
the editbuttons, and CTRL-U as hotkey toggle underlining for newly
entered characters or for the selection, just like CTRL-B/CTRL-I do for
bold/italic.
Underline height (thickness) and Underline position (vertical) can be
set in the editbuttons.
Implemented as CU_POLY polygon curves.
- The B, U and i buttons (and the corresponding CTRL-B/U/I keystrokes)
have been fixed to only affect *one* attribute at a time. Formerly,
hitting CTRL-B when no other style was active, on a text portion with
italics text, for example, would kill the italics and just apply bold.
Now, these attributes always add or substract only, but do not
replace the style.
- In the past, there were bugs with material indices uninitialized, and
thus crashes in the renderer with illegal material indices.
Even though I assume they have been fixed, I've put in a check that
checks (hah) if the material index of a character is illegal (bigger
than ob->totcol), and then sets it to zero, and spits out a warning
on stderr.
If you see such warnings, please report and link to the .blend.
- Bugfix: All alignment modes only worked if there were at least *two*
lines of text in the text object. Fixed
There's now a regression test file for text objects, please add to the
corresponding repository:
http://blender.instinctive.de/downloads/release/demo/text-regression.blend.gz
Diffstat (limited to 'source/blender/src/editfont.c')
-rw-r--r-- | source/blender/src/editfont.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c index a1253007d3d..278c70eb15f 100644 --- a/source/blender/src/editfont.c +++ b/source/blender/src/editfont.c @@ -523,7 +523,8 @@ static void pasteselection(void) } } -int style_to_sel(void) { +int style_to_sel(int style, int toggle) +{ int selstart, selend; int i; Curve *cu; @@ -533,8 +534,11 @@ int style_to_sel(void) { if (getselection(&selstart, &selend)) { for (i=selstart; i<=selend; i++) { - textbufinfo[i].flag &= ~CU_STYLE; - textbufinfo[i].flag |= (cu->curinfo.flag & CU_STYLE); + if (toggle==0) { + textbufinfo[i].flag &= ~style; + } else { + textbufinfo[i].flag |= style; + } } return 1; } @@ -789,7 +793,7 @@ void do_textedit(unsigned short event, short val, char _ascii) case IKEY: if (G.qual & LR_CTRLKEY) { cu->curinfo.flag ^= CU_ITALIC; - if (style_to_sel()) doit= 1; + if (style_to_sel(CU_ITALIC, cu->curinfo.flag & CU_ITALIC)) doit= 1; allqueue(REDRAWBUTSEDIT, 0); } break; @@ -797,11 +801,19 @@ void do_textedit(unsigned short event, short val, char _ascii) case BKEY: if (G.qual & LR_CTRLKEY) { cu->curinfo.flag ^= CU_BOLD; - if (style_to_sel()) doit= 1; + if (style_to_sel(CU_BOLD, cu->curinfo.flag & CU_BOLD)) doit= 1; allqueue(REDRAWBUTSEDIT, 0); } break; + case UKEY: + if (G.qual & LR_CTRLKEY) { + cu->curinfo.flag ^= CU_UNDERLINE; + if (style_to_sel(CU_UNDERLINE, cu->curinfo.flag & CU_UNDERLINE)) doit= 1; + allqueue(REDRAWBUTSEDIT, 0); + } + break; + case XKEY: if (G.qual & LR_CTRLKEY) { copyselection(); |