]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Disable setting vertical lines when using a formal table
[lyx.git] / src / Buffer.cpp
index 6eea29a112ee19ba9b755f3edb43c439c2519b13..e6096af747d328d284e3c8d13eb62744cb13c989 100644 (file)
@@ -1586,10 +1586,10 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
 {
        OutputParams runparams = runparams_in;
 
-       // This is necessary for LuaTeX/XeTeX with tex fonts.
-       // See FIXME in BufferParams::encoding()
-       if (runparams.isFullUnicode())
-               runparams.encoding = encodings.fromLyXName("utf8-plain");
+       // XeTeX with TeX fonts is only safe with ASCII encoding,
+       // See #9740 and FIXME in BufferParams::encoding()
+       if (!params().useNonTeXFonts && (runparams.flavor == OutputParams::XETEX))
+               runparams.encoding = encodings.fromLyXName("ascii");
 
        string const encoding = runparams.encoding->iconvName();
        LYXERR(Debug::LATEX, "makeLaTeXFile encoding: " << encoding << ", fname=" << fname.realPath());
@@ -1673,10 +1673,10 @@ void Buffer::writeLaTeXSource(otexstream & os,
 
        OutputParams runparams = runparams_in;
 
-       // This is necessary for LuaTeX/XeTeX with tex fonts.
-       // See FIXME in BufferParams::encoding()
-       if (runparams.isFullUnicode())
-               runparams.encoding = encodings.fromLyXName("utf8-plain");
+       // XeTeX with TeX fonts is only safe with ASCII encoding,
+       // See #9740 and FIXME in BufferParams::encoding()
+       if (!params().useNonTeXFonts && (runparams.flavor == OutputParams::XETEX))
+               runparams.encoding = encodings.fromLyXName("ascii");
 
        // If we are compiling a file standalone, even if this is the
        // child of some other buffer, let's cut the link here, so the
@@ -1842,14 +1842,7 @@ void Buffer::writeLaTeXSource(otexstream & os,
        }
        runparams_in.encoding = runparams.encoding;
 
-       // Just to be sure. (Asger)
-       os.texrow().newline();
-
-       //for (int i = 0; i<d->texrow.rows(); i++) {
-       // int id,pos;
-       // if (d->texrow.getIdFromRow(i+1,id,pos) && id>0)
-       //      lyxerr << i+1 << ":" << id << ":" << getParFromID(id).paragraph().asString()<<"\n";
-       //}
+       os.texrow().finalize();
 
        LYXERR(Debug::INFO, "Finished making LaTeX file.");
        LYXERR(Debug::INFO, "Row count was " << os.texrow().rows() - 1 << '.');
@@ -1886,7 +1879,7 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
        LaTeXFeatures features(*this, params(), runparams);
        validate(features);
 
-       d->texrow.reset();
+       d->texrow.reset(false);
 
        DocumentClass const & tclass = params().documentClass();
        string const & top_element = tclass.latexname();
@@ -2447,7 +2440,7 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 
        case LFUN_BUFFER_VIEW_CACHE:
                (d->preview_file_).refresh();
-               enable = (d->preview_file_).exists();
+               enable = (d->preview_file_).exists() && !(d->preview_file_).isFileEmpty();
                break;
 
        default:
@@ -3570,7 +3563,6 @@ auto_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format,
                        params().validate(features);
                        runparams.use_polyglossia = features.usePolyglossia();
                        texrow.reset(new TexRow());
-                       texrow->reset();
                        texrow->newline();
                        texrow->newline();
                        // latex or literate
@@ -3578,6 +3570,7 @@ auto_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format,
 
                        // the real stuff
                        latexParagraphs(*this, text(), ots, runparams);
+                       texrow->finalize();
 
                        // Restore the parenthood
                        if (!master)
@@ -3613,13 +3606,13 @@ auto_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format,
                } else {
                        // latex or literate
                        texrow.reset(new TexRow());
-                       texrow->reset();
                        texrow->newline();
                        texrow->newline();
                        otexstream ots(os, *texrow);
                        if (master)
                                runparams.is_child = true;
                        writeLaTeXSource(ots, string(), runparams, output);
+                       texrow->finalize();
                }
        }
        return texrow;