Re: [RFC] New fl_BlockLayout::findPointCoords implementation


Subject: Re: [RFC] New fl_BlockLayout::findPointCoords implementation
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Mon May 29 2000 - 09:58:23 CDT


On Mon, 29 May 2000, Jesper Skov wrote:
>
> This is explained by a subtlety in the old code; after finding the
> requested offset, it would return the Run at that offset, but
> calculate position/size from the previous Run. I simply overlooked
> this when starting over - and didn't try different font sizes, so
> using the returned Run for cursor calculations was fine.
>
> Anyway, it's is linked to this:
>
> Martin> ... and if you press "superscript" or "subscript" the cursor
> Martin> immediately changes size and location correctly. This didn't
> Martin> used to work. Also changing font size immediately changes the
> Martin> size of the cursor. This also didn't use to work on new lines
> Martin> after hitting return.
>
> It's impossible for the code to distinguish between these two
> cases. In the first it should return the size of the previous Run, in
> the second it should return the size of the current Run (being the
> first and only Run having the new font properties).
>
> I can only guess at how to fix this, but it probably introduces other
> problems: have all font style/size changes be marked by an empty Run
> which cannot contain the point. Then the "return-size-of-previous-Run"
> semantics of the old code would work in both situations.
>
> Implementing this would be beyond my knowledge of AbiWord
> though. Alternative implementation suggestions and/or actual
> implemetations of this appreciated :)
>

OK here is what I think should be done. You are the third person that I
know of who has tried to fix this code via the method of locating the run
on the line. I was another. I think that boundaries between different runs
should be put in a too hard basket and delt with via a seperate piece of
code.

This code would calculate the cursor size and location directly from the
font and super/sub scriptness of the current entry point. The x coordinate
is just what is already calculated. This code basically duplicates the
line height calculation code. You could just copy the revelent bits fron
fp_Line and put it into a new function within fl_Blocklayout. Initially
just use the string passing code to get the character properties. Later
the new function could use Sam's new piece table accessor functions
he proposed a few days ago.

What do you think?

Cheers

Martin



This archive was generated by hypermail 2b25 : Mon May 29 2000 - 09:58:35 CDT