TextEditor - 2 issues with fonts


The following code (Changed in JuceDemo:FontsAndTextDemo):

textBox.clear(); textBox.setFont(font); textBox.insertTextAtCaret ("The Quick Brown Fox Jumps Over The Lazy Dog\n\n"); font.setUnderline(true); textBox.setFont(font); textBox.insertTextAtCaret("Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789");

Produces this:

[list][]The underline is applied to the entire text.[/][]The underline skips spaces.[/][/list]
Am I doing something wrong here or are these known issues?


setFont() sets the font for the entire thing, so that’s not a bug.

As for underlining the spaces… I never really intended it to work for underlined text, and adding support for it would involve quite complicated changes, so I’m not really sure it’d be worth me fixing it.

Well then you might want to change the documentation of TextEditor::setFont and remove TextEditor::applyFontToAllText

[code]/** Sets the font to use for newly added text.

    This will change the font that will be used next time any text is added or entered
    into the editor. It won't change the font of any existing text - to do that, use
    applyFontToAllText() instead.

    @see applyFontToAllText

Is there a way to have both underlined and regular text at the same time?
I remember having it and it broke (can’t tell exactly when).

Ah… so sorry: you’re right. I was getting confused between setFont and applyFontToAllText. There was a little buggette in there, which I’ve fixed now, thanks!