X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLaTeXFonts.cpp;h=ad65439b942df50f738a225e63a8a79cdc76390f;hb=4300feb8595c8542050adedf664cd4bfda7ede12;hp=169497542245ce890e98f7048b5f5c3bdb73b2e8;hpb=55bc3665a2a43e4dca30b5071078b8bc7548464b;p=lyx.git diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp index 1694975422..ad65439b94 100644 --- a/src/LaTeXFonts.cpp +++ b/src/LaTeXFonts.cpp @@ -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); @@ -180,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()) @@ -281,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(); } @@ -350,7 +373,7 @@ bool LaTeXFont::readFont(Lexer & lex) error = true; continue; - default: + default: break; } switch (static_cast(le)) { @@ -397,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();