Forbid implicit conversion from FontInfo to Font.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21250 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-28 23:32:18 +00:00
parent f075554097
commit d2bfe05827
5 changed files with 13 additions and 14 deletions

View File

@ -38,7 +38,7 @@ class Font {
public:
///
Font(FontInfo = sane_font, Language const * l = 0);
explicit Font(FontInfo = sane_font, Language const * l = 0);
///
FontInfo & fontInfo() { return bits_; }

View File

@ -1364,11 +1364,10 @@ Font const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
Font const Paragraph::getLabelFont
(BufferParams const & bparams, Font const & outerfont) const
{
Font tmpfont = layout()->labelfont;
tmpfont.setLanguage(getParLanguage(bparams));
tmpfont.fontInfo().realize(outerfont.fontInfo());
tmpfont.fontInfo().realize(bparams.getFont().fontInfo());
return tmpfont;
FontInfo tmpfont = layout()->labelfont;
tmpfont.realize(outerfont.fontInfo());
tmpfont.realize(bparams.getFont().fontInfo());
return Font(tmpfont, getParLanguage(bparams));
}
@ -2156,7 +2155,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
bool emph_flag = false;
LayoutPtr const & style = layout();
Font font_old =
FontInfo font_old =
style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
if (style->pass_thru && !d->onlyText(buf, outerfont, initial))
@ -2167,7 +2166,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
Font font = getFont(buf.params(), i, outerfont);
// handle <emphasis> tag
if (font_old.fontInfo().emph() != font.fontInfo().emph()) {
if (font_old.emph() != font.fontInfo().emph()) {
if (font.fontInfo().emph() == FONT_ON) {
os << "<emphasis>";
emph_flag = true;
@ -2188,7 +2187,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
else
os << sgml::escapeChar(c);
}
font_old = font;
font_old = font.fontInfo();
}
if (emph_flag) {

View File

@ -395,7 +395,7 @@ void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall)
{
BOOST_ASSERT(this == cur.text());
// If the mask is completely neutral, tell user
if (font == ignore_font) {
if (font.fontInfo() == ignore_font) {
// Could only happen with user style
cur.message(_("No font change defined."));
return;

View File

@ -846,7 +846,7 @@ boost::tuple<int, int> TextMetrics::rowHeight(pit_type const pit, pos_type const
Buffer const & buffer = bv_->buffer();
Font font = getDisplayFont(pit, first);
FontSize const tmpsize = font.fontInfo().size();
font = text_->getLayoutFont(buffer, pit);
font.fontInfo() = text_->getLayoutFont(buffer, pit);
FontSize const size = font.fontInfo().size();
font.fontInfo().setSize(tmpsize);
@ -1742,7 +1742,7 @@ int TextMetrics::leftMargin(int max_width,
&& pit > 0 && pars[pit - 1].layout()->nextnoindent)
parindent.erase();
Font const labelfont = text_->getLabelFont(buffer, par);
FontInfo const labelfont = text_->getLabelFont(buffer, par);
FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
switch (layout->margintype) {

View File

@ -231,8 +231,8 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
// start of an existing paragraph get the buffer language
// and not latex_language, so we take this brute force
// approach.
cur.current_font = layout->font;
cur.real_current_font = layout->font;
cur.current_font.fontInfo() = layout->font;
cur.real_current_font.fontInfo() = layout->font;
cur.current_font.setLanguage(latex_language);
cur.real_current_font.setLanguage(latex_language);
InsetCollapsable::doDispatch(cur, cmd);