Use it instead of measuring the height of character 'x'.
virtual Dimension const defaultDimension() const = 0;
/// return the em size
virtual int em() const = 0;
+ /// return the x height
+ virtual int xHeight() const = 0;
/// return the width of a line for underlining
virtual int lineWidth() const = 0;
/// return the distance from the base line to where an underline
}
+int GuiFontMetrics::xHeight() const
+{
+// LATTEST(metrics_.xHeight() == ascent('x'));
+ return metrics_.xHeight();
+}
+
+
int GuiFontMetrics::lineWidth() const
{
return metrics_.lineWidth();
virtual int maxDescent() const;
virtual Dimension const defaultDimension() const;
virtual int em() const;
+ virtual int xHeight() const;
virtual int lineWidth() const;
virtual int underlinePos() const;
virtual int strikeoutPos() const;
}
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;
/** Reference macro:
* \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}
*/
- int const ex = theFontMetrics(font).ascent('x');
+ int const ex = theFontMetrics(font).xHeight();
drawChar(pi, x, y, 'T');
x -= em / 6;
drawChar(pi, x, y + ex / 2, 'E');
case ALLOWBREAK:
{
// A small vertical line
- int const asc = theFontMetrics(pi.base.font).ascent('x');
+ int const asc = theFontMetrics(pi.base.font).xHeight();
int const desc = theFontMetrics(pi.base.font).descent('g');
int const x0 = x; // x + 1; // FIXME: incline,
int const x1 = x; // x - 1; // similar to LibreOffice?
frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
BufferView * bv = mi.base.bv;
int const Iascent = fm.dimension('I').ascent();
- int xascent = fm.dimension('x').ascent();
+ int xascent = fm.xHeight();
if (xascent >= Iascent)
xascent = (2 * Iascent) / 3;
minasc_ = xascent;
if (tight)
// FIXME: this is the minimal ascent seen empirically, check
// what the TeXbook says.
- dim.asc = max(dim.asc, fm.ascent('x'));
+ dim.asc = max(dim.asc, fm.xHeight());
else {
dim.asc = max(dim.asc, fm.maxAscent());
dim.des = max(dim.des, fm.maxDescent());
/// rebuild cached metrics information
/** When \c tight is true, the height of the cell will be at least
- * that of 'x'. Otherwise, it will be the max height of the font.
+ * the x height of the font. Otherwise, it will be the max height
+ * of the font.
*/
void metrics(MetricsInfo & mi, Dimension & dim, bool tight = true) const;
///
int mathed_font_x_height(FontInfo const & font)
{
- return theFontMetrics(font).ascent('x');
+ return theFontMetrics(font).xHeight();
}
/* The math units. Quoting TeX by Topic, p.205: