]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFonts.cpp
Remove unnecessary directives and preset search on fly.
[lyx.git] / src / LaTeXFonts.cpp
index 4cc1b82315bd157e0788be8494d90927bb78340d..bc4151cb2502cb16c7888b0d0c71dc8db10cb955 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"
@@ -110,6 +111,19 @@ bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath)
 }
 
 
+bool LaTeXFont::hasMonolithicExpertSet(bool ot1, bool complete, bool nomath)
+{
+       docstring const usedfont = getUsedFont(ot1, complete, nomath);
+
+       if (usedfont.empty())
+               return false;
+       else if (usedfont != name_)
+               return altFont(usedfont).hasMonolithicExpertSet(ot1, complete, nomath);
+       return (!osfoption_.empty() && !scoption_.empty() && osfoption_ == scoption_)
+               || (osfoption_.empty() && scoption_.empty() && !osfscoption_.empty());
+}
+
+
 bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath)
 {
        docstring const usedfont = getUsedFont(ot1, complete, nomath);
@@ -163,6 +177,11 @@ docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath)
        else if (!package_.empty()
                && LaTeXFeatures::isAvailable(to_ascii(package_)))
                        return name_;
+       else if (!preamble_.empty() && package_.empty()
+                && requires_.empty() && !switchdefault_
+                && altfonts_.empty()) {
+                       return name_;
+       }
        else if (!altfonts_.empty()) {
                for (size_t i = 0; i < altfonts_.size(); ++i) {
                        LaTeXFont altf = altFont(altfonts_[i]);
@@ -175,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())