]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
start XeTeX support.
[lyx.git] / src / Buffer.cpp
index 04572db74b212fd0c7137f987da07554ea34e51b..a4d78be6b56f2a71f89945d98294c8dde0ab1dff 100644 (file)
@@ -121,7 +121,7 @@ namespace {
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 348;  // uwestoehr: add support for \*phantom
+int const LYX_FORMAT = 349;  // jspitzm: initial XeTeX support
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
@@ -1005,9 +1005,13 @@ bool Buffer::write(ostream & ofs) const
 
 bool Buffer::makeLaTeXFile(FileName const & fname,
                           string const & original_path,
-                          OutputParams const & runparams,
+                          OutputParams const & runparams_in,
                           bool output_preamble, bool output_body) const
 {
+       OutputParams runparams = runparams_in;
+       if (params().useXetex)
+               runparams.flavor = OutputParams::XETEX;
+
        string const encoding = runparams.encoding->iconvName();
        LYXERR(Debug::LATEX, "makeLaTeXFile encoding: " << encoding << "...");
 
@@ -2232,7 +2236,8 @@ void Buffer::getSourceCode(odocstream & os, pit_type par_begin,
 {
        OutputParams runparams(&params().encoding());
        runparams.nice = true;
-       runparams.flavor = OutputParams::LATEX;
+       runparams.flavor = params().useXetex ? 
+               OutputParams::XETEX : OutputParams::LATEX;
        runparams.linelen = lyxrc.plaintext_linelen;
        // No side effect of file copying and image conversion
        runparams.dryrun = true;
@@ -2467,6 +2472,8 @@ string Buffer::bufferFormat() const
                return "docbook";
        if (isLiterate())
                return "literate";
+       if (params().useXetex)
+               return "xetex";
        if (params().encoding().package() == Encoding::japanese)
                return "platex";
        return "latex";
@@ -3091,8 +3098,12 @@ bool Buffer::nextWord(DocIterator & from, DocIterator & to,
        bool inword = false;
        bool ignoreword = false;
        string lang_code;
+       // Go backward a bit if needed in order to return the word currently
+       // pointed by 'from'.
+       while (from && from.pos() && isLetter(from))
+               from.backwardPos();
+       // OK, we start from here.
        to = from;
-
        while (to.depth()) {
                if (isLetter(to)) {
                        if (!inword) {