]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
Revert 23154.
[lyx.git] / src / Font.cpp
index 2c575add4b79248dd9df66ad4e531fdeebdb7145..39b78be01d5f11fae28a56ef2b516c1866b9f8f3 100644 (file)
@@ -18,9 +18,7 @@
 
 #include "BufferParams.h" // stateText
 #include "Color.h"
-#include "debug.h"
 #include "Encoding.h"
-#include "gettext.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "OutputParams.h"
 
 #include "support/convert.h"
+#include "support/debug.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 
-using std::endl;
-using std::string;
-using std::ostream;
-using std::ostringstream;
-using std::istringstream;
-using std::pair;
-
-#ifndef CXX_GLOBAL_CSTD
-using std::strlen;
-#endif
+#include <cstring>
 
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
-using support::ascii_lowercase;
-using support::bformat;
-using support::rtrim;
-using support::subst;
-
 //
 // Names for the GUI
 //
@@ -303,9 +291,9 @@ string const Font::latexSize() const
 
 // Read a font definition from given file in lyx format
 // Used for layouts
-FontInfo lyxRead(Lexer & lex)
+FontInfo lyxRead(Lexer & lex, FontInfo const & fi)
 {
-       FontInfo f;
+       FontInfo f = fi;
        bool error = false;
        bool finished = false;
        while (!finished && lex.isOK() && !error) {
@@ -464,8 +452,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
 
        if (language()->encoding()->package() == Encoding::CJK) {
                pair<bool, int> const c = switchEncoding(os, bparams,
-                               runparams.moving_arg, *(runparams.encoding),
-                               *(language()->encoding()));
+                               runparams, *(language()->encoding()));
                if (c.first) {
                        open_encoding_ = true;
                        count += c.second;
@@ -635,8 +622,7 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
                // to do correct environment nesting
                Encoding const * const ascii = encodings.getFromLyXName("ascii");
                pair<bool, int> const c = switchEncoding(os, bparams,
-                               runparams.moving_arg, *(runparams.encoding),
-                               *ascii);
+                               runparams, *ascii);
                BOOST_ASSERT(c.first);
                count += c.second;
                runparams.encoding = ascii;
@@ -653,15 +639,14 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
 }
 
 
-std::string Font::toString(bool const toggle) const
+string Font::toString(bool const toggle) const
 {
        string lang = "ignore";
        if (language())
                lang = language()->lang();
 
        ostringstream os;
-       os << "font: " << '\n'
-          << "family " << bits_.family() << '\n'
+       os << "family " << bits_.family() << '\n'
           << "series " << bits_.series() << '\n'
           << "shape " << bits_.shape() << '\n'
           << "size " << bits_.size() << '\n'
@@ -759,13 +744,9 @@ void Font::validate(LaTeXFeatures & features) const
        Language const * doc_language = bparams.language;
 
        if (bits_.noun() == FONT_ON) {
-               LYXERR(Debug::LATEX) << "font.noun: "
-                       << bits_.noun()
-                       << endl;
+               LYXERR(Debug::LATEX, "font.noun: " << bits_.noun());
                features.require("noun");
-               LYXERR(Debug::LATEX) << "Noun enabled. Font: "
-                       << to_utf8(stateText(0))
-                       << endl;
+               LYXERR(Debug::LATEX, "Noun enabled. Font: " << to_utf8(stateText(0)));
        }
        switch (bits_.color()) {
                case Color_none:
@@ -778,9 +759,7 @@ void Font::validate(LaTeXFeatures & features) const
                        break;
                default:
                        features.require("color");
-                       LYXERR(Debug::LATEX) << "Color enabled. Font: "
-                               << to_utf8(stateText(0))
-                               << endl;
+                       LYXERR(Debug::LATEX, "Color enabled. Font: " << to_utf8(stateText(0)));
        }
 
        // FIXME: Do something for background and soul package?
@@ -790,8 +769,7 @@ void Font::validate(LaTeXFeatures & features) const
                lang_ != latex_language)
        {
                features.useLanguage(lang_);
-               LYXERR(Debug::LATEX) << "Found language "
-                       << lang_->lang() << endl;
+               LYXERR(Debug::LATEX, "Found language " << lang_->lang());
        }
 }
 
@@ -802,7 +780,7 @@ ostream & operator<<(ostream & os, FontState fms)
 }
 
 
-ostream & operator<<(std::ostream & os, FontInfo const & f)
+ostream & operator<<(ostream & os, FontInfo const & f)
 {
        return os << "font:"
                << " family " << f.family()
@@ -819,7 +797,7 @@ ostream & operator<<(std::ostream & os, FontInfo const & f)
 }
 
 
-std::ostream & operator<<(std::ostream & os, Font const & font)
+ostream & operator<<(ostream & os, Font const & font)
 {
        return os << font.bits_
                << " lang: " << (font.lang_ ? font.lang_->lang() : 0);