X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextClass.cpp;h=f1b1df7eaab855ac78b1d13843d9f45479f23ac1;hb=c4db1d0f5a05429726d244caebd207bf29c58d71;hp=3f5721c9c658cfd078cef0d8b04854508e5b5832;hpb=1b4345ac31af278a3d8ace545b86dda95f3c96c9;p=lyx.git diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 3f5721c9c6..f1b1df7eaa 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -129,7 +129,7 @@ bool TextClass::isTeXClassAvailable() const } -bool TextClass::do_readStyle(Lexer & lexrc, Layout & lay) +bool TextClass::readStyle(Lexer & lexrc, Layout & lay) { LYXERR(Debug::TCLASS) << "Reading style " << to_utf8(lay.name()) << endl; if (!lay.read(lexrc, *this)) { @@ -298,16 +298,16 @@ bool TextClass::read(FileName const & filename, ReadType rt) + lexrc.getString() + " is probably not valid UTF-8!"; lexrc.printError(s.c_str()); Layout lay; - error = do_readStyle(lexrc, lay); + error = readStyle(lexrc, lay); } else if (hasLayout(name)) { Layout * lay = operator[](name).get(); - error = do_readStyle(lexrc, *lay); + error = readStyle(lexrc, *lay); } else { Layout lay; lay.setName(name); if (le == TC_ENVIRONMENT) lay.is_environment = true; - error = do_readStyle(lexrc, lay); + error = readStyle(lexrc, lay); if (!error) layoutlist_.push_back( boost::shared_ptr(new Layout(lay)) @@ -332,7 +332,7 @@ bool TextClass::read(FileName const & filename, ReadType rt) if (lexrc.next()) { docstring const style = from_utf8(subst(lexrc.getString(), '_', ' ')); - if (!delete_layout(style)) + if (!deleteLayout(style)) lyxerr << "Cannot delete style `" << to_utf8(style) << '\'' << endl; // lexrc.printError("Cannot delete style" @@ -366,7 +366,7 @@ bool TextClass::read(FileName const & filename, ReadType rt) break; case TC_DEFAULTFONT: - defaultfont_ = lyxRead(lexrc, sane_font); + defaultfont_ = lyxRead(lexrc); if (!defaultfont_.resolved()) { lexrc.printError("Warning: defaultfont should " "be fully instantiated!"); @@ -752,7 +752,6 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name) } } - // // Here add element to list if getout == true if (getout) { InsetLayout il; @@ -770,6 +769,9 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name) il.forceltr = forceltr; il.keepempty = keepempty; il.font = font; + // The label font is generally used as-is without + // any realization against a given context. + labelfont.realize(sane_font); il.labelfont = labelfont; il.bgcolor = bgcolor; il.preamble = preamble; @@ -1020,12 +1022,11 @@ LayoutPtr const & TextClass::operator[](docstring const & name) const BOOST_ASSERT(false); } - return (*cit); + return *cit; } - -bool TextClass::delete_layout(docstring const & name) +bool TextClass::deleteLayout(docstring const & name) { if (name == defaultLayoutName()) return false; @@ -1105,6 +1106,8 @@ InsetLayout const & TextClass::insetlayout(docstring const & name) const } static InsetLayout empty; empty.labelstring = from_utf8("UNDEFINED"); + empty.labelfont = sane_font; + empty.labelfont.setColor(Color_error); empty.bgcolor = Color_error; return empty; } @@ -1178,7 +1181,7 @@ docstring const & TextClass::preamble() const } -TextClass::PageSides TextClass::sides() const +PageSides TextClass::sides() const { return sides_; } @@ -1250,13 +1253,13 @@ bool TextClass::hasTocLevels() const } -ostream & operator<<(ostream & os, TextClass::PageSides p) +ostream & operator<<(ostream & os, PageSides p) { switch (p) { - case TextClass::OneSide: + case OneSide: os << '1'; break; - case TextClass::TwoSides: + case TwoSides: os << '2'; break; }