| 7306 | }; |
| 7307 | |
| 7308 | const encloseSpan = function encloseSpan(inner, label, pad, options) { |
| 7309 | // Return an image span for \cancel, \bcancel, \xcancel, or \fbox |
| 7310 | let img; |
| 7311 | const totalHeight = inner.height + inner.depth + 2 * pad; |
| 7312 | |
| 7313 | if (/fbox|color/.test(label)) { |
| 7314 | img = buildCommon.makeSpan(["stretchy", label], [], options); |
| 7315 | |
| 7316 | if (label === "fbox") { |
| 7317 | const color = options.color && options.getColor(); |
| 7318 | |
| 7319 | if (color) { |
| 7320 | img.style.borderColor = color; |
| 7321 | } |
| 7322 | } |
| 7323 | } else { |
| 7324 | // \cancel, \bcancel, or \xcancel |
| 7325 | // Since \cancel's SVG is inline and it omits the viewBox attribute, |
| 7326 | // its stroke-width will not vary with span area. |
| 7327 | const lines = []; |
| 7328 | |
| 7329 | if (/^[bx]cancel$/.test(label)) { |
| 7330 | lines.push(new LineNode({ |
| 7331 | "x1": "0", |
| 7332 | "y1": "0", |
| 7333 | "x2": "100%", |
| 7334 | "y2": "100%", |
| 7335 | "stroke-width": "0.046em" |
| 7336 | })); |
| 7337 | } |
| 7338 | |
| 7339 | if (/^x?cancel$/.test(label)) { |
| 7340 | lines.push(new LineNode({ |
| 7341 | "x1": "0", |
| 7342 | "y1": "100%", |
| 7343 | "x2": "100%", |
| 7344 | "y2": "0", |
| 7345 | "stroke-width": "0.046em" |
| 7346 | })); |
| 7347 | } |
| 7348 | |
| 7349 | const svgNode = new SvgNode(lines, { |
| 7350 | "width": "100%", |
| 7351 | "height": totalHeight + "em" |
| 7352 | }); |
| 7353 | img = buildCommon.makeSvgSpan([], [svgNode], options); |
| 7354 | } |
| 7355 | |
| 7356 | img.height = totalHeight; |
| 7357 | img.style.height = totalHeight + "em"; |
| 7358 | return img; |
| 7359 | }; |
| 7360 | |
| 7361 | var stretchy = { |
| 7362 | encloseSpan, |