# Education Project/Effort/Math baseline alignment/Discover starmath

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## Page Needs restructuring

Right now main calculations (and only calculations are at): SmRect::BuildRect function

```         nBaseline         = aFM.GetAscent();
nAlignT           = nBaseline - nFontHeight * 750L / 1000L;
nAlignM           = nBaseline - nFontHeight * 121L / 422L;
// that's where the horizontal bars of '+', '-', ... are
// (1/3 of ascent over baseline)
// (121 = 1/3 of 12pt ascent, 422 = 12pt fontheight)
nAlignB           = nBaseline;
```

This is lone info about calculations happening till now.

TODO: Will need to list down cases where these calculations are made.

test_baseline code

```diff -u -r1.7 rect.hxx
--- inc/rect.hxx	24 Apr 2008 13:57:29 -0000	1.7
+++ inc/rect.hxx	23 Sep 2008 13:00:13 -0000
@@ -62,6 +62,7 @@
// Note: however, italic spaces can be negative!
//

// possible flags for the 'Draw' function below (just for debugging)
#define SM_RECT_CORE	0x0001
#define SM_RECT_ITALIC	0x0002
@@ -112,6 +113,12 @@
bHasAlignInfo;

protected:
+			void test_baseline()
+			{
+			  if (!bHasBaseline) {
+			    int i = 0;
+			  }
+			}
void BuildRect (const OutputDevice &rDev, const SmFormat *pFormat,
const XubString &rText, USHORT nBorderWidth);
void Init(const OutputDevice &rDev, const SmFormat *pFormat,
```

While setting break point at every test_baseline and writing an expression 'a over b = c' we can learn the flow of starmath module. Backtrace:

```
#0  SmBinHorNode::Arrange (this=0xadc1765c, rDev=@0xb00da560, rFormat=@0xb00da220) at /home/dev/OOo/starmath/source/node.cxx:1036
#1  0x02821df3 in SmLineNode::Arrange (this=0xadc1779c, rDev=@0xb00da560, rFormat=@0xb00da220) at /home/dev/OOo/starmath/source/node.cxx:806
#2  0x0282208d in SmExpressionNode::Arrange (this=0xadc1779c, rDev=@0xb00da560, rFormat=@0xb00da220) at /home/dev/OOo/starmath/source/node.cxx:854
#3  0x02821df3 in SmLineNode::Arrange (this=0xadb902b0, rDev=@0xb00da560, rFormat=@0xb00da220) at /home/dev/OOo/starmath/source/node.cxx:806
#4  0x0281c0dd in SmTableNode::Arrange (this=0xadb90490, rDev=@0xb00da560, rFormat=@0xb00da220) at /home/dev/OOo/starmath/source/node.cxx:750
#5  0x027efca4 in SmDocShell::ArrangeFormula (this=0xb00da1e0) at /home/dev/OOo/starmath/source/document.cxx:307
#6  0x027f19fb in SmDocShell::Draw (this=0xb00da1e0, rDev=@0xad7f104c, rPosition=@0xbfe646e4) at /home/dev/OOo/starmath/source/document.cxx:456
#7  0x02834d38 in SmGraphicWindow::Paint (this=0xad7f104c) at /home/dev/OOo/starmath/source/view.cxx:318

```

This page is a draft, and contains a short description of starmath module

inc -> contains al includes prj -> build.lst, d.lst qa -> does contain one unoapi directory FIXME : role ?

sdi -> role ? for menus creation ?

source : the main directory, containing .hxx .src and .cxx

Q: what is obsolete ?

in source

action.cxx : undo, redo, repeat / wip

cfgitem.hxx relative to fonts attributes, and sizes / to be verified

commands.src : does contain the menu entries. // reminder : add l/r_bar_arrow

config.cxx : SmConfig class implementation

detreg.cxx role ? // FIXME

dialog.cxx : everything dialogs, link with vcl/sfx2

Classes : SmAlignDialog : exact role ?

document.cxx :

SmDocShell::ArrangeFormula() -> usefull ?

SmDocShell::UpdateText() -> usefull too ?

SmEditWindow::DataChanged -> i.e.

format.cxx : all formating stuff for fonts

mathtype.cxx:

SM <-> MathType conversion

math glyphs handling ?

arrays: containing unicode correspondance list, aSelectorList, aIntegralOpt ..,

StarMath to Unicode conversion

! strange conditional breaks inside switch()