gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java


From: Asko Soukka
Subject: Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java
Date: Fri, 10 Jan 2003 20:41:28 +0200 (EET)

Hi :)

Fri, 10 Jan 2003, Benja Fallenstein wrote:
> >     Fixing LinebrokenCellContentView.getSize()
> Can you explain this fix to me, please? I don't understand it :)

I tried to do this:

lines = s.split("\n")
max_width =
style.getWidth(line[0], scale)
for line in lines:
  line_width = style.getWidth(line, scale)
  if line_width > max_width:
    max_width = line_width

Without this PP looked ugly, because width of a bouding box it drew
around linked cell was width of the whole content of that cell. Now
LinebrokenCellContentView returns the width of its longest line.

Does this broke something? At least all tests still passed O:-)

> > +   /**
> > +    * Width of LinebrokenCellContentView is the
> > +    * width of its longest line.
> > +    */
> >     float w = style.getWidth(s, scale);
> > +        int linebreak = s.indexOf('\n');
> > +   if (linebreak != -1) {
> > +       w = style.getWidth(s.substring(0, linebreak), scale);
> > +       int anotherLinebreak = s.indexOf('\n', linebreak+1);
> > +       while (anotherLinebreak != -1) {
> > +           float anotherWidth = style.getWidth(s.substring(linebreak+1, 
> > anotherLinebreak), scale);
> > +           if (w < anotherWidth) w = anotherWidth;
> > +           linebreak = anotherLinebreak;
> > +           anotherLinebreak = s.indexOf('\n', linebreak+1);
> > +       }
> > +       float anotherWidth = style.getWidth(s.substring(linebreak+1, 
> > s.length()), scale);
> > +       if (w < anotherWidth) w = anotherWidth;
> > +   }
> > +

-- 
Asko Soukka     | Taitoniekantie 9 A 603 | address@hidden
+358-40-8235947 | FIN-40740 JYVÄSKYLÄ    | http://www.iki.fi/asko.soukka/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]