#ifndef MICROTEX_ATOM_SCRIPTS_H #define MICROTEX_ATOM_SCRIPTS_H #include "atom/atom.h" #include "atom/atom_space.h" #include "box/box_group.h" #include "box/box_single.h" #include "utils/utils.h" namespace microtex { struct ScriptResult { sptr base = nullptr; sptr scripts = nullptr; float space = 0.f; float kern = 0.f; float widthReduce = 0.f; float italic = 0.f; }; /** An atom representing scripts to be attached to another atom */ class ScriptsAtom : public Atom { public: // base atom sptr _base; // subscript and superscript to be attached to the base sptr _sub; sptr _sup; bool _onRight = true; ScriptsAtom() = delete; ScriptsAtom( const sptr& base, const sptr& sub, const sptr& sup, bool onRight = true ) : _base(base), _sub(sub), _sup(sup), _onRight(onRight) {} AtomType leftType() const override { return _base == nullptr ? _type : _base->leftType(); } AtomType rightType() const override { return _base == nullptr ? _type : _base->rightType(); } sptr createBox(Env& env) override; ScriptResult createScripts(Env& env); }; } // namespace microtex #endif // MICROTEX_ATOM_SCRIPTS_H