From: Enrico Forestieri Date: Sat, 3 Oct 2015 16:13:20 +0000 (+0200) Subject: Fix #9726: Preview does not have correct font size X-Git-Tag: 2.2.0alpha1~271 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8a909b0fa3a913634b96c8ee62caa4468d338a4d;p=features.git Fix #9726: Preview does not have correct font size --- diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 08bbe414a9..92372f02cb 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -713,6 +713,23 @@ void InsetMathHull::preparePreview(DocIterator const & pos, for (; it != end; ++it) macro_preamble.append(*it); + // set the font series and size for this snippet + DocIterator dit = pos; + while (dit.inMathed()) + dit.pop_back(); + Paragraph const & par = dit.paragraph(); + Font font = par.getFontSettings(buffer->params(), dit.pos()); + font.fontInfo().realize(par.layout().font); + string const lsize = font.latexSize(); + docstring setfont; + docstring endfont; + if (font.fontInfo().series() == BOLD_SERIES) { + setfont += from_ascii("\\textbf{"); + endfont += '}'; + } + if (lsize != "normalsize" && !prefixIs(lsize, "error")) + setfont += from_ascii("\\" + lsize + '\n'); + docstring setcnt; if (forexport && haveNumbers()) { docstring eqstr = from_ascii("equation"); @@ -734,7 +751,8 @@ void InsetMathHull::preparePreview(DocIterator const & pos, '{' + convert(num) + '}'; } } - docstring const snippet = macro_preamble + setcnt + latexString(*this); + docstring const snippet = macro_preamble + setfont + setcnt + + latexString(*this) + endfont; LYXERR(Debug::MACROS, "Preview snippet: " << snippet); preview_->addPreview(snippet, *buffer, forexport); }