]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFonts.cpp
Account for old versions of Pygments
[lyx.git] / src / LaTeXFonts.cpp
index e37ad2e945269ac5fcbcc459057064724e1380c2..862e47451646798447ccf1fd8784f939705373ed 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
@@ -193,6 +194,15 @@ docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath)
 }
 
 
+docstring const LaTeXFont::getUsedPackage(bool ot1, bool complete, bool nomath)
+{
+       docstring const usedfont = getUsedFont(ot1, complete, nomath);
+       if (usedfont.empty())
+               return docstring();
+       return theLaTeXFonts().getLaTeXFont(usedfont).package();
+}
+
+
 string const LaTeXFont::getAvailablePackage(bool dryrun)
 {
        if (package_.empty())
@@ -294,7 +304,7 @@ string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool
                os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf, nomath, scale);
 
        if (!preamble_.empty())
-               os << preamble_;
+               os << to_utf8(preamble_);
 
        return os.str();
 }
@@ -410,7 +420,7 @@ bool LaTeXFont::readFont(Lexer & lex)
                        lex >> packageoption_;
                        break;
                case LF_PREAMBLE:
-                       preamble_ = lex.getLongString("EndPreamble");
+                       preamble_ = lex.getLongString(from_ascii("EndPreamble"));
                        break;
                case LF_PROVIDES: {
                        lex.eatLine();