[Top][All Lists]
[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: |
Sat, 11 Jan 2003 22:22:30 +0200 (EET) |
Sat, 11 Jan 2003, Benja Fallenstein wrote:
> > Another way to do this is could be the way I did finding font size in
> > AWT's ScalableFont. Recursive function, which starts from the middle of
> > the strint and checks is the wanted position greater or lesser, splits
> > string into half, and starts a new recursions with the correct half. Of
> > course this needs a little optimization, e.g. check first shoudl the
> > cursor be either at the beginning or at the end of the line.
> I don't understand this. Can you explain in terms of, "When the user
> hits the 'Up' key, the computer..."? :-)
Now, when I think this second time, probably this is too complicated for
that :) Because the line has only about 80 character's it could be better
to do only one dummy loop, which stops when a character far enough from
the beginning of the line is caught.
Anyway, if you still want to read about that recursion I tried
to wrote about it below. You should also see getScale and
seekBestScale in ScalableFont and run AWT client with debugging
on it.
-------------------------------------------------------------
Ok. We have two lines (cursor is marked as '_'):
"Last night I saw an astonishing vision, where"
"a green fox jumped_ over neighbour's fence."
- user hits the 'up' key
- computer calcultes the width of "a green fox jumped
do
- if the width is zero, go to the beginning of the line
- if the width is greater than width of the previous line
go to the end of the line
- computer splits the previous line into half:
"Last night I saw an as\
tonishing vision, where"
- if the width is smaller than the breaking point, select
the first half
- if the width is greater than the breaking point, select
the last half and the width decreases by the first half
- now
loop this with the selected half to reduce the size of possible
area for the cursor
The recursive loop could be run until only on character is left, but
probably it's more economical to stop it in right time and check the rest
of the are character by character.
--
Asko Soukka | Taitoniekantie 9 A 603 | address@hidden
+358-40-8235947 | FIN-40740 JYVÄSKYLÄ | http://www.iki.fi/asko.soukka/
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, (continued)
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Asko Soukka, 2003/01/10
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/10
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Tuomas Lukka, 2003/01/10
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/10
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Asko Soukka, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Tuomas Lukka, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Asko Soukka, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Asko Soukka, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java,
Asko Soukka <=
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Tuomas Lukka, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Tuomas Lukka, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Tuomas Lukka, 2003/01/12
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/12
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Matti Katila, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Benja Fallenstein, 2003/01/11
- Re: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java, Tuomas Lukka, 2003/01/10