Difference between revisions of "Education Project/Effort/Math baseline alignment/Mails"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 54: Line 54:
 
Hello Rakesh,
 
Hello Rakesh,
  
> Hello Thomas,
+
 
>
+
> Hello Thomas, <br>
> I had been debugging starmath module. Using some test cases and
+
><br>
> checking the flow.
+
> I had been debugging starmath module. Using some test cases and<br>
>
+
> checking the flow.<br>
> There are some very basic doubts:
+
><br>
>
+
> There are some very basic doubts:<br>
> 1. In my view centre(0,0) of co-ordinate system from which all
+
><br>
> calculations are made (e.g calculation of Point, Alignment etc) is at
+
> 1. In my view centre(0,0) of co-ordinate system from which all<br>
> top left corner.  The +ve side of Y axis goes down the left corner
+
> calculations are made (e.g calculation of Point, Alignment etc) is at<br>
> towards bottom and +ve side of X axis goes horizontal towards top
+
> top left corner.  The +ve side of Y axis goes down the left corner<br>
> right corned. May you confirm this ?
+
> towards bottom and +ve side of X axis goes horizontal towards top<br>
>
+
> right corned. May you confirm this ?<br>
 +
><br>
 +
 
 +
 
 
Yes. That is not what one might expect, but for all window based
 
Yes. That is not what one might expect, but for all window based
 
coordinates in most UI API's it is the same.
 
coordinates in most UI API's it is the same.
  
> 2. Now as per discussion which has happened so far, every Node needs
+
 
> to have baseline calculated. To start with, I think I am ready to
+
> 2. Now as per discussion which has happened so far, every Node needs<br>
> write code for simple cases like "over". My strategy for over is
+
> to have baseline calculated. To start with, I think I am ready to<br>
> recursive calculation of baseline. After moving numerator to top and
+
> write code for simple cases like "over". My strategy for over is<br>
> denominator to bottom we will find the average of both and assign this
+
> recursive calculation of baseline. After moving numerator to top and<br>
> to baseline of whole fraction and all this will go on recursively
+
> denominator to bottom we will find the average of both and assign this<br>
> automatically. Does it sound good ?
+
> to baseline of whole fraction and all this will go on recursively<br>
>
+
> automatically. Does it sound good ?<br>
 +
><br>
 
> something like(just a pseudo code ) :
 
> something like(just a pseudo code ) :
 
>
 
>
Line 87: Line 91:
 
>        }
 
>        }
 
>
 
>
> That needs fraction to be a node. And is it really a node ? I think yes.
+
> That needs fraction to be a node. And is it really a node ? I think yes.<br>
>
+
><br>
> These calculations are in SmBinVerNode::Arrange method.
+
> These calculations are in SmBinVerNode::Arrange method.<br>
>
+
><br>
  
The basic idea is not quite right. If formulas are layouted it is not
 
about finding the overall height and setting the mid as baseline.
 
Layout of fractions should be done in away that the horizontal line is
 
exactly on the same y position as a "-" in "a-b" would be if there were
 
further formula parts.
 
  
See for example: a - {a over b} over {y+z}  or  a - {H^{2^3}} over {H+H}
+
The basic idea is not quite right. If formulas are layouted it is not<br>
And compare with any book about physics or math.
+
about finding the overall height and setting the mid as baseline.<br>
 +
Layout of fractions should be done in away that the horizontal line is<br>
 +
exactly on the same y position as a "-" in "a-b" would be if there were<br>
 +
further formula parts.<br>
  
> 3. There are many messages and comments in French, and I would like to
+
See for example: a - {a over b} over {y+z}  or  a - {H^{2^3}} over {H+H}<br>
> start converting important ones as and when they come into English.
+
And compare with any book about physics or math.<br>
> Would that be fine ? And can I do it in same CWS ?
+
 
>
+
> 3. There are many messages and comments in French, and I would like to<br>
Err... Where are messages and comments in French?
+
> start converting important ones as and when they come into English.<br>
And do you want to put them into a CWS once you have them translated
+
> Would that be fine ? And can I do it in same CWS ?<br>
into English?
+
><br>
 +
<br>
 +
Err... Where are messages and comments in French?<br>
 +
And do you want to put them into a CWS once you have them translated<br>
 +
into English?<br>
 +
 
 +
> 4. Should I reassign issue to myself and create a CWS? It hasn't been<br>
 +
> created yet.<br>
 +
><br>
 +
<br>
  
> 4. Should I reassign issue to myself and create a CWS? It hasn't been
 
> created yet.
 
>
 
 
If you feel like it you can do so.
 
If you feel like it you can do so.
 
That would be a good idea if you want to share the code with otehrs e.g.
 
That would be a good idea if you want to share the code with otehrs e.g.
Line 119: Line 127:
 
a build done/installed from here if the CWS is on our servers...
 
a build done/installed from here if the CWS is on our servers...
  
> 5. Can baseline be negative ? I don't think so, but there are test
+
> 5. Can baseline be negative ? I don't think so, but there are test<br>
> cases where baseline has value -<number>
+
> cases where baseline has value -<number><br>
>
+
><br>
 +
 
 +
 
 
Yes it can become negative.
 
Yes it can become negative.
 
The actual baseline of the very outer line (or to put it different: of
 
The actual baseline of the very outer line (or to put it different: of
Line 157: Line 167:
 
-------------------------------------
 
-------------------------------------
  
2008/9/29 Thomas Lange - Sun Germany - ham02 - Hamburg <Thomas.Lange@sun.com>:
+
2008/9/29 Thomas Lange - Sun Germany - ham02 - Hamburg <Thomas.Lange@sun.com>:<br>
[..]
+
[..]<br>
- Show quoted text -
+
- Show quoted text -<br>
>> There are some very basic doubts:
+
>> There are some very basic doubts:<br>
>>
+
>><br>
>> 1. In my view centre(0,0) of co-ordinate system from which all
+
>> 1. In my view centre(0,0) of co-ordinate system from which all<br>
>> calculations are made (e.g calculation of Point, Alignment etc) is at
+
>> calculations are made (e.g calculation of Point, Alignment etc) is at<br>
>> top left corner.  The +ve side of Y axis goes down the left corner
+
>> top left corner.  The +ve side of Y axis goes down the left corner<br>
>> towards bottom and +ve side of X axis goes horizontal towards top
+
>> towards bottom and +ve side of X axis goes horizontal towards top<br>
>> right corned. May you confirm this ?
+
>> right corned. May you confirm this ?<br>
>>
+
>><br>
> Yes. That is not what one might expect, but for all window based
+
> Yes. That is not what one might expect, but for all window based<br>
> coordinates in most UI API's it is the same.
+
> coordinates in most UI API's it is the same.<br>
>
+
><br>
>> 2. Now as per discussion which has happened so far, every Node needs
+
>> 2. Now as per discussion which has happened so far, every Node needs<br>
>> to have baseline calculated. To start with, I think I am ready to
+
>> to have baseline calculated. To start with, I think I am ready to<br>
>> write code for simple cases like "over". My strategy for over is
+
>> write code for simple cases like "over". My strategy for over is<br>
>> recursive calculation of baseline. After moving numerator to top and
+
>> recursive calculation of baseline. After moving numerator to top and<br>
>> denominator to bottom we will find the average of both and assign this
+
>> denominator to bottom we will find the average of both and assign this<br>
>> to baseline of whole fraction and all this will go on recursively
+
>> to baseline of whole fraction and all this will go on recursively<br>
>> automatically. Does it sound good ?
+
>> automatically. Does it sound good ?<br>
>>
+
>><br>
>> something like(just a pseudo code ) :
+
>> something like(just a pseudo code ) :<br>
>>
+
>><br>
>>        if (pNum->HasBaseline() && pDenom->HasBaseline())
+
>>        if (pNum->HasBaseline() && pDenom->HasBaseline())<br>
>>        {
+
>>        {<br>
>>                SetHasBaseline(TRUE);
+
>>                SetHasBaseline(TRUE);<br>
>>                SetBaseline((pNum->GetBaseline() +
+
>>                SetBaseline((pNum->GetBaseline() +<br>
>> pDenom->GetBaseline()) / 2L);
+
>> pDenom->GetBaseline()) / 2L);<br>
>>        }
+
>>        }<br>
>>
+
>><br>
>> That needs fraction to be a node. And is it really a node ? I think yes.
+
>> That needs fraction to be a node. And is it really a node ? I think yes.<br>
>>
+
>><br>
>> These calculations are in SmBinVerNode::Arrange method.
+
>> These calculations are in SmBinVerNode::Arrange method.<br>
>>
+
>><br>
>
+
><br>
> The basic idea is not quite right. If formulas are layouted it is not
+
> The basic idea is not quite right. If formulas are layouted it is not<br>
> about finding the overall height and setting the mid as baseline.
+
> about finding the overall height and setting the mid as baseline.<br>
> Layout of fractions should be done in away that the horizontal line is
+
> Layout of fractions should be done in away that the horizontal line is<br>
> exactly on the same y position as a "-" in "a-b" would be if there were
+
> exactly on the same y position as a "-" in "a-b" would be if there were<br>
> further formula parts.
+
> further formula parts.<br>
>
+
><br>
> See for example: a - {a over b} over {y+z}  or  a - {H^{2^3}} over {H+H}
+
> See for example: a - {a over b} over {y+z}  or  a - {H^{2^3}} over {H+H}<br>
> And compare with any book about physics or math.
+
> And compare with any book about physics or math.<br>
>
+
><br>
 
+
<br>
 
So, for simple cases like "<X> over <Y>" baseline would simply be
 
So, for simple cases like "<X> over <Y>" baseline would simply be
 
baseline of "over", if I am getting it right.
 
baseline of "over", if I am getting it right.
  
>> 3. There are many messages and comments in French, and I would like to
+
>> 3. There are many messages and comments in French, and I would like to<br>
>> start converting important ones as and when they come into English.
+
>> start converting important ones as and when they come into English.<br>
>> Would that be fine ? And can I do it in same CWS ?
+
>> Would that be fine ? And can I do it in same CWS ?<br>
>>
+
>><br>
> Err... Where are messages and comments in French?
+
> Err... Where are messages and comments in French?<br>
> And do you want to put them into a CWS once you have them translated
+
> And do you want to put them into a CWS once you have them translated<br>
> into English?
+
> into English?<br>
>
+
><br>
  
 
Actually they where German and few where in French (I am not sure
 
Actually they where German and few where in French (I am not sure
Line 224: Line 234:
  
 
>> 4. Should I reassign issue to myself and create a CWS? It hasn't been
 
>> 4. Should I reassign issue to myself and create a CWS? It hasn't been
>> created yet.
+
>> created yet.<br>
>>
+
>><br>
> If you feel like it you can do so.
+
> If you feel like it you can do so.<br>
> That would be a good idea if you want to share the code with otehrs e.g.
+
> That would be a good idea if you want to share the code with otehrs e.g.<br>
> Eric or me while developing.
+
> Eric or me while developing.<br>
> If you want that just drop me a note and I will setup a CWS. That is
+
> If you want that just drop me a note and I will setup a CWS. That is<br>
> because in the end our QA will have a look at it and it is easier to get
+
> because in the end our QA will have a look at it and it is easier to get<br>
> a build done/installed from here if the CWS is on our servers...
+
> a build done/installed from here if the CWS is on our servers...<br>
>
+
><br>
  
 
Okay.
 
Okay.
Line 238: Line 248:
 
- Show quoted text -
 
- Show quoted text -
  
>> 5. Can baseline be negative ? I don't think so, but there are test
+
>> 5. Can baseline be negative ? I don't think so, but there are test<br>
>> cases where baseline has value -<number>
+
>> cases where baseline has value -<number><br>
>>
+
>><br>
> Yes it can become negative.
+
> Yes it can become negative.<br>
> The actual baseline of the very outer line (or to put it different: of
+
> The actual baseline of the very outer line (or to put it different: of<br>
> the first char in a line) should not be negative. But it wouldn't matter.
+
> the first char in a line) should not be negative. But it wouldn't matter.<br>
>
+
><br>
> The reason for baselines to become negative is because of aligning
+
> The reason for baselines to become negative is because of aligning<br>
> different nodes vertically. If you take the following two formulas for
+
> different nodes vertically. If you take the following two formulas for<br>
> example
+
> example<br>
>    x - x
+
>    x - x<br>
> and
+
> and<br>
>    stack{a#b#c#d#e#f#g}
+
>    stack{a#b#c#d#e#f#g}<br>
> each on it's own none of the baselines should be negative.
+
> each on it's own none of the baselines should be negative.<br>
> But if they are on the same line like
+
> But if they are on the same line like<br>
>    x - x stack{a#b#c#d#e#f#g}
+
>    x - x stack{a#b#c#d#e#f#g}<br>
> things may become different.
+
> things may become different.<br>
> The reason for this is that the alignment of the whole formula starts
+
> The reason for this is that the alignment of the whole formula starts<br>
> with the aligned node. And here that is 'x'. If, just for the example,
+
> with the aligned node. And here that is 'x'. If, just for the example,<br>
> we assume a lines height will be 100 then the rectangle for 'a' might be
+
> we assume a lines height will be 100 then the rectangle for 'a' might be<br>
> at pos 0,0 with size 60x100.
+
> at pos 0,0 with size 60x100.<br>
> And the stack if placed at (0,0) would have a size of about 160x700.
+
> And the stack if placed at (0,0) would have a size of about 160x700.<br>
> If the latter one is to be vertically aligned to the first it is done by
+
> If the latter one is to be vertically aligned to the first it is done by<br>
> moving it up until in order for the baseline of the stack{...} command
+
> moving it up until in order for the baseline of the stack{...} command<br>
> to match the one from "x-y". By doing that we surely will have the
+
> to match the one from "x-y". By doing that we surely will have the<br>
> baselines of a, b and c be moved into the negative y axis as can be seen
+
> baselines of a, b and c be moved into the negative y axis as can be seen<br>
> in the layouted formula.
+
> in the layouted formula.<br>
>
+
><br>
> But that doesn't really matter when the formula is displayed since it
+
> But that doesn't really matter when the formula is displayed since it<br>
> will work with any logically position calculated.
+
> will work with any logically position calculated.<br>
> At most one needs to move all the formula nodes in order to have the
+
> At most one needs to move all the formula nodes in order to have the<br>
> whole formula start at pos (0,0) if needs be...
+
> whole formula start at pos (0,0) if needs be...<br>
>
+
><br>
[..]
+
[..]<br>
  
 
Thanks Thomas for your very important notes. For archiving reasons (&
 
Thanks Thomas for your very important notes. For archiving reasons (&
Line 290: Line 300:
  
 
...
 
...
> >> 2. Now as per discussion which has happened so far, every Node needs
+
> >> 2. Now as per discussion which has happened so far, every Node needs<br>
> >> to have baseline calculated. To start with, I think I am ready to
+
> >> to have baseline calculated. To start with, I think I am ready to<br>
> >> write code for simple cases like "over". My strategy for over is
+
> >> write code for simple cases like "over". My strategy for over is<br>
> >> recursive calculation of baseline. After moving numerator to top and
+
> >> recursive calculation of baseline. After moving numerator to top and<br>
> >> denominator to bottom we will find the average of both and assign this
+
> >> denominator to bottom we will find the average of both and assign this<br>
> >> to baseline of whole fraction and all this will go on recursively
+
> >> to baseline of whole fraction and all this will go on recursively<br>
> >> automatically. Does it sound good ?
+
> >> automatically. Does it sound good ?<br>
> >>
+
> >><br>
> >> something like(just a pseudo code ) :
+
> >> something like(just a pseudo code ) :<br>
> >>
+
> >><br>
> >>        if (pNum->HasBaseline() && pDenom->HasBaseline())
+
> >>        if (pNum->HasBaseline() && pDenom->HasBaseline())<br>
> >>        {
+
> >>        {<br>
> >>                SetHasBaseline(TRUE);
+
> >>                SetHasBaseline(TRUE);<br>
> >>                SetBaseline((pNum->GetBaseline() +
+
> >>                SetBaseline((pNum->GetBaseline() +<br>
> >> pDenom->GetBaseline()) / 2L);
+
> >> pDenom->GetBaseline()) / 2L);<br>
> >>        }
+
> >>        }<br>
> >>
+
> >><br>
> >> That needs fraction to be a node. And is it really a node ? I think yes.
+
> >> That needs fraction to be a node. And is it really a node ? I think yes.<br>
> >>
+
> >><br>
> >> These calculations are in SmBinVerNode::Arrange method.
+
> >> These calculations are in SmBinVerNode::Arrange method.<br>
> >>
+
> >><br>
> >
+
> ><br>
> > The basic idea is not quite right. If formulas are layouted it is not
+
> > The basic idea is not quite right. If formulas are layouted it is not<br>
> > about finding the overall height and setting the mid as baseline.
+
> > about finding the overall height and setting the mid as baseline.<br>
> > Layout of fractions should be done in away that the horizontal line is
+
> > Layout of fractions should be done in away that the horizontal line is<br>
> > exactly on the same y position as a "-" in "a-b" would be if there were
+
> > exactly on the same y position as a "-" in "a-b" would be if there were<br>
> > further formula parts.
+
> > further formula parts.<br>
> >
+
> ><br>
> > See for example: a - {a over b} over {y+z}  or  a - {H^{2^3}} over {H+H}
+
> > See for example: a - {a over b} over {y+z}  or  a - {H^{2^3}} over {H+H}<br>
> > And compare with any book about physics or math.
+
> > And compare with any book about physics or math.<br>
> >
+
> ><br>
>
+
><br>
> So, for simple cases like "<X> over <Y>" baseline would simply be
+
> So, for simple cases like "<X> over <Y>" baseline would simply be<br>
> baseline of "over", if I am getting it right.
+
> baseline of "over", if I am getting it right.<br>
>
+
><br>
 
That's not correct either. If the overline would have been drawn by
 
That's not correct either. If the overline would have been drawn by
 
using the '' character that might have been right (exact result
 
using the '' character that might have been right (exact result
Line 354: Line 364:
  
  
> >> 3. There are many messages and comments in French, and I would like to
+
> >> 3. There are many messages and comments in French, and I would like to<br>
> >> start converting important ones as and when they come into English.
+
> >> start converting important ones as and when they come into English.<br>
> >> Would that be fine ? And can I do it in same CWS ?
+
> >> Would that be fine ? And can I do it in same CWS ?<br>
> >>
+
> >><br>
> > Err... Where are messages and comments in French?
+
> > Err... Where are messages and comments in French?<br>
> > And do you want to put them into a CWS once you have them translated
+
> > And do you want to put them into a CWS once you have them translated<br>
> > into English?
+
> > into English?<br>
> >
+
> ><br>
>
+
><br>
> Actually they where German and few where in French (I am not sure
+
> Actually they where German and few where in French (I am not sure<br>
> though, don't know either of them :( . I plan to start a page in wiki
+
> though, don't know either of them :( . I plan to start a page in wiki<br>
> and make a table with two columns. First one will contain messages in
+
> and make a table with two columns. First one will contain messages in<br>
> non-English and other side will contain translated messges. For
+
> non-English and other side will contain translated messges. For<br>
> critical comments related to this issue I will like to commit them in
+
> critical comments related to this issue I will like to commit them in<br>
> this CWS.
+
> this CWS.<br>
>
+
><br>
 
Sure. Do it that way.
 
Sure. Do it that way.
 
Critical comment should best be in the source as well.
 
Critical comment should best be in the source as well.
  
> Thanks Thomas for your very important notes. For archiving reasons (&
+
> Thanks Thomas for your very important notes. For archiving reasons (&<br>
> in case other folks around can help with ideas) I have taken whole of
+
> in case other folks around can help with ideas) I have taken whole of<br>
> reply into this mail and have cc to dev@openoffice and dev@education
+
> reply into this mail and have cc to dev@openoffice and dev@education<br>
>
+
><br>
>
+
><br>
 
That's fine with me. :-)
 
That's fine with me. :-)
 
Thanks for taking on that issue!
 
Thanks for taking on that issue!

Revision as of 08:48, 6 December 2008


Hello Thomas,

I had been debugging starmath module. Using some test cases and checking the flow.

There are some very basic doubts:

1. In my view centre(0,0) of co-ordinate system from which all calculations are made (e.g calculation of Point, Alignment etc) is at top left corner. The +ve side of Y axis goes down the left corner towards bottom and +ve side of X axis goes horizontal towards top right corned. May you confirm this ?

2. Now as per discussion which has happened so far, every Node needs to have baseline calculated. To start with, I think I am ready to write code for simple cases like "over". My strategy for over is recursive calculation of baseline. After moving numerator to top and denominator to bottom we will find the average of both and assign this to baseline of whole fraction and all this will go on recursively automatically. Does it sound good ?

something like(just a pseudo code ) :

     if (pNum->HasBaseline() && pDenom->HasBaseline())
     {
              SetHasBaseline(TRUE);
              SetBaseline((pNum->GetBaseline() + pDenom->GetBaseline()) / 2L);
      }

That needs fraction to be a node. And is it really a node ? I think yes.

These calculations are in SmBinVerNode::Arrange method.

3. There are many messages and comments in French, and I would like to start converting important ones as and when they come into English. Would that be fine ? And can I do it in same CWS ?

4. Should I reassign issue to myself and create a CWS? It hasn't been created yet.

5. Can baseline be negative ? I don't think so, but there are test cases where baseline has value -<number>

Thanks

-- Cheers, rakesh


Hello Rakesh,


> Hello Thomas,
>
> I had been debugging starmath module. Using some test cases and
> checking the flow.
>
> There are some very basic doubts:
>
> 1. In my view centre(0,0) of co-ordinate system from which all
> calculations are made (e.g calculation of Point, Alignment etc) is at
> top left corner. The +ve side of Y axis goes down the left corner
> towards bottom and +ve side of X axis goes horizontal towards top
> right corned. May you confirm this ?
>


Yes. That is not what one might expect, but for all window based coordinates in most UI API's it is the same.


> 2. Now as per discussion which has happened so far, every Node needs
> to have baseline calculated. To start with, I think I am ready to
> write code for simple cases like "over". My strategy for over is
> recursive calculation of baseline. After moving numerator to top and
> denominator to bottom we will find the average of both and assign this
> to baseline of whole fraction and all this will go on recursively
> automatically. Does it sound good ?
>
> something like(just a pseudo code ) : > > if (pNum->HasBaseline() && pDenom->HasBaseline()) > { > SetHasBaseline(TRUE); > SetBaseline((pNum->GetBaseline() + > pDenom->GetBaseline()) / 2L); > } > > That needs fraction to be a node. And is it really a node ? I think yes.
>
> These calculations are in SmBinVerNode::Arrange method.
>


The basic idea is not quite right. If formulas are layouted it is not
about finding the overall height and setting the mid as baseline.
Layout of fractions should be done in away that the horizontal line is
exactly on the same y position as a "-" in "a-b" would be if there were
further formula parts.

See for example: a - {a over b} over {y+z} or a - {H^{2^3}} over {H+H}
And compare with any book about physics or math.

> 3. There are many messages and comments in French, and I would like to
> start converting important ones as and when they come into English.
> Would that be fine ? And can I do it in same CWS ?
>

Err... Where are messages and comments in French?
And do you want to put them into a CWS once you have them translated
into English?

> 4. Should I reassign issue to myself and create a CWS? It hasn't been
> created yet.
>

If you feel like it you can do so. That would be a good idea if you want to share the code with otehrs e.g. Eric or me while developing. If you want that just drop me a note and I will setup a CWS. That is because in the end our QA will have a look at it and it is easier to get a build done/installed from here if the CWS is on our servers...

> 5. Can baseline be negative ? I don't think so, but there are test
> cases where baseline has value -<number>
>


Yes it can become negative. The actual baseline of the very outer line (or to put it different: of the first char in a line) should not be negative. But it wouldn't matter.

The reason for baselines to become negative is because of aligning different nodes vertically. If you take the following two formulas for example

  x - x

and

  stack{a#b#c#d#e#f#g}

each on it's own none of the baselines should be negative. But if they are on the same line like

  x - x stack{a#b#c#d#e#f#g}

things may become different. The reason for this is that the alignment of the whole formula starts with the aligned node. And here that is 'x'. If, just for the example, we assume a lines height will be 100 then the rectangle for 'a' might be at pos 0,0 with size 60x100. And the stack if placed at (0,0) would have a size of about 160x700. If the latter one is to be vertically aligned to the first it is done by moving it up until in order for the baseline of the stack{...} command to match the one from "x-y". By doing that we surely will have the baselines of a, b and c be moved into the negative y axis as can be seen in the layouted formula.

But that doesn't really matter when the formula is displayed since it will work with any logically position calculated. At most one needs to move all the formula nodes in order to have the whole formula start at pos (0,0) if needs be...


Thomas


2008/9/29 Thomas Lange - Sun Germany - ham02 - Hamburg <Thomas.Lange@sun.com>:
[..]
- Show quoted text -
>> There are some very basic doubts:
>>
>> 1. In my view centre(0,0) of co-ordinate system from which all
>> calculations are made (e.g calculation of Point, Alignment etc) is at
>> top left corner. The +ve side of Y axis goes down the left corner
>> towards bottom and +ve side of X axis goes horizontal towards top
>> right corned. May you confirm this ?
>>
> Yes. That is not what one might expect, but for all window based
> coordinates in most UI API's it is the same.
>
>> 2. Now as per discussion which has happened so far, every Node needs
>> to have baseline calculated. To start with, I think I am ready to
>> write code for simple cases like "over". My strategy for over is
>> recursive calculation of baseline. After moving numerator to top and
>> denominator to bottom we will find the average of both and assign this
>> to baseline of whole fraction and all this will go on recursively
>> automatically. Does it sound good ?
>>
>> something like(just a pseudo code ) :
>>
>> if (pNum->HasBaseline() && pDenom->HasBaseline())
>> {
>> SetHasBaseline(TRUE);
>> SetBaseline((pNum->GetBaseline() +
>> pDenom->GetBaseline()) / 2L);
>> }
>>
>> That needs fraction to be a node. And is it really a node ? I think yes.
>>
>> These calculations are in SmBinVerNode::Arrange method.
>>
>
> The basic idea is not quite right. If formulas are layouted it is not
> about finding the overall height and setting the mid as baseline.
> Layout of fractions should be done in away that the horizontal line is
> exactly on the same y position as a "-" in "a-b" would be if there were
> further formula parts.
>
> See for example: a - {a over b} over {y+z} or a - {H^{2^3}} over {H+H}
> And compare with any book about physics or math.
>

So, for simple cases like "<X> over <Y>" baseline would simply be baseline of "over", if I am getting it right.

>> 3. There are many messages and comments in French, and I would like to
>> start converting important ones as and when they come into English.
>> Would that be fine ? And can I do it in same CWS ?
>>
> Err... Where are messages and comments in French?
> And do you want to put them into a CWS once you have them translated
> into English?
>

Actually they where German and few where in French (I am not sure though, don't know either of them :( . I plan to start a page in wiki and make a table with two columns. First one will contain messages in non-English and other side will contain translated messges. For critical comments related to this issue I will like to commit them in this CWS.


>> 4. Should I reassign issue to myself and create a CWS? It hasn't been >> created yet.
>>
> If you feel like it you can do so.
> That would be a good idea if you want to share the code with otehrs e.g.
> Eric or me while developing.
> If you want that just drop me a note and I will setup a CWS. That is
> because in the end our QA will have a look at it and it is easier to get
> a build done/installed from here if the CWS is on our servers...
>

Okay. I will do it, thanks - Show quoted text -

>> 5. Can baseline be negative ? I don't think so, but there are test
>> cases where baseline has value -<number>
>>
> Yes it can become negative.
> The actual baseline of the very outer line (or to put it different: of
> the first char in a line) should not be negative. But it wouldn't matter.
>
> The reason for baselines to become negative is because of aligning
> different nodes vertically. If you take the following two formulas for
> example
> x - x
> and
> stack{a#b#c#d#e#f#g}
> each on it's own none of the baselines should be negative.
> But if they are on the same line like
> x - x stack{a#b#c#d#e#f#g}
> things may become different.
> The reason for this is that the alignment of the whole formula starts
> with the aligned node. And here that is 'x'. If, just for the example,
> we assume a lines height will be 100 then the rectangle for 'a' might be
> at pos 0,0 with size 60x100.
> And the stack if placed at (0,0) would have a size of about 160x700.
> If the latter one is to be vertically aligned to the first it is done by
> moving it up until in order for the baseline of the stack{...} command
> to match the one from "x-y". By doing that we surely will have the
> baselines of a, b and c be moved into the negative y axis as can be seen
> in the layouted formula.
>
> But that doesn't really matter when the formula is displayed since it
> will work with any logically position calculated.
> At most one needs to move all the formula nodes in order to have the
> whole formula start at pos (0,0) if needs be...
>
[..]

Thanks Thomas for your very important notes. For archiving reasons (& in case other folks around can help with ideas) I have taken whole of reply into this mail and have cc to dev@openoffice and dev@education

Cheers!

-- rakesh




Hello Rakesh,


... > >> 2. Now as per discussion which has happened so far, every Node needs
> >> to have baseline calculated. To start with, I think I am ready to
> >> write code for simple cases like "over". My strategy for over is
> >> recursive calculation of baseline. After moving numerator to top and
> >> denominator to bottom we will find the average of both and assign this
> >> to baseline of whole fraction and all this will go on recursively
> >> automatically. Does it sound good ?
> >>
> >> something like(just a pseudo code ) :
> >>
> >> if (pNum->HasBaseline() && pDenom->HasBaseline())
> >> {
> >> SetHasBaseline(TRUE);
> >> SetBaseline((pNum->GetBaseline() +
> >> pDenom->GetBaseline()) / 2L);
> >> }
> >>
> >> That needs fraction to be a node. And is it really a node ? I think yes.
> >>
> >> These calculations are in SmBinVerNode::Arrange method.
> >>
> >
> > The basic idea is not quite right. If formulas are layouted it is not
> > about finding the overall height and setting the mid as baseline.
> > Layout of fractions should be done in away that the horizontal line is
> > exactly on the same y position as a "-" in "a-b" would be if there were
> > further formula parts.
> >
> > See for example: a - {a over b} over {y+z} or a - {H^{2^3}} over {H+H}
> > And compare with any book about physics or math.
> >
>
> So, for simple cases like "<X> over <Y>" baseline would simply be
> baseline of "over", if I am getting it right.
>
That's not correct either. If the overline would have been drawn by using the character that might have been right (exact result depending on the font used, maybe). But in Math the underscore is drawn as rectangle and thus is no character from any font. That means you have to 'invent' a calculation for a pseudo baseline of that SmRect that fits the requirement of aligning with the '-' character.

On the other hand you are free to re-implement that Node by making use of the '-' character. You will need to call a separate function though to stretch it to the desired width. And the layout may change somewhat because of this. However that will bring up other issue you need to take care of. For example - Even if you stretch the '-' to the required width you need to make sure that

the bounding rectangle does not include excessively large borders to

the left

and right.

- Also you need to clip the bounding rectangle at top and bottom to about the

actual space the '-' will take because you must not have too much space
between it and the nominator and denominator.

- The advantage however would be that of course the baseline of '-' is always

in line with another '-' as in "a - {x over y}". That is in that case the
baseline of the '-' should be the baseline of that node.

Note: if you want to go with the stretched '-' make sure to use the one from the StarSymbol font. Not all fonts are arbitrarily scalable.


> >> 3. There are many messages and comments in French, and I would like to
> >> start converting important ones as and when they come into English.
> >> Would that be fine ? And can I do it in same CWS ?
> >>
> > Err... Where are messages and comments in French?
> > And do you want to put them into a CWS once you have them translated
> > into English?
> >
>
> Actually they where German and few where in French (I am not sure
> though, don't know either of them :( . I plan to start a page in wiki
> and make a table with two columns. First one will contain messages in
> non-English and other side will contain translated messges. For
> critical comments related to this issue I will like to commit them in
> this CWS.
>
Sure. Do it that way. Critical comment should best be in the source as well.

> Thanks Thomas for your very important notes. For archiving reasons (&
> in case other folks around can help with ideas) I have taken whole of
> reply into this mail and have cc to dev@openoffice and dev@education
>
>
That's fine with me. :-) Thanks for taking on that issue!


Thomas


Personal tools