+ // FIXME: rename in this case the PDF settings dialog checkbox
+ // label from "Use Hyperref" to "Customize Hyperref Settings"
+ // as discussd in bug #6293
+ opt = "\\hypersetup{" + rtrim(opt + hyperset, ",") + "}\n";
+ }
+
+ // hyperref expects LICR macros for non-ASCII chars.
+ // Usually, "(lua)inputenc" converts the input to LICR, with XeTeX utf-8 works, too.
+ // As hyperref provides good coverage for \inputencoding{utf8}, we can try
+ // this if the current input encoding does not support a character.
+ // FIXME: don't use \inputencoding if "inputenc" is not loaded (#9839).
+ if (need_unicode && enc && enc->iconvName() != "UTF-8") {
+ if (runparams.flavor != Flavor::XeTeX)
+ os << "\\inputencoding{utf8}\n";
+ os << setEncoding("UTF-8");
+ }
+ // If hyperref is loaded by the document class, we output
+ // \hypersetup \AtBeginDocument if hypersetup is not (yet)
+ // defined. In this case, the class loads hyperref late
+ // (see bug #7048).
+ if (hyperref_already_provided && !opt.empty()) {
+ os << "\\ifx\\hypersetup\\undefined\n"
+ << " \\AtBeginDocument{%\n "
+ << from_utf8(opt)
+ << " }\n"
+ << "\\else\n "
+ << from_utf8(opt)
+ << "\\fi\n";
+ } else
+ os << from_utf8(opt);
+ if (need_unicode && enc && enc->iconvName() != "UTF-8") {
+ os << setEncoding(enc->iconvName());
+ if (runparams.flavor != Flavor::XeTeX)
+ os << "\\inputencoding{" << from_ascii(enc->latexName()) << "}\n";
+ }