]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Streamlining CollapseStatus stuff
[lyx.git] / src / BufferParams.cpp
index c96270cadbbb47d21c7b699802de126285a54566..57932680f5bdb2e33fc016e6f287df4f9d463aef 100644 (file)
 #include "frontends/alert.h"
 #include "insets/InsetListingsParams.h"
 
-#include "support/lyxalgo.h" // for lyx::count
 #include "support/convert.h"
 #include "support/Translator.h"
 
 #include <boost/array.hpp>
 
+#include <algorithm>
 #include <sstream>
 
+using std::count;
 using std::endl;
 using std::string;
 using std::istringstream;
@@ -766,7 +767,10 @@ void BufferParams::writeFile(ostream & os) const
        AuthorList::Authors::const_iterator a_it = pimpl_->authorlist.begin();
        AuthorList::Authors::const_iterator a_end = pimpl_->authorlist.end();
        for (; a_it != a_end; ++a_it) {
-               os << "\\author " << a_it->second << "\n";
+               if (a_it->second.used())
+                       os << "\\author " << a_it->second << "\n";
+               else
+                       os << "\\author " << Author() << "\n";
        }
 }
 
@@ -892,11 +896,20 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        if (fontsDefaultFamily != "default")
                os << "\\renewcommand{\\familydefault}{\\"
                   << from_ascii(fontsDefaultFamily) << "}\n";
+
+       // set font encoding
        // this one is not per buffer
+       // for arabic_arabi and farsi we also need to load the LAE and LFE encoding
        if (lyxrc.fontenc != "default") {
-               os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
-                  << "]{fontenc}\n";
-               texrow.newline();
+               if (language->lang() == "arabic_arabi" || language->lang() == "farsi") {
+                       os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
+                          << ",LFE,LAE]{fontenc}\n";
+                       texrow.newline();
+               } else {
+                       os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
+                          << "]{fontenc}\n";
+                       texrow.newline();
+               }
        }
 
        // handle inputenc etc.
@@ -1144,10 +1157,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                lyxpreamble += from_utf8(features.getBabelOptions());
        }
 
-       lyxpreamble += "\\makeatother\n";
+       lyxpreamble += "\\makeatother\n\n";
 
        int const nlines =
-               int(lyx::count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
+               int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
        for (int j = 0; j != nlines; ++j) {
                texrow.newline();
        }
@@ -1399,7 +1412,7 @@ void BufferParams::writeEncodingPreamble(odocstream & os,
                        texrow.newline();
                }
        } else if (inputenc != "default") {
-               switch (language->encoding()->package()) {
+               switch (encoding().package()) {
                case Encoding::none:
                        break;
                case Encoding::inputenc: