+2005-04-12 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * lyxtext.h:
+ * text.C (metrics):
+ * text2.C (getFont):
+ * rowpainter.C (getFont): Fix metrics bug introduced by inset
+ fonts fix
+
2005-04-11 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* paragraph.C (simpleTeXOnePar): add missing '}' in LaTeX
///
LyXFont getFont(Paragraph const & par, pos_type pos) const;
///
+ void applyOuterFont(LyXFont &) const;
+ ///
LyXFont getLayoutFont(pit_type pit) const;
///
LyXFont getLabelFont(Paragraph const & par) const;
LyXFont current_font;
/// the current font
LyXFont real_current_font;
- /// our buffer's default layout font
+ /// our buffer's default layout font. This is textclass specific
LyXFont defaultfont_;
///
int background_color_;
///
ParagraphList pars_;
- /// our 'outermost' Font
+ /// our 'outermost' font. This is handed down from the surrounding
+ // inset through the pi/mi parameter (pi.base.font)
LyXFont font_;
///
double separator_;
double hfill_;
double label_hfill_;
-
- // Hack to get 1.4cvs working
- LyXFont font_;
};
LyXText const & text, pit_type pit, Row const & row, int x, int y)
: bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
row_(row), pit_(pit), par_(text.paragraphs()[pit]),
- xo_(x), yo_(y), width_(text_.width()), font_(pi.base.font)
+ xo_(x), yo_(y), width_(text_.width())
{
RowMetrics m = text_.computeRowMetrics(pit, row_);
x_ = m.x + xo_;
/// "temporary"
LyXFont const RowPainter::getFont(pos_type pos) const
{
- LyXFont lf(font_);
LyXFont pf(text_.getFont(par_, pos));
- lf.reduce(LyXFont(LyXFont::ALL_SANE));
- lf.realize(pf);
- lf.setLanguage(pf.language());
- return lf;
+ text_.applyOuterFont(pf);
+ return pf;
}
maxwidth_ = mi.base.textwidth;
//lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
// << " maxWidth: " << maxwidth_ << "\nfont: " << mi.base.font << endl;
+ // save the caller's font locally:
+ font_ = mi.base.font;
unsigned int h = 0;
unsigned int w = 0;
if (!par.getDepth()) {
LyXFont f = par.getFontSettings(params, pos);
if (!isMainText())
- f.realize(font_);
+ applyOuterFont(f);
if (layout->labeltype == LABEL_MANUAL && pos < body_pos)
return f.realize(layout->reslabelfont);
else
font.realize(layoutfont);
if (!isMainText())
- font.realize(font_);
+ applyOuterFont(font);
// Realize with the fonts of lesser depth.
font.realize(defaultfont_);
return font;
}
+// There are currently two font mechanisms in LyX:
+// 1. The font attributes in a lyxtext, and
+// 2. The inset-specific font properties, defined in an inset's
+// metrics() and draw() methods and handed down the inset chain through
+// the pi/mi parameters, and stored locally in a lyxtext in font_.
+// This is where the two are integrated in the final fully realized
+// font.
+void LyXText::applyOuterFont(LyXFont & font) const {
+ LyXFont lf(font_);
+ lf.reduce(defaultfont_);
+ lf.realize(font);
+ lf.setLanguage(font.language());
+ font = lf;
+}
+
LyXFont LyXText::getLayoutFont(pit_type const pit) const
{