X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLaTeXFonts.cpp;h=e37ad2e945269ac5fcbcc459057064724e1380c2;hb=26910d5ec49395d1372dd5b9259f1bf6ed23de0a;hp=ce772bcc50e5a022fe71723d5975cdd7603dde72;hpb=909963fd5a542c60ccf2632c9a777a08f122a065;p=lyx.git diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp index ce772bcc50..e37ad2e945 100644 --- a/src/LaTeXFonts.cpp +++ b/src/LaTeXFonts.cpp @@ -88,7 +88,7 @@ bool LaTeXFont::providesOSF(bool ot1, bool complete, bool nomath) return altFont(usedfont).providesOSF(ot1, complete, nomath); else if (!osffont_.empty()) return altFont(osffont_).available(ot1, nomath); - else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_))) + else if (!available(ot1, nomath)) return false; return (!osfoption_.empty() || !osfscoption_.empty()); @@ -103,13 +103,26 @@ bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath) return false; else if (usedfont != name_) return altFont(usedfont).providesSC(ot1, complete, nomath); - else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_))) + else if (!available(ot1, nomath)) return false; return (!scoption_.empty() || !osfscoption_.empty()); } +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); @@ -118,9 +131,8 @@ bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath) return false; else if (usedfont != name_) return altFont(usedfont).providesScale(ot1, complete, nomath); - else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_))) + else if (!available(ot1, nomath)) return false; - return (!scaleoption_.empty()); } @@ -164,6 +176,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]); @@ -276,6 +293,9 @@ string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool if (osf && providesOSF(ot1, complete, nomath) && !osffont_.empty()) os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf, nomath, scale); + if (!preamble_.empty()) + os << preamble_; + return os.str(); } @@ -296,6 +316,7 @@ bool LaTeXFont::readFont(Lexer & lex) LF_OT1_FONT, LF_PACKAGE, LF_PACKAGEOPTION, + LF_PREAMBLE, LF_PROVIDES, LF_REQUIRES, LF_SCALEOPTION, @@ -318,6 +339,7 @@ bool LaTeXFont::readFont(Lexer & lex) { "ot1font", LF_OT1_FONT }, { "package", LF_PACKAGE }, { "packageoption", LF_PACKAGEOPTION }, + { "preamble", LF_PREAMBLE }, { "provides", LF_PROVIDES }, { "requires", LF_REQUIRES }, { "scaleoption", LF_SCALEOPTION }, @@ -387,6 +409,9 @@ bool LaTeXFont::readFont(Lexer & lex) case LF_PACKAGEOPTION: lex >> packageoption_; break; + case LF_PREAMBLE: + preamble_ = lex.getLongString("EndPreamble"); + break; case LF_PROVIDES: { lex.eatLine(); string features = lex.getString();