2 #ifndef MATH_SCRIPTINSET_H
3 #define MATH_SCRIPTINSET_H
5 #include "math_nestinset.h"
11 /** Inset for super- and subscripts
15 class MathScriptInset : public MathNestInset {
20 explicit MathScriptInset(bool up);
22 MathInset * clone() const;
24 void write(WriteStream & os) const;
26 void normalize(NormalStream & os) const;
28 void metrics(MathMetricsInfo const & st) const;
30 void draw(Painter &, int x, int y) const;
33 void metrics(MathInset const * nuc, MathMetricsInfo const & st) const;
35 void draw(MathInset const * nuc, Painter &, int x, int y) const;
37 int ascent(MathInset const * nuc) const;
39 int descent(MathInset const * nuc) const;
41 int width(MathInset const * nuc) const;
44 bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
46 bool idxRight(MathInset::idx_type &, MathInset::pos_type &) const;
49 MathScriptInset const * asScriptInset() const;
51 MathScriptInset * asScriptInset();
54 void limits(int lim) { limits_ = lim; }
56 int limits() const { return limits_; }
58 bool hasLimits(MathInset const * nuc) const;
59 /// true if we have an "inner" position
60 MathXArray const & up() const;
62 MathXArray const & down() const;
63 /// returns superscript
67 /// do we have a superscript?
69 /// do we have a subscript?
71 /// do we have a script?
72 bool has(bool up) const;
74 void removeScript(bool up);
76 void removeEmptyScripts();
81 void write(MathInset const * nuc, WriteStream & os) const;
83 void normalize(MathInset const * nuc, NormalStream & os) const;
85 void octavize(MathInset const * nuc, OctaveStream & os) const;
87 void maplize(MathInset const * nuc, MapleStream & os) const;
89 void mathmlize(MathInset const * nuc, MathMLStream & os) const;
92 /// returns x offset for main part
93 int dxx(MathInset const * nuc) const;
94 /// returns width of nucleus if any
95 int nwid(MathInset const * nuc) const;
97 /// returns y offset for superscript
98 int dy0(MathInset const * nuc) const;
99 /// returns y offset for subscript
100 int dy1(MathInset const * nuc) const;
101 /// returns x offset for superscript
102 int dx0(MathInset const * nuc) const;
103 /// returns x offset for subscript
104 int dx1(MathInset const * nuc) const;
105 /// returns ascent of nucleus if any
106 int nasc(MathInset const * nuc) const;
107 /// returns descent of nucleus if any
108 int ndes(MathInset const * nuc) const;
110 /// possible subscript (index 0) and superscript (index 1)
115 mutable MathMetricsInfo mi_;