Bug in Text editor


#1

Hi jules,
I am using text editor with different font size, somehow word wrap doesnt seem to work as expected. If a word has different font size eg: Software, it split the word to next line.

        Another small bug in cursor, if current font size is smaller than previous the cursor position is not proper ie, its drawing from height of the line instead it should be lineHeight - cursorHeight.

regards
Bala


#2

Ok, I see. I’ve fixed the cursor thing, so maybe try using the code from the tip of SVN, as that might also relate to your other problem…


#3

Hi,
I checked out the latest code from SVN, still bug is there.

Here is what i have done,

   1) In Juce demo, void FontAndTextDemo::updatePreviewBoxText() i changed textBox->applyFontToAllText (font); to textBox->setFont(font); 

   2) Then i typed a word in which each character is of different font size. 

   Below image may give the clear picture of what is going wrong.
 [url]http://picasaweb.google.co.uk/pnbalakumar/Public/photo#5185380283948879378[/url]

regards
Bala


#4

ok, thanks. I’ve checked in a fix for that now…


#5

Thank a lot .

I have found some more bugs,

  1. When i type word which is too big, it gives access violation while wrapping the word to next line (function wrapCurrentAtom() atom is NULL). Happens only if the first word needs to be wrapped to next line.

  2. If there is word where font size is different for each character, while wrapping the text to next line it doesnt trim the space in front of that word.

regards
Bala


#6

Thanks - you’re clearly giving the component a good thrashing! I’ve checked in a fix now, let me know how you get on.


#7

Thnxs Jules. Appreciate your help. However i noticed that initial bug has reappeared after last fix.
http://picasaweb.google.co.uk/pnbalakumar/Public/photo#5190164391782598562

And if the first word in the editor has character of different font size, an extra line space while word wrapping.
http://picasaweb.google.co.uk/pnbalakumar/Public/photo#5190164396077565874

I wasnt able to report all bugs at once bcoz of my schedule. Sorry for that!!!.

-Bala


#8

Ah… that pesky iterator class… I should probably refactor it a bit so it’s less complicated. Thanks.


#9

I have implemented Text alignment feature in text editor by changing iterator class, i dont know if this is right way to implement. U can check the code here

http://pnbalakumar.googlepages.com/source

U have any plan of adding this feature in near future?

-Bala


#10

What’s going on on this front ?


#11

Been too busy to try it. Will do when I can.


#12

Hi jules,
A small bug in class TextAtom, in function getTrimmedText () whole atomText is return instead it has to be trimmed. Bcoz of this sometimes same character is drawn in two lines.

          Here is the fix 

const juce::String getTrimmedText (const juce::tchar passwordCharacter) const
{
if (passwordCharacter == 0)
return atomText.substring(0, numChars);
else if (isNewLine())
return juce::String::empty;
else
return juce::String::repeatedString (juce::String::charToString (passwordCharacter), numChars);
}

regards
Bala


#13

Ah, thanks very much!