On Tue, Oct 20, 2015 at 09:10:05PM +0000, Guenter Milde wrote: > On 2015-10-20, Scott Kostyshak wrote: > > On Tue, Oct 20, 2015 at 07:16:44PM +0200, Günter Milde wrote: > >> commit 1523fc6023440f10ca0d82a681ded5c060d8fd33 > >> Author: Günter Milde <mi...@lyx.org> > >> Date: Tue Oct 20 19:14:39 2015 +0200 > > >> Partial fix for #9740 "XeTeX/LuaTeX with TeX fonts problems". > > >> Fixes output for 3 of the 4 test lyx-files. > > >> Includes "FIXME"s at places where further action is required to get > >> the XeTeX > >> export right but I don't know how. > >> ... > > >> + &&!runparams.isFullUnicode()) { // FIXME: check must be done for > >> useNonTeXFonts! > >> os << "\\inputencoding{utf8}\n" > >> << setEncoding("UTF-8"); > > > So to make sure I understand what you want with this FIXME is you would > > like to do something like params().useNonTeXFonts as you do in > > Buffer.cpp but in PDFOptions.cpp it's not clear how to access that? > > It may also be that I misunderstand what is done there, but basically, yes: > I believe that the test at these places must be for "useNonTeXFonts" instead > of "isFullUnicode", because XeTeX/LuaTeX with TeX fonts behave more similar > to 8-bit TeX regarding the in- and output encodings.
OK, what about the attached patch? Can you check that it does what you want as far as the two FIXMEs in PDFOptions.cpp? If so, hopefully someone else can confirm that it is reasonable to pass the buffer parameters in this situation. Then after that I could extend the fix to address the other FIXMEs that you have regarding useNonTeXFonts. Günter are you familiar with "git blame"? It is a useful tool for purposes such as these where we might want to check with the person who introduced a certain line of code. For example, if before your commit (otherwise it will say you are the author of that line because you edited it to put the comment) I do git blame PDFOptions.cpp and then I search (with '/') for "isFullUnicode" it takes me to the first instance and tells me that Jürgen introduced this line in the commit baaceb10. So now we ping Jürgen (now CC'ed) and see what his opinion is on this. Scott
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 537178e..60f1a24 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1901,8 +1901,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, // to access the stream itself in PDFOptions. os << lyxpreamble; - OutputParams tmp_params = features.runparams(); - pdfoptions().writeLaTeX(tmp_params, os, + OutputParams output_params = features.runparams(); + BufferParams buffer_params = *this; + pdfoptions().writeLaTeX(output_params, buffer_params, os, features.isProvided("hyperref")); // set back for the rest lyxpreamble.clear(); diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp index afbd5e5..2a82f44 100644 --- a/src/PDFOptions.cpp +++ b/src/PDFOptions.cpp @@ -89,8 +89,8 @@ void PDFOptions::writeFile(ostream & os) const } -void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, - bool hyperref_already_provided) const +void PDFOptions::writeLaTeX(OutputParams & runparams, BufferParams & bufferparams, + otexstream & os, bool hyperref_already_provided) const { // FIXME Unicode string opt; @@ -176,7 +176,7 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, // hyperref expects utf8! if (need_unicode && enc && enc->iconvName() != "UTF-8" - &&!runparams.isFullUnicode()) { // FIXME: check must be done for useNonTeXFonts! + && !bufferparams.useNonTeXFonts) { os << "\\inputencoding{utf8}\n" << setEncoding("UTF-8"); } @@ -196,7 +196,7 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, os << from_utf8(opt); if (need_unicode && enc && enc->iconvName() != "UTF-8" - &&!runparams.isFullUnicode()) { // FIXME: check for useNonTeXFonts! + && !bufferparams.useNonTeXFonts) { os << setEncoding(enc->iconvName()) << "\\inputencoding{" << from_ascii(enc->latexName()) << "}\n"; } diff --git a/src/PDFOptions.h b/src/PDFOptions.h index d74caf4..f4d5250 100644 --- a/src/PDFOptions.h +++ b/src/PDFOptions.h @@ -13,6 +13,7 @@ #define PDFOPTIONS_H #include "OutputParams.h" +#include "BufferParams.h" #include "support/strfwd.h" @@ -36,7 +37,7 @@ public: /// output to lyx header void writeFile(std::ostream &) const; /// output to tex header - void writeLaTeX(OutputParams &, otexstream &, + void writeLaTeX(OutputParams &, BufferParams &, otexstream &, bool hyperref_already_provided) const; /// read tokens from lyx header std::string readToken(Lexer &lex, std::string const & token);