ant.simianzombie.com
September 06, 2010, 10:09:46 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Textbox Plus  (Read 961 times)
Lakedaemon
Newbie
*
Posts: 36


View Profile
« on: January 23, 2010, 04:32:22 PM »

I don't really know if this thread is what it is all about, but...

I have started implementing a kind of "Xml renderer" for Woopsi, which means basically that :

It eats an utf-8 XML string and it speats out and draws lots of "blocks",
each with x,y,width, height, in which you can have :
_text (partially implemented)
_gadget (not started)
_other stuff like images/spacers/springs (not started)

It is intended to be an enhanced multilinetextbox on steroids and depends on expat (it needs a lightning fast/memory efficient embeddable xml parser) ans freetype (need to be able to display unicode chars)

expat only adds like 40ko to a rom and you only have to give it a buffer, whose size you deicide (I made it 1ko) for it to work... ( a nice side effect : it allows you to have xml configuration files instead of basic text files).

For the time being, it displays multicolored strings on 1 line, with the setText method.

Next step is either :
a) try to make the wrap algorithm work
b) modify/add methods to the freetype fontcache and face manager to be able to display
multicolored/multisized/multi faced strings (think italic, bold, titles,...)
c) try to think out how to implement other methods like :
remove (quite easy), append (quite easy), insert (ouchhh...quite hard)...
 
Logged
Ant
Administrator
Full Member
*****
Posts: 138


View Profile WWW Email
« Reply #1 on: January 24, 2010, 11:29:42 AM »

I've split the topic and moved this post to here, which is more appropriate.

Sounds good!  Also sounds very complicated...   Grin
Logged
Lakedaemon
Newbie
*
Posts: 36


View Profile
« Reply #2 on: June 29, 2010, 07:23:32 PM »

Hello. After 5 months of inactivity, I have started working on this new widget again.

Basically, I rewrote what I had done in january to remove the dependency of Expat (it now requires the mxml library that is somehow more powerfull).
Here is the result :
http://www.lakedaemon.org/XmlBox.zip

I coded this the last five days and it's basically a multilinebox on steroids that allows the use of many fonts, many fonts type (freetype, packefont, monofont, glyphfont), many widths/sizes (require freetype for this), many colors, in the same window.
And it's just the start, I have grand plans for the new widget.

It requires only little changes in the woopsi library to work :
Some drawbaselinetext() methods in graphics/graphicports/basefont/packedfont files.
It is essentially the same as the drawtext methods, except that it draws the font on a BASELINE (it is necessary if you want many fonts to play well together) instead of having the bottom of the fonts on a line.

you must have a getCharTop(codepoint) {return top;} method in each font too (but the "top" number is a constant for the font..7 for arial9 for example).

I have some strange bug remaining. Could you try draging the bottom screen in the following build and tell me where it could come from :
http://www.lakedaemon.org/XmlTextBoxbug.nds


I'll post what I did in a few days one I have cleaned things up a bit.

I think that I may have found some bug in packedfont16.cpp too. See this :
void PackedFont16::renderChar(
      const u16* pixelData, u16 pixelsPerRow,
      MutableBitmapBase* bitmap,
      s16 x, s16 y,
      u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)
{
   u16 colour = getColour();

   
   
   //
   //
   //                                  Test if there is rendering to be done
   //
   //
   if ((clipY2< y) || (clipY1> y +getHeight()-1) || (x>clipX2) || (x+pixelsPerRow< clipX1)) return;   
   // There is a bug there if you don't do these tests : if y is much smaller than y, you'll be copying lots of pixels in the following while loop
   //                             
   //                                              BUG THERE
   //
   //         
   
   // adjust clipY2 to be the last row+1 in the glyph
   // so we only write while (y<=clipY2)
   if (clipY2 > y + getHeight() - 1) {
      clipY2 = y + getHeight() - 1;
   }

...some code...
   while (y <= clipY2) {

pixels get copied
};


Best regards,
Lakedaemon
Logged
Ant
Administrator
Full Member
*****
Posts: 138


View Profile WWW Email
« Reply #3 on: July 01, 2010, 10:32:40 PM »

I've added the bugfix to the packed font class and will add the extra baseline methods in soon.  Regarding the jittering left and right bug, I think I've seen something like that before.  I'll try to track it down.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!