Ejemplo n.º 1
0
void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
{
	Dimension dim0;
	cell(0).metrics(mi, dim0);
	FontInfo font = mi.base.font;
	augmentFont(font, from_ascii("mathnormal"));
	Dimension t = theFontMetrics(font).dimension('{');
	dim.asc = max(dim0.asc, t.asc);
	dim.des = max(dim0.des, t.des);
	dim.wid = dim0.width() + 2 * t.wid;
	metricsMarkers(dim);
}
Ejemplo n.º 2
0
void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
{
	FontInfo font = pi.base.font;
	augmentFont(font, from_ascii("mathnormal"));
	font.setShape(UP_SHAPE);
	font.setColor(Color_latex);
	Dimension t = theFontMetrics(font).dimension('{');
	pi.pain.text(x, y, '{', font);
	cell(0).draw(pi, x + t.wid, y);
	Dimension const & dim0 = cell(0).dimension(*pi.base.bv);
	pi.pain.text(x + t.wid + dim0.width(), y, '}', font);
	drawMarkers(pi, x, y);
}
Ejemplo n.º 3
0
FontSetChanger::FontSetChanger(MetricsBase & mb, docstring const & name,
				bool really_change_font)
	: Changer<MetricsBase>(mb), change_(really_change_font)
{
	if (change_) {
		FontSize oldsize = save_.font.size();
		ColorCode oldcolor = save_.font.color();
		docstring const oldname = from_ascii(save_.fontname);
		mb.fontname = to_utf8(name);
		mb.font = sane_font;
		augmentFont(mb.font, name);
		mb.font.setSize(oldsize);
		if (name != "lyxtex"
		    && ((isTextFont(oldname) && oldcolor != Color_foreground)
			|| (isMathFont(oldname) && oldcolor != Color_math)))
			mb.font.setColor(oldcolor);
	}
}