| 1117 | } |
| 1118 | |
| 1119 | sptr<Box> BigOperatorAtom::createSideSets(_out_ TeXEnvironment& env) { |
| 1120 | SideSetsAtom* sa = static_cast<SideSetsAtom*>(_base.get()); |
| 1121 | auto sl = sa->_left, sr = sa->_right, sb = sa->_base; |
| 1122 | if (sb == nullptr) { |
| 1123 | sptr<Atom> in(new CharAtom(L'M', "mathnormal")); |
| 1124 | sb = sptr<Atom>(new PhantomAtom(in, false, true, true)); |
| 1125 | } |
| 1126 | |
| 1127 | auto opbox = sb->createBox(env); |
| 1128 | auto pa = sptr<Atom>(new PlaceholderAtom(0, opbox->_height, opbox->_depth, opbox->_shift)); |
| 1129 | pa->_typelimits = SCRIPT_NOLIMITS; |
| 1130 | pa->_type = TYPE_BIG_OPERATOR; |
| 1131 | |
| 1132 | ScriptsAtom* l = dynamic_cast<ScriptsAtom*>(sl.get()); |
| 1133 | ScriptsAtom* r = dynamic_cast<ScriptsAtom*>(sr.get()); |
| 1134 | |
| 1135 | if (l != nullptr && l->_base == nullptr) { |
| 1136 | l->_base = pa; |
| 1137 | l->_align = ALIGN_RIGHT; |
| 1138 | } |
| 1139 | if (r != nullptr && r->_base == nullptr) r->_base = pa; |
| 1140 | |
| 1141 | auto y = sptr<Box>(new HorizontalBox()); |
| 1142 | float limitsShift = 0; |
| 1143 | if (sl != nullptr) { |
| 1144 | auto lb = sl->createBox(env); |
| 1145 | y->add(lb); |
| 1146 | limitsShift = lb->_width + opbox->_width / 2; |
| 1147 | } |
| 1148 | y->add(opbox); |
| 1149 | if (sr != nullptr) y->add(sr->createBox(env)); |
| 1150 | |
| 1151 | TeXFont* tf = env.getTeXFont().get(); |
| 1152 | const int style = env.getStyle(); |
| 1153 | |
| 1154 | float delta = 0; |
| 1155 | if (sb->_type == TYPE_BIG_OPERATOR) { |
| 1156 | SymbolAtom* sym = dynamic_cast<SymbolAtom*>(sb.get()); |
| 1157 | if (sym != nullptr) { |
| 1158 | Char c = tf->getChar(sym->getName(), style); |
| 1159 | delta = c.getItalic(); |
| 1160 | } |
| 1161 | } |
| 1162 | |
| 1163 | // under and over |
| 1164 | sptr<Box> x, z; |
| 1165 | if (_over != nullptr) x = _over->createBox(*(env.supStyle())); |
| 1166 | if (_under != nullptr) z = _under->createBox(*(env.subStyle())); |
| 1167 | |
| 1168 | // build vertical box |
| 1169 | VerticalBox* vbox = new VerticalBox(); |
| 1170 | float bigop5 = tf->getBigOpSpacing5(style), kern = 0; |
| 1171 | |
| 1172 | if (_over != nullptr) { |
| 1173 | vbox->add(sptr<Box>(new StrutBox(0, bigop5, 0, 0))); |
| 1174 | x->_shift = limitsShift - x->_width / 2 + delta / 2; |
| 1175 | vbox->add(x); |
| 1176 | kern = max(tf->getBigOpSpacing1(style), tf->getBigOpSpacing3(style) - x->_depth); |
nothing calls this directly
no test coverage detected