3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Asger Alstrup Nielsen
7 * \author Jean-Marc Lasgouttes
8 * \author Lars Gullik Bjønnes
9 * \author Jürgen Spitzmüller
11 * Full author contact details are available in file CREDITS.
16 #include "InsetSpace.h"
18 #include "BufferView.h"
20 #include "Dimension.h"
21 #include "FuncRequest.h"
22 #include "FuncStatus.h"
23 #include "LaTeXFeatures.h"
26 #include "MetricsInfo.h"
27 #include "OutputParams.h"
29 #include "support/debug.h"
30 #include "support/docstream.h"
31 #include "support/gettext.h"
32 #include "support/lassert.h"
33 #include "support/lstrings.h"
35 #include "frontends/Application.h"
36 #include "frontends/FontMetrics.h"
37 #include "frontends/Painter.h"
44 InsetSpace::InsetSpace(InsetSpaceParams const & params)
49 InsetSpaceParams::Kind InsetSpace::kind() const
55 Length InsetSpace::length() const
57 return params_.length;
61 InsetSpace::~InsetSpace()
63 hideDialogs("space", this);
67 docstring InsetSpace::toolTip(BufferView const &, int, int) const
70 switch (params_.kind) {
71 case InsetSpaceParams::NORMAL:
72 message = _("Interword Space");
74 case InsetSpaceParams::PROTECTED:
75 message = _("Protected Space");
77 case InsetSpaceParams::THIN:
78 message = _("Thin Space");
80 case InsetSpaceParams::MEDIUM:
81 message = _("Medium Space");
83 case InsetSpaceParams::THICK:
84 message = _("Thick Space");
86 case InsetSpaceParams::QUAD:
87 message = _("Quad Space");
89 case InsetSpaceParams::QQUAD:
90 message = _("QQuad Space");
92 case InsetSpaceParams::ENSPACE:
93 message = _("Enspace");
95 case InsetSpaceParams::ENSKIP:
96 message = _("Enskip");
98 case InsetSpaceParams::NEGTHIN:
99 message = _("Negative Thin Space");
101 case InsetSpaceParams::NEGMEDIUM:
102 message = _("Negative Medium Space");
104 case InsetSpaceParams::NEGTHICK:
105 message = _("Negative Thick Space");
107 case InsetSpaceParams::HFILL:
108 message = _("Horizontal Fill");
110 case InsetSpaceParams::HFILL_PROTECTED:
111 message = _("Protected Horizontal Fill");
113 case InsetSpaceParams::DOTFILL:
114 message = _("Horizontal Fill (Dots)");
116 case InsetSpaceParams::HRULEFILL:
117 message = _("Horizontal Fill (Rule)");
119 case InsetSpaceParams::LEFTARROWFILL:
120 message = _("Horizontal Fill (Left Arrow)");
122 case InsetSpaceParams::RIGHTARROWFILL:
123 message = _("Horizontal Fill (Right Arrow)");
125 case InsetSpaceParams::UPBRACEFILL:
126 message = _("Horizontal Fill (Up Brace)");
128 case InsetSpaceParams::DOWNBRACEFILL:
129 message = _("Horizontal Fill (Down Brace)");
131 case InsetSpaceParams::CUSTOM:
132 message = support::bformat(_("Horizontal Space (%1$s)"),
133 params_.length.asDocstring());
135 case InsetSpaceParams::CUSTOM_PROTECTED:
136 message = support::bformat(_("Protected Horizontal Space (%1$s)"),
137 params_.length.asDocstring());
144 void InsetSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
146 switch (cmd.action) {
148 case LFUN_INSET_MODIFY:
149 string2params(to_utf8(cmd.argument()), params_);
152 case LFUN_INSET_DIALOG_UPDATE:
153 cur.bv().updateDialog("space", params2string(params()));
156 case LFUN_MOUSE_RELEASE:
157 if (!cur.selection() && cmd.button() == mouse_button::button1)
158 cur.bv().showDialog("space", params2string(params()), this);
162 Inset::doDispatch(cur, cmd);
168 bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
169 FuncStatus & status) const
171 switch (cmd.action) {
173 case LFUN_INSET_MODIFY:
174 if (cmd.getArg(0) == "space") {
175 InsetSpaceParams params;
176 string2params(to_utf8(cmd.argument()), params);
177 status.setOnOff(params_.kind == params.kind);
180 case LFUN_INSET_SETTINGS:
181 case LFUN_INSET_DIALOG_UPDATE:
182 status.setEnabled(true);
185 return Inset::getStatus(cur, cmd, status);
190 void InsetSpace::edit(Cursor & cur, bool, EntryDirection)
192 showInsetDialog(&cur.bv());
196 bool InsetSpace::showInsetDialog(BufferView * bv) const
198 bv->showDialog("space", params2string(params()),
199 const_cast<InsetSpace *>(this));
205 int const arrow_size = 8;
209 void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
211 if (isStretchableSpace()) {
212 // The metrics for this kinds are calculated externally in
213 // \c TextMetrics::computeRowMetrics. Those are dummy value:
214 dim = Dimension(10, 10, 10);
218 frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
219 dim.asc = fm.maxAscent();
220 dim.des = fm.maxDescent();
222 switch (params_.kind) {
223 case InsetSpaceParams::THIN:
224 case InsetSpaceParams::NEGTHIN:
225 dim.wid = fm.width(char_type('M')) / 6;
227 case InsetSpaceParams::MEDIUM:
228 case InsetSpaceParams::NEGMEDIUM:
229 dim.wid = fm.width(char_type('M')) / 4;
231 case InsetSpaceParams::THICK:
232 case InsetSpaceParams::NEGTHICK:
233 dim.wid = fm.width(char_type('M')) / 2;
235 case InsetSpaceParams::PROTECTED:
236 case InsetSpaceParams::NORMAL:
237 dim.wid = fm.width(char_type(' '));
239 case InsetSpaceParams::QUAD:
240 dim.wid = fm.width(char_type('M'));
242 case InsetSpaceParams::QQUAD:
243 dim.wid = 2 * fm.width(char_type('M'));
245 case InsetSpaceParams::ENSPACE:
246 case InsetSpaceParams::ENSKIP:
247 dim.wid = int(0.5 * fm.width(char_type('M')));
249 case InsetSpaceParams::CUSTOM:
250 case InsetSpaceParams::CUSTOM_PROTECTED: {
252 params_.length.inPixels(mi.base.textwidth,
253 fm.width(char_type('M')));
254 int const minw = (w < 0) ? 3 * arrow_size : 4;
255 dim.wid = max(minw, abs(w));
258 case InsetSpaceParams::HFILL:
259 case InsetSpaceParams::HFILL_PROTECTED:
260 case InsetSpaceParams::DOTFILL:
261 case InsetSpaceParams::HRULEFILL:
262 case InsetSpaceParams::LEFTARROWFILL:
263 case InsetSpaceParams::RIGHTARROWFILL:
264 case InsetSpaceParams::UPBRACEFILL:
265 case InsetSpaceParams::DOWNBRACEFILL:
269 // Cache the inset dimension.
270 setDimCache(mi, dim);
274 void InsetSpace::draw(PainterInfo & pi, int x, int y) const
276 Dimension const dim = dimension(*pi.base.bv);
278 if (isStretchableSpace() || params_.length.value() < 0) {
279 int const asc = theFontMetrics(pi.base.font).ascent('M');
280 int const desc = theFontMetrics(pi.base.font).descent('M');
281 // Pixel height divisible by 2 for prettier fill graphics:
282 int const oddheight = (asc ^ desc) & 1;
283 int const x0 = x + 1;
284 int const x1 = x + dim.wid - 2;
285 int const y0 = y + desc - 1;
286 int const y1 = y - asc + oddheight - 1;
287 int const y2 = (y0 + y1) / 2;
288 int xoffset = (y0 - y1) / 2;
290 // Two tests for very narrow insets
291 if (xoffset > x1 - x0
292 && (params_.kind == InsetSpaceParams::LEFTARROWFILL
293 || params_.kind == InsetSpaceParams::RIGHTARROWFILL))
295 if (xoffset * 6 > (x1 - x0)
296 && (params_.kind == InsetSpaceParams::UPBRACEFILL
297 || params_.kind == InsetSpaceParams::DOWNBRACEFILL))
298 xoffset = (x1 - x0) / 6;
300 int const x2 = x0 + xoffset;
301 int const x3 = x1 - xoffset;
302 int const xm = (x0 + x1) / 2;
303 int const xml = xm - xoffset;
304 int const xmr = xm + xoffset;
306 if (params_.kind == InsetSpaceParams::HFILL) {
307 pi.pain.line(x0, y1, x0, y0, Color_added_space);
308 pi.pain.line(x0, y2, x1, y2, Color_added_space,
309 frontend::Painter::line_onoffdash);
310 pi.pain.line(x1, y1, x1, y0, Color_added_space);
311 } else if (params_.kind == InsetSpaceParams::HFILL_PROTECTED) {
312 pi.pain.line(x0, y1, x0, y0, Color_latex);
313 pi.pain.line(x0, y2, x1, y2, Color_latex,
314 frontend::Painter::line_onoffdash);
315 pi.pain.line(x1, y1, x1, y0, Color_latex);
316 } else if (params_.kind == InsetSpaceParams::DOTFILL) {
317 pi.pain.line(x0, y1, x0, y0, Color_special);
318 pi.pain.line(x0, y0, x1, y0, Color_special,
319 frontend::Painter::line_onoffdash);
320 pi.pain.line(x1, y1, x1, y0, Color_special);
321 } else if (params_.kind == InsetSpaceParams::HRULEFILL) {
322 pi.pain.line(x0, y1, x0, y0, Color_special);
323 pi.pain.line(x0, y0, x1, y0, Color_special);
324 pi.pain.line(x1, y1, x1, y0, Color_special);
325 } else if (params_.kind == InsetSpaceParams::LEFTARROWFILL) {
326 pi.pain.line(x2, y1 + 1 , x0 + 1, y2, Color_special);
327 pi.pain.line(x0 + 1, y2 + 1 , x2, y0, Color_special);
328 pi.pain.line(x0, y2 , x1, y2, Color_special);
329 } else if (params_.kind == InsetSpaceParams::RIGHTARROWFILL) {
330 pi.pain.line(x3 + 1, y1 + 1 , x1, y2, Color_special);
331 pi.pain.line(x1, y2 + 1 , x3 + 1, y0, Color_special);
332 pi.pain.line(x0, y2 , x1, y2, Color_special);
333 } else if (params_.kind == InsetSpaceParams::UPBRACEFILL) {
334 pi.pain.line(x0 + 1, y1 + 1 , x2, y2, Color_special);
335 pi.pain.line(x2, y2 , xml, y2, Color_special);
336 pi.pain.line(xml + 1, y2 + 1 , xm, y0, Color_special);
337 pi.pain.line(xm + 1, y0 , xmr, y2 + 1, Color_special);
338 pi.pain.line(xmr, y2 , x3, y2, Color_special);
339 pi.pain.line(x3 + 1, y2 , x1, y1 + 1, Color_special);
340 } else if (params_.kind == InsetSpaceParams::DOWNBRACEFILL) {
341 pi.pain.line(x0 + 1, y0 , x2, y2 + 1, Color_special);
342 pi.pain.line(x2, y2 , xml, y2, Color_special);
343 pi.pain.line(xml + 1, y2 , xm, y1 + 1, Color_special);
344 pi.pain.line(xm + 1, y1 + 1 , xmr, y2, Color_special);
345 pi.pain.line(xmr, y2 , x3, y2, Color_special);
346 pi.pain.line(x3 + 1, y2 + 1 , x1, y0, Color_special);
347 } else if (params_.kind == InsetSpaceParams::CUSTOM) {
348 pi.pain.line(x0, y1 + 1 , x2 + 1, y2, Color_special);
349 pi.pain.line(x2 + 1, y2 + 1 , x0, y0, Color_special);
350 pi.pain.line(x1 + 1, y1 + 1 , x3, y2, Color_special);
351 pi.pain.line(x3, y2 + 1 , x1 + 1, y0, Color_special);
352 pi.pain.line(x2, y2 , x3, y2, Color_special);
353 } else if (params_.kind == InsetSpaceParams::CUSTOM_PROTECTED) {
354 pi.pain.line(x0, y1 + 1 , x2 + 1, y2, Color_latex);
355 pi.pain.line(x2 + 1, y2 + 1 , x0, y0, Color_latex);
356 pi.pain.line(x1 + 1, y1 + 1 , x3, y2, Color_latex);
357 pi.pain.line(x3, y2 + 1 , x1 + 1, y0, Color_latex);
358 pi.pain.line(x2, y2 , x3, y2, Color_latex);
363 int const w = dim.wid;
364 int const h = theFontMetrics(pi.base.font).ascent('x');
368 yp[0] = y - max(h / 4, 1);
369 if (params_.kind == InsetSpaceParams::NORMAL ||
370 params_.kind == InsetSpaceParams::PROTECTED) {
371 xp[1] = x; yp[1] = y;
372 xp[2] = x + w; yp[2] = y;
374 xp[1] = x; yp[1] = y + max(h / 4, 1);
375 xp[2] = x + w; yp[2] = y + max(h / 4, 1);
378 yp[3] = y - max(h / 4, 1);
380 if (params_.kind == InsetSpaceParams::PROTECTED ||
381 params_.kind == InsetSpaceParams::ENSPACE ||
382 params_.kind == InsetSpaceParams::NEGTHIN ||
383 params_.kind == InsetSpaceParams::NEGMEDIUM ||
384 params_.kind == InsetSpaceParams::NEGTHICK ||
385 params_.kind == InsetSpaceParams::CUSTOM_PROTECTED)
386 pi.pain.lines(xp, yp, 4, Color_latex);
388 pi.pain.lines(xp, yp, 4, Color_special);
392 void InsetSpaceParams::write(ostream & os) const
396 case InsetSpaceParams::NORMAL:
399 case InsetSpaceParams::PROTECTED:
402 case InsetSpaceParams::THIN:
403 os << "\\thinspace{}";
405 case InsetSpaceParams::MEDIUM:
406 os << "\\medspace{}";
408 case InsetSpaceParams::THICK:
409 os << "\\thickspace{}";
411 case InsetSpaceParams::QUAD:
414 case InsetSpaceParams::QQUAD:
417 case InsetSpaceParams::ENSPACE:
420 case InsetSpaceParams::ENSKIP:
423 case InsetSpaceParams::NEGTHIN:
424 os << "\\negthinspace{}";
426 case InsetSpaceParams::NEGMEDIUM:
427 os << "\\negmedspace{}";
429 case InsetSpaceParams::NEGTHICK:
430 os << "\\negthickspace{}";
432 case InsetSpaceParams::HFILL:
435 case InsetSpaceParams::HFILL_PROTECTED:
436 os << "\\hspace*{\\fill}";
438 case InsetSpaceParams::DOTFILL:
441 case InsetSpaceParams::HRULEFILL:
442 os << "\\hrulefill{}";
444 case InsetSpaceParams::LEFTARROWFILL:
445 os << "\\leftarrowfill{}";
447 case InsetSpaceParams::RIGHTARROWFILL:
448 os << "\\rightarrowfill{}";
450 case InsetSpaceParams::UPBRACEFILL:
451 os << "\\upbracefill{}";
453 case InsetSpaceParams::DOWNBRACEFILL:
454 os << "\\downbracefill{}";
456 case InsetSpaceParams::CUSTOM:
459 case InsetSpaceParams::CUSTOM_PROTECTED:
465 os << "\n\\length " << length.asString();
469 void InsetSpaceParams::read(Lexer & lex)
471 lex.setContext("InsetSpaceParams::read");
475 // The tests for math might be disabled after a file format change
476 if (command == "\\space{}")
477 kind = InsetSpaceParams::NORMAL;
478 else if (command == "~")
479 kind = InsetSpaceParams::PROTECTED;
480 else if (command == "\\thinspace{}")
481 kind = InsetSpaceParams::THIN;
482 else if (math && command == "\\medspace{}")
483 kind = InsetSpaceParams::MEDIUM;
484 else if (math && command == "\\thickspace{}")
485 kind = InsetSpaceParams::THICK;
486 else if (command == "\\quad{}")
487 kind = InsetSpaceParams::QUAD;
488 else if (command == "\\qquad{}")
489 kind = InsetSpaceParams::QQUAD;
490 else if (command == "\\enspace{}")
491 kind = InsetSpaceParams::ENSPACE;
492 else if (command == "\\enskip{}")
493 kind = InsetSpaceParams::ENSKIP;
494 else if (command == "\\negthinspace{}")
495 kind = InsetSpaceParams::NEGTHIN;
496 else if (math && command == "\\negmedspace{}")
497 kind = InsetSpaceParams::NEGMEDIUM;
498 else if (math && command == "\\negthickspace{}")
499 kind = InsetSpaceParams::NEGTHICK;
500 else if (command == "\\hfill{}")
501 kind = InsetSpaceParams::HFILL;
502 else if (command == "\\hspace*{\\fill}")
503 kind = InsetSpaceParams::HFILL_PROTECTED;
504 else if (command == "\\dotfill{}")
505 kind = InsetSpaceParams::DOTFILL;
506 else if (command == "\\hrulefill{}")
507 kind = InsetSpaceParams::HRULEFILL;
508 else if (command == "\\hspace{}")
509 kind = InsetSpaceParams::CUSTOM;
510 else if (command == "\\leftarrowfill{}")
511 kind = InsetSpaceParams::LEFTARROWFILL;
512 else if (command == "\\rightarrowfill{}")
513 kind = InsetSpaceParams::RIGHTARROWFILL;
514 else if (command == "\\upbracefill{}")
515 kind = InsetSpaceParams::UPBRACEFILL;
516 else if (command == "\\downbracefill{}")
517 kind = InsetSpaceParams::DOWNBRACEFILL;
518 else if (command == "\\hspace*{}")
519 kind = InsetSpaceParams::CUSTOM_PROTECTED;
521 lex.printError("InsetSpace: Unknown kind: `$$Token'");
523 if (lex.checkFor("\\length"))
528 void InsetSpace::write(ostream & os) const
535 void InsetSpace::read(Lexer & lex)
538 lex >> "\\end_inset";
542 int InsetSpace::latex(odocstream & os, OutputParams const & runparams) const
544 switch (params_.kind) {
545 case InsetSpaceParams::NORMAL:
546 os << (runparams.free_spacing ? " " : "\\ ");
548 case InsetSpaceParams::PROTECTED:
549 os << (runparams.free_spacing ? ' ' : '~');
551 case InsetSpaceParams::THIN:
552 os << (runparams.free_spacing ? " " : "\\,");
554 case InsetSpaceParams::MEDIUM:
555 os << (runparams.free_spacing ? " " : "\\:");
557 case InsetSpaceParams::THICK:
558 os << (runparams.free_spacing ? " " : "\\;");
560 case InsetSpaceParams::QUAD:
561 os << (runparams.free_spacing ? " " : "\\quad{}");
563 case InsetSpaceParams::QQUAD:
564 os << (runparams.free_spacing ? " " : "\\qquad{}");
566 case InsetSpaceParams::ENSPACE:
567 os << (runparams.free_spacing ? " " : "\\enspace{}");
569 case InsetSpaceParams::ENSKIP:
570 os << (runparams.free_spacing ? " " : "\\enskip{}");
572 case InsetSpaceParams::NEGTHIN:
573 os << (runparams.free_spacing ? " " : "\\negthinspace{}");
575 case InsetSpaceParams::NEGMEDIUM:
576 os << (runparams.free_spacing ? " " : "\\negmedspace{}");
578 case InsetSpaceParams::NEGTHICK:
579 os << (runparams.free_spacing ? " " : "\\negthickspace{}");
581 case InsetSpaceParams::HFILL:
582 os << (runparams.free_spacing ? " " : "\\hfill{}");
584 case InsetSpaceParams::HFILL_PROTECTED:
585 os << (runparams.free_spacing ? " " : "\\hspace*{\\fill}");
587 case InsetSpaceParams::DOTFILL:
588 os << (runparams.free_spacing ? " " : "\\dotfill{}");
590 case InsetSpaceParams::HRULEFILL:
591 os << (runparams.free_spacing ? " " : "\\hrulefill{}");
593 case InsetSpaceParams::LEFTARROWFILL:
594 os << (runparams.free_spacing ? " " : "\\leftarrowfill{}");
596 case InsetSpaceParams::RIGHTARROWFILL:
597 os << (runparams.free_spacing ? " " : "\\rightarrowfill{}");
599 case InsetSpaceParams::UPBRACEFILL:
600 os << (runparams.free_spacing ? " " : "\\upbracefill{}");
602 case InsetSpaceParams::DOWNBRACEFILL:
603 os << (runparams.free_spacing ? " " : "\\downbracefill{}");
605 case InsetSpaceParams::CUSTOM:
606 if (runparams.free_spacing)
609 os << "\\hspace{" << from_ascii(params_.length.asLatexString()) << "}";
611 case InsetSpaceParams::CUSTOM_PROTECTED:
612 if (runparams.free_spacing)
615 os << "\\hspace*{" << from_ascii(params_.length.asLatexString()) << "}";
622 int InsetSpace::plaintext(odocstream & os, OutputParams const &) const
624 switch (params_.kind) {
625 case InsetSpaceParams::HFILL:
626 case InsetSpaceParams::HFILL_PROTECTED:
629 case InsetSpaceParams::DOTFILL:
632 case InsetSpaceParams::HRULEFILL:
635 case InsetSpaceParams::LEFTARROWFILL:
638 case InsetSpaceParams::RIGHTARROWFILL:
641 case InsetSpaceParams::UPBRACEFILL:
644 case InsetSpaceParams::DOWNBRACEFILL:
654 int InsetSpace::docbook(odocstream & os, OutputParams const &) const
656 switch (params_.kind) {
657 case InsetSpaceParams::NORMAL:
658 case InsetSpaceParams::QUAD:
659 case InsetSpaceParams::QQUAD:
660 case InsetSpaceParams::ENSKIP:
663 case InsetSpaceParams::PROTECTED:
664 case InsetSpaceParams::ENSPACE:
665 case InsetSpaceParams::THIN:
666 case InsetSpaceParams::MEDIUM:
667 case InsetSpaceParams::THICK:
668 case InsetSpaceParams::NEGTHIN:
669 case InsetSpaceParams::NEGMEDIUM:
670 case InsetSpaceParams::NEGTHICK:
673 case InsetSpaceParams::HFILL:
674 case InsetSpaceParams::HFILL_PROTECTED:
676 case InsetSpaceParams::DOTFILL:
679 case InsetSpaceParams::HRULEFILL:
682 case InsetSpaceParams::LEFTARROWFILL:
683 case InsetSpaceParams::RIGHTARROWFILL:
684 case InsetSpaceParams::UPBRACEFILL:
685 case InsetSpaceParams::DOWNBRACEFILL:
686 case InsetSpaceParams::CUSTOM:
687 case InsetSpaceParams::CUSTOM_PROTECTED:
695 void InsetSpace::validate(LaTeXFeatures & features) const
697 if (params_.kind == InsetSpaceParams::NEGMEDIUM ||
698 params_.kind == InsetSpaceParams::NEGTHICK)
699 features.require("amsmath");
703 void InsetSpace::tocString(odocstream & os) const
705 plaintext(os, OutputParams(0));
709 bool InsetSpace::isStretchableSpace() const
711 return params_.kind == InsetSpaceParams::HFILL
712 || params_.kind == InsetSpaceParams::HFILL_PROTECTED
713 || params_.kind == InsetSpaceParams::DOTFILL
714 || params_.kind == InsetSpaceParams::HRULEFILL
715 || params_.kind == InsetSpaceParams::LEFTARROWFILL
716 || params_.kind == InsetSpaceParams::RIGHTARROWFILL
717 || params_.kind == InsetSpaceParams::UPBRACEFILL
718 || params_.kind == InsetSpaceParams::DOWNBRACEFILL;
722 docstring InsetSpace::contextMenu(BufferView const &, int, int) const
724 return from_ascii("context-space");
728 void InsetSpace::string2params(string const & in, InsetSpaceParams & params)
730 params = InsetSpaceParams();
734 istringstream data(in);
737 lex.setContext("InsetSpace::string2params");
739 string const name = lex.getString();
740 if (name == "mathspace")
744 LASSERT(name == "space", /**/);
747 // There are cases, such as when we are called via getStatus() from
748 // Dialog::canApply(), where we are just called with "space" rather
749 // than a full "space \type{}\n\\end_inset".
755 string InsetSpace::params2string(InsetSpaceParams const & params)
760 data << "space" << ' ';