#include "MetricsInfo.h"
#include "OutputParams.h"
#include "output_xhtml.h"
+#include "texstream.h"
#include "support/debug.h"
#include "support/docstream.h"
void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
{
if (isHfill()) {
- // The metrics for this kinds are calculated externally in
- // \c TextMetrics::computeRowMetrics. Those are dummy value:
- dim = Dimension(10, 10, 10);
+ // The width for hfills is calculated externally in
+ // TextMetrics::setRowAlignment. The value of 5 is the
+ // minimal value when the hfill is not active.
+ dim = Dimension(5, 10, 10);
return;
}
break;
case InsetSpaceParams::CUSTOM:
case InsetSpaceParams::CUSTOM_PROTECTED: {
- int const w =
- params_.length.len().inPixels(mi.base);
+ int const w = mi.base.inPixels(params_.length.len());
int const minw = (w < 0) ? 3 * arrow_size : 4;
dim.wid = max(minw, abs(w));
break;
// shut up compiler
break;
}
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
}
int const w = dim.wid;
- int const h = theFontMetrics(pi.base.font).ascent('x');
+ int const h = theFontMetrics(pi.base.font).xHeight();
int xp[4], yp[4];
- xp[0] = x;
+ xp[0] = x + 1;
yp[0] = y - max(h / 4, 1);
if (params_.kind == InsetSpaceParams::NORMAL ||
params_.kind == InsetSpaceParams::PROTECTED ||
params_.kind == InsetSpaceParams::VISIBLE) {
- xp[1] = x; yp[1] = y;
- xp[2] = x + w; yp[2] = y;
+ xp[1] = x + 1; yp[1] = y;
+ xp[2] = x + w - 2; yp[2] = y;
} else {
- xp[1] = x; yp[1] = y + max(h / 4, 1);
- xp[2] = x + w; yp[2] = y + max(h / 4, 1);
+ xp[1] = x + 1; yp[1] = y + max(h / 4, 1);
+ xp[2] = x + w - 2; yp[2] = y + max(h / 4, 1);
}
- xp[3] = x + w;
+ xp[3] = x + w - 2;
yp[3] = y - max(h / 4, 1);
Color col = Color_special;
void InsetSpaceParams::write(ostream & os) const
{
- string command;
switch (kind) {
case InsetSpaceParams::NORMAL:
os << "\\space{}";
void InsetSpace::validate(LaTeXFeatures & features) const
{
if (params_.kind == InsetSpaceParams::NEGMEDIUM ||
- params_.kind == InsetSpaceParams::NEGTHICK)
+ params_.kind == InsetSpaceParams::NEGTHICK)
features.require("amsmath");
}
}
-void InsetSpace::forOutliner(docstring & os, size_t) const
+void InsetSpace::forOutliner(docstring & os, size_t const, bool const) const
{
// There's no need to be cute here.
os += " ";