LaTeXFonts latexfonts;
-LaTeXFont LaTeXFont::altFont(docstring const & name)
+LaTeXFont LaTeXFont::altFont(docstring const & name) const
{
return theLaTeXFonts().getAltFont(name);
}
-bool LaTeXFont::available(bool ot1, bool nomath)
+bool LaTeXFont::available(bool ot1, bool nomath) const
{
if (nomath && !nomathfont_.empty())
return altFont(nomathfont_).available(ot1, nomath);
&& LaTeXFeatures::isAvailable(to_ascii(package_)))
return true;
else if (!altfonts_.empty()) {
- for (size_t i = 0; i < altfonts_.size(); ++i) {
- if (altFont(altfonts_[i]).available(ot1, nomath))
+ for (auto const & name : altfonts_) {
+ if (altFont(name).available(ot1, nomath))
return true;
}
}
}
-bool LaTeXFont::providesNoMath(bool ot1, bool complete)
+bool LaTeXFont::providesNoMath(bool ot1, bool complete) const
{
docstring const usedfont = getUsedFont(ot1, complete, false, false);
}
-bool LaTeXFont::providesOSF(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesOSF(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
}
-bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
}
-bool LaTeXFont::hasMonolithicExpertSet(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::hasMonolithicExpertSet(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
}
-bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
return altFont(usedfont).providesScale(ot1, complete, nomath);
else if (!available(ot1, nomath))
return false;
- return (!scaleoption_.empty());
+ return (!scaleoption_.empty() || !scalecmd_.empty());
}
-bool LaTeXFont::providesMoreOptions(bool ot1, bool complete, bool nomath)
+bool LaTeXFont::providesMoreOptions(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
return (moreopts_);
}
-bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool nomath)
+bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
else if (provides_.empty())
return false;
- for (size_t i = 0; i < provides_.size(); ++i) {
- if (provides_[i] == name)
+ for (auto const & provide : provides_) {
+ if (provide == name)
return true;
}
return false;
}
-docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath, bool osf)
+docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath, bool osf) const
{
if (osf && osfFontOnly())
return osffont_;
return name_;
}
else if (!altfonts_.empty()) {
- for (size_t i = 0; i < altfonts_.size(); ++i) {
- LaTeXFont altf = altFont(altfonts_[i]);
+ for (auto const & name : altfonts_) {
+ LaTeXFont altf = altFont(name);
if (altf.available(ot1, nomath))
return altf.getUsedFont(ot1, complete, nomath, osf);
}
}
-docstring const LaTeXFont::getUsedPackage(bool ot1, bool complete, bool nomath)
+docstring const LaTeXFont::getUsedPackage(bool ot1, bool complete, bool nomath) const
{
docstring const usedfont = getUsedFont(ot1, complete, nomath, false);
if (usedfont.empty())
}
-string const LaTeXFont::getAvailablePackage(bool dryrun)
+string const LaTeXFont::getAvailablePackage(bool dryrun) const
{
if (package_.empty())
return string();
string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool osf,
- int scale, string const & extraopts, bool nomath)
+ int scale, string const & extraopts, bool nomath) const
{
ostringstream os;
bool const needosfopt = (osf != osfdefault_);
string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool sc,
- bool osf, bool nomath, string const & extraopts,
- int const & scale)
+ bool osf, bool nomath, string const & extraopts, int scale) const
{
ostringstream os;
if (osf && providesOSF(ot1, complete, nomath) && !osffont_.empty())
os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf,
nomath, extraopts, scale);
+ if (scale != 100 && !scalecmd_.empty()
+ && providesScale(ot1, complete, nomath)) {
+ if (contains(scalecmd_, '@'))
+ os << "\\makeatletter\n";
+ os << subst(to_ascii(scalecmd_), "$$val",
+ convert<std::string>(float(scale) / 100)) << '\n';
+ if (contains(scalecmd_, '@'))
+ os << "\\makeatother\n";
+ }
if (!preamble_.empty())
os << to_utf8(preamble_);
LF_PREAMBLE,
LF_PROVIDES,
LF_REQUIRES,
+ LF_SCALECMD,
LF_SCALEOPTION,
LF_SCOPTION,
LF_SWITCHDEFAULT
{ "preamble", LF_PREAMBLE },
{ "provides", LF_PROVIDES },
{ "requires", LF_REQUIRES },
+ { "scalecommand", LF_SCALECMD },
{ "scaleoption", LF_SCALEOPTION },
{ "scoption", LF_SCOPTION },
{ "switchdefault", LF_SWITCHDEFAULT }
case LF_REQUIRES:
lex >> required_;
break;
+ case LF_SCALECMD:
+ lex >> scalecmd_;
+ break;
case LF_SCALEOPTION:
lex >> scaleoption_;
break;
bool LaTeXFont::read(Lexer & lex)
{
- switchdefault_ = 0;
- osfdefault_ = 0;
- moreopts_ = 0;
- osffontonly_ = 0;
+ switchdefault_ = false;
+ osfdefault_ = false;
+ moreopts_ = false;
+ osffontonly_ = false;
if (!lex.next()) {
lex.printError("No name given for LaTeX font: `$$Token'.");