+
+ if (moreopts && !extraopts.empty()) {
+ if (!os.str().empty())
+ os << ',';
+ os << extraopts;
+ }
+ return os.str();
+}
+
+
+string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool sc,
+ bool osf, bool nomath, string const & extraopts, int scale) const
+{
+ ostringstream os;
+
+ docstring const usedfont = getUsedFont(ot1, complete, nomath, osf);
+ if (usedfont.empty())
+ return string();
+ else if (usedfont != name_)
+ return altFont(usedfont).getLaTeXCode(dryrun, ot1, complete, sc,
+ osf, nomath, extraopts, scale);
+
+ if (switchdefault_) {
+ if (family_.empty()) {
+ LYXERR0("Error: Font `" << name_ << "' has no family defined!");
+ return string();
+ }
+ if (available(ot1, nomath) || dryrun)
+ os << "\\renewcommand{\\" << to_ascii(family_) << "default}{"
+ << to_ascii(name_) << "}\n";
+ else
+ frontend::Alert::warning(_("Font not available"),
+ bformat(_("The LaTeX package `%1$s' needed for the font `%2$s'\n"
+ "is not available on your system. LyX will fall back to the default font."),
+ required_, guiname_), true);
+ } else {
+ string const package =
+ getAvailablePackage(dryrun);
+ string const packageopts = getPackageOptions(ot1, complete, sc, osf, scale, extraopts, nomath);
+ if (packageopts.empty() && !package.empty())
+ os << "\\usepackage{" << package << "}\n";
+ else if (!packageopts.empty() && !package.empty())
+ os << "\\usepackage[" << packageopts << "]{" << package << "}\n";
+ }
+ 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_);
+