From 737e9b2c20b9aa14c91330c83ace13c632c6c816 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 6 Apr 2009 06:58:30 +0000 Subject: [PATCH] start XeTeX support. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29119 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 3 + lib/configure.py | 7 +- lib/lyx2lyx/lyx_2_0.py | 6 +- src/Buffer.cpp | 13 +- src/BufferParams.cpp | 83 ++++++++++- src/BufferParams.h | 7 +- src/Converter.cpp | 2 + src/OutputParams.h | 1 + src/frontends/qt4/GuiDocument.cpp | 196 +++++++++++++++++++------- src/frontends/qt4/GuiDocument.h | 5 +- src/frontends/qt4/GuiSendto.cpp | 9 +- src/frontends/qt4/ui/FontUi.ui | 219 ++++++++++++++++-------------- src/output_latex.cpp | 4 +- 13 files changed, 386 insertions(+), 169 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 88acd68c14..19c1eb7c2c 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,9 @@ LyX file-format changes ----------------------- +2009-04-05 Jürgen Spitzmüller + * Format incremented to 349: initial support for XeTeX. + 2009-01-30 Uwe Stöhr * Format incremented to 348: support for \*phantom. diff --git a/lib/configure.py b/lib/configure.py index c4b5eacb76..aff725605a 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -291,6 +291,7 @@ def checkFormatEntries(dtl_tools): \Format lilypond ly "LilyPond music" "" "" "%%" "vector" \Format latex tex "LaTeX (plain)" L "" "%%" "document" \Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document" +\Format xetex tex "LaTeX (XeTeX)" "" "" "%%" "document" \Format text txt "Plain text" a "" "%%" "document" \Format text2 txt "Plain text (pstotext)" "" "" "%%" "document" \Format text3 txt "Plain text (ps2ascii)" "" "" "%%" "document" @@ -314,7 +315,8 @@ def checkFormatEntries(dtl_tools): 'gv', 'ghostview'], rc_entry = [r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" "" "document,vector" \Format pdf2 pdf "PDF (pdflatex)" F "%%" "" "document,vector" -\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document,vector"''']) +\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document,vector" +\Format pdf4 pdf "PDF (XeTeX)" X "%%" "" "document,vector"''']) # checkViewer('a DVI previewer', ['xdvi', 'kdvi'], rc_entry = [r'\Format dvi dvi DVI D "%%" "" "document,vector"']) @@ -361,6 +363,9 @@ def checkConverterEntries(): ''' Check all converters (\converter entries) ''' checkProg('the pdflatex program', ['pdflatex $$i'], rc_entry = [ r'\converter pdflatex pdf2 "%%" "latex"' ]) + + checkProg('XeTeX', ['xelatex $$i'], + rc_entry = [ r'\converter xetex pdf4 "%%" "latex"' ]) ''' If we're running LyX in-place then tex2lyx will be found in ../src/tex2lyx. Add this directory to the PATH temporarily and diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index bcfbaae24d..70c08cb68b 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -186,10 +186,12 @@ def revert_vphantom(document): supported_versions = ["2.0.0","2.0"] convert = [[346, []], [347, []], - [348, []] + [348, []], + [349, []] ] -revert = [[347, [revert_phantom, revert_hphantom, revert_vphantom]], +revert = [[348, []], + [347, [revert_phantom, revert_hphantom, revert_vphantom]], [346, [revert_tabularvalign]], [345, [revert_swiss]] ] diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 90ce575534..a4d78be6b5 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -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 DepClean; typedef map > 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(¶ms().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"; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 5183ac2499..649f3b4c4b 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -93,6 +93,7 @@ static char const * const tex_graphics[] = { }; + namespace lyx { // Local translators @@ -270,7 +271,6 @@ SpaceTranslator const & spacetranslator() return translator; } - } // anon namespace @@ -344,6 +344,7 @@ BufferParams::BufferParams() fontsSans = "default"; fontsTypewriter = "default"; fontsDefaultFamily = "default"; + useXetex = false; fontsSC = false; fontsOSF = false; fontsSansScale = 100; @@ -509,13 +510,18 @@ string BufferParams::readToken(Lexer & lex, string const & token, } else if (token == "\\graphics") { readGraphicsDriver(lex); } else if (token == "\\font_roman") { - lex >> fontsRoman; + lex.eatLine(); + fontsRoman = lex.getString(); } else if (token == "\\font_sans") { - lex >> fontsSans; + lex.eatLine(); + fontsSans = lex.getString(); } else if (token == "\\font_typewriter") { - lex >> fontsTypewriter; + lex.eatLine(); + fontsTypewriter = lex.getString(); } else if (token == "\\font_default_family") { lex >> fontsDefaultFamily; + } else if (token == "\\use_xetex") { + lex >> useXetex; } else if (token == "\\font_sc") { lex >> fontsSC; } else if (token == "\\font_osf") { @@ -742,6 +748,7 @@ void BufferParams::writeFile(ostream & os) const << "\n\\font_sans " << fontsSans << "\n\\font_typewriter " << fontsTypewriter << "\n\\font_default_family " << fontsDefaultFamily + << "\n\\use_xetex " << convert(useXetex) << "\n\\font_sc " << convert(fontsSC) << "\n\\font_osf " << convert(fontsOSF) << "\n\\font_sf_scale " << fontsSansScale @@ -876,6 +883,7 @@ void BufferParams::validate(LaTeXFeatures & features) const } break; case OutputParams::PDFLATEX: + case OutputParams::XETEX: if (xcolorulem) { features.require("ct-xcolor-ulem"); features.require("ulem"); @@ -937,6 +945,9 @@ void BufferParams::validate(LaTeXFeatures & features) const features.require("color"); } + if (useXetex) + features.require("xetex"); + if (language->lang() == "vietnamese") features.require("vietnamese"); else if (language->lang() == "japanese") @@ -1075,11 +1086,20 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, texrow.newline(); // end of \documentclass defs + if (useXetex) { + os << "\\usepackage{fontspec}\n"; + texrow.newline(); + os << "\\usepackage{xunicode}\n"; + texrow.newline(); + os << "\\usepackage{xltxtra}\n"; + texrow.newline(); + } + // font selection must be done before loading fontenc.sty string const fonts = loadFonts(fontsRoman, fontsSans, fontsTypewriter, fontsSC, fontsOSF, - fontsSansScale, fontsTypewriterScale); + fontsSansScale, fontsTypewriterScale, useXetex); if (!fonts.empty()) { os << from_ascii(fonts); texrow.newline(); @@ -1092,7 +1112,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // this one is not per buffer // for arabic_arabi and farsi we also need to load the LAE and // LFE encoding - if (lyxrc.fontenc != "default" && language->lang() != "japanese") { + // XeteX works without fontenc + if (lyxrc.fontenc != "default" && language->lang() != "japanese" + && !useXetex) { if (language->lang() == "arabic_arabi" || language->lang() == "farsi") { os << "\\usepackage[" << from_ascii(lyxrc.fontenc) @@ -1863,6 +1885,8 @@ docstring BufferParams::getGraphicsDriver(string const & package) const void BufferParams::writeEncodingPreamble(odocstream & os, LaTeXFeatures & features, TexRow & texrow) const { + if (useXetex) + return; if (inputenc == "auto") { string const doc_encoding = language->encoding()->latexName(); @@ -1941,10 +1965,22 @@ void BufferParams::writeEncodingPreamble(odocstream & os, } +string const BufferParams::parseFontName(string const & name) const +{ + string mangled = name; + size_t const idx = mangled.find('['); + if (idx == string::npos || idx == 0) + return mangled; + else + return mangled.substr(0, idx - 1); +} + + string const BufferParams::loadFonts(string const & rm, string const & sf, string const & tt, bool const & sc, bool const & osf, - int const & sfscale, int const & ttscale) const + int const & sfscale, int const & ttscale, + bool const & xetex) const { /* The LaTeX font world is in a flux. In the PSNFSS font interface, several packages have been replaced by others, that might not @@ -1964,6 +2000,37 @@ string const BufferParams::loadFonts(string const & rm, ostringstream os; + if (xetex) { + if (rm != "default") + os << "\\setmainfont[Mapping=tex-text]{" + << parseFontName(rm) << "}\n"; + if (sf != "default") { + string const sans = parseFontName(sf); + if (sfscale != 100) + os << "\\setsansfont[Scale=" + << float(sfscale) / 100 + << ",Mapping=tex-text]{" + << sans << "}\n"; + else + os << "\\setsansfont[Mapping=tex-text]{" + << sans << "}\n"; + } + if (tt != "default") { + string const mono = parseFontName(tt); + if (ttscale != 100) + os << "\\setmonofont[Scale=" + << float(sfscale) / 100 + << "]{" + << mono << "}\n"; + else + os << "\\setmonofont[Mapping=tex-text]{" + << mono << "}\n"; + } + if (osf) + os << "\\defaultfontfeatures{Numbers=OldStyle}\n"; + return os.str(); + } + // ROMAN FONTS // Computer Modern (must be explicitely selectable -- there might be classes // that define a different default font! @@ -2080,6 +2147,8 @@ string const BufferParams::loadFonts(string const & rm, Encoding const & BufferParams::encoding() const { + if (useXetex) + return *(encodings.fromLaTeXName("utf8-plain")); if (inputenc == "auto" || inputenc == "default") return *language->encoding(); Encoding const * const enc = encodings.fromLaTeXName(inputenc); diff --git a/src/BufferParams.h b/src/BufferParams.h index 47c0f2f2cd..63558190d8 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -189,6 +189,8 @@ public: std::string fontsTypewriter; /// the default family (rm, sf, tt) std::string fontsDefaultFamily; + /// use the XeTeX processor + bool useXetex; /// use expert Small Caps bool fontsSC; /// use Old Style Figures @@ -313,11 +315,14 @@ public: /// handle inputenc etc. void writeEncodingPreamble(odocstream & os, LaTeXFeatures & features, TexRow & texrow) const; + /// + std::string const parseFontName(std::string const & name) const; /// set up the document fonts std::string const loadFonts(std::string const & rm, std::string const & sf, std::string const & tt, bool const & sc, bool const & osf, - int const & sfscale, int const & ttscale) const; + int const & sfscale, int const & ttscale, + bool const & xetex) const; /// get the appropriate cite engine (natbib handling) CiteEngine citeEngine() const; diff --git a/src/Converter.cpp b/src/Converter.cpp index fd4e7856f7..cd174826f0 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -254,6 +254,8 @@ OutputParams::FLAVOR Converters::getFlavor(Graph::EdgePath const & path) cit != path.end(); ++cit) { Converter const & conv = converterlist_[*cit]; if (conv.latex) + if (contains(conv.from, "xetex")) + return OutputParams::XETEX; if (contains(conv.to, "pdf")) return OutputParams::PDFLATEX; if (conv.xml) diff --git a/src/OutputParams.h b/src/OutputParams.h index 00a1e11030..cc0f01548e 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -32,6 +32,7 @@ public: enum FLAVOR { LATEX, PDFLATEX, + XETEX, XML }; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index a61d9fa6e3..378ff9df1f 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -54,6 +54,7 @@ #include #include +#include #include #include @@ -610,25 +611,12 @@ GuiDocument::GuiDocument(GuiView & lv) this, SLOT(change_adaptor())); connect(fontModule->fontOsfCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); + connect(fontModule->xetexCB, SIGNAL(clicked()), + this, SLOT(change_adaptor())); + connect(fontModule->xetexCB, SIGNAL(toggled(bool)), + this, SLOT(xetexChanged(bool))); - for (int n = 0; tex_fonts_roman[n][0]; ++n) { - QString font = qt_(tex_fonts_roman_gui[n]); - if (!isFontAvailable(tex_fonts_roman[n])) - font += qt_(" (not installed)"); - fontModule->fontsRomanCO->addItem(font); - } - for (int n = 0; tex_fonts_sans[n][0]; ++n) { - QString font = qt_(tex_fonts_sans_gui[n]); - if (!isFontAvailable(tex_fonts_sans[n])) - font += qt_(" (not installed)"); - fontModule->fontsSansCO->addItem(font); - } - for (int n = 0; tex_fonts_monospaced[n][0]; ++n) { - QString font = qt_(tex_fonts_monospaced_gui[n]); - if (!isFontAvailable(tex_fonts_monospaced[n])) - font += qt_(" (not installed)"); - fontModule->fontsTypewriterCO->addItem(font); - } + updateFontlist(); fontModule->fontsizeCO->addItem(qt_("Default")); fontModule->fontsizeCO->addItem(qt_("10")); @@ -1090,11 +1078,13 @@ void GuiDocument::enableSkip(bool skip) setSkip(textLayoutModule->skipCO->currentIndex()); } + void GuiDocument::portraitChanged() { setMargins(pageLayoutModule->papersizeCO->currentIndex()); } + void GuiDocument::setMargins(bool custom) { bool const extern_geometry = @@ -1168,6 +1158,16 @@ void GuiDocument::setCustomMargins(bool custom) } +void GuiDocument::xetexChanged(bool xetex) +{ + updateFontlist(); + langModule->encodingCO->setEnabled(!xetex && + !langModule->defaultencodingRB->isChecked()); + langModule->defaultencodingRB->setEnabled(!xetex); + langModule->otherencodingRB->setEnabled(!xetex); +} + + void GuiDocument::updateFontsize(string const & items, string const & sel) { fontModule->fontsizeCO->clear(); @@ -1186,8 +1186,55 @@ void GuiDocument::updateFontsize(string const & items, string const & sel) } +void GuiDocument::updateFontlist() +{ + fontModule->fontsRomanCO->clear(); + fontModule->fontsSansCO->clear(); + fontModule->fontsTypewriterCO->clear(); + + // With XeTeX, we have access to all system fonts, but not the LaTeX fonts + if (fontModule->xetexCB->isChecked()) { + fontModule->fontsRomanCO->addItem(qt_("Default")); + fontModule->fontsSansCO->addItem(qt_("Default")); + fontModule->fontsTypewriterCO->addItem(qt_("Default")); + + QFontDatabase fontdb; + QStringList families(fontdb.families()); + for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) { + fontModule->fontsRomanCO->addItem(*it); + fontModule->fontsSansCO->addItem(*it); + fontModule->fontsTypewriterCO->addItem(*it); + } + return; + } + + for (int n = 0; tex_fonts_roman[n][0]; ++n) { + QString font = qt_(tex_fonts_roman_gui[n]); + if (!isFontAvailable(tex_fonts_roman[n])) + font += qt_(" (not installed)"); + fontModule->fontsRomanCO->addItem(font); + } + for (int n = 0; tex_fonts_sans[n][0]; ++n) { + QString font = qt_(tex_fonts_sans_gui[n]); + if (!isFontAvailable(tex_fonts_sans[n])) + font += qt_(" (not installed)"); + fontModule->fontsSansCO->addItem(font); + } + for (int n = 0; tex_fonts_monospaced[n][0]; ++n) { + QString font = qt_(tex_fonts_monospaced_gui[n]); + if (!isFontAvailable(tex_fonts_monospaced[n])) + font += qt_(" (not installed)"); + fontModule->fontsTypewriterCO->addItem(font); + } +} + + void GuiDocument::romanChanged(int item) { + if (fontModule->xetexCB->isChecked()) { + fontModule->fontScCB->setEnabled(false); + return; + } string const font = tex_fonts_roman[item]; fontModule->fontScCB->setEnabled(providesSC(font)); fontModule->fontOsfCB->setEnabled(providesOSF(font)); @@ -1196,6 +1243,10 @@ void GuiDocument::romanChanged(int item) void GuiDocument::sansChanged(int item) { + if (fontModule->xetexCB->isChecked()) { + fontModule->fontScCB->setEnabled(false); + return; + } string const font = tex_fonts_sans[item]; bool scaleable = providesScale(font); fontModule->scaleSansSB->setEnabled(scaleable); @@ -1205,6 +1256,10 @@ void GuiDocument::sansChanged(int item) void GuiDocument::ttChanged(int item) { + if (fontModule->xetexCB->isChecked()) { + fontModule->fontScCB->setEnabled(false); + return; + } string const font = tex_fonts_monospaced[item]; bool scaleable = providesScale(font); fontModule->scaleTypewriterSB->setEnabled(scaleable); @@ -1741,14 +1796,37 @@ void GuiDocument::applyView() bp_.float_placement = floatModule->get(); // fonts - bp_.fontsRoman = - tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()]; - - bp_.fontsSans = - tex_fonts_sans[fontModule->fontsSansCO->currentIndex()]; + bool const xetex = fontModule->xetexCB->isChecked(); + bp_.useXetex = xetex; - bp_.fontsTypewriter = - tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()]; + if (xetex) { + if (fontModule->fontsRomanCO->currentIndex() == 0) + bp_.fontsRoman = "default"; + else + bp_.fontsRoman = + fromqstr(fontModule->fontsRomanCO->currentText()); + + if (fontModule->fontsSansCO->currentIndex() == 0) + bp_.fontsSans = "default"; + else + bp_.fontsSans = + fromqstr(fontModule->fontsSansCO->currentText()); + + if (fontModule->fontsTypewriterCO->currentIndex() == 0) + bp_.fontsTypewriter = "default"; + else + bp_.fontsTypewriter = + fromqstr(fontModule->fontsTypewriterCO->currentText()); + } else { + bp_.fontsRoman = + tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()]; + + bp_.fontsSans = + tex_fonts_sans[fontModule->fontsSansCO->currentIndex()]; + + bp_.fontsTypewriter = + tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()]; + } bp_.fontsCJK = fromqstr(fontModule->cjkFontLE->text()); @@ -2046,22 +2124,47 @@ void GuiDocument::paramsToDialog() updateFontsize(documentClass().opt_fontsize(), bp_.fontsize); - int n = findToken(tex_fonts_roman, bp_.fontsRoman); - if (n >= 0) { - fontModule->fontsRomanCO->setCurrentIndex(n); - romanChanged(n); - } + fontModule->xetexCB->setChecked(bp_.useXetex); - n = findToken(tex_fonts_sans, bp_.fontsSans); - if (n >= 0) { - fontModule->fontsSansCO->setCurrentIndex(n); - sansChanged(n); - } - - n = findToken(tex_fonts_monospaced, bp_.fontsTypewriter); - if (n >= 0) { - fontModule->fontsTypewriterCO->setCurrentIndex(n); - ttChanged(n); + if (bp_.useXetex) { + for (int i = 0; i < fontModule->fontsRomanCO->count(); ++i) { + if (fontModule->fontsRomanCO->itemText(i) == toqstr(bp_.fontsRoman)) { + fontModule->fontsRomanCO->setCurrentIndex(i); + return; + } + } + + for (int i = 0; i < fontModule->fontsSansCO->count(); ++i) { + if (fontModule->fontsSansCO->itemText(i) == toqstr(bp_.fontsSans)) { + fontModule->fontsSansCO->setCurrentIndex(i); + return; + } + } + for (int i = 0; i < fontModule->fontsTypewriterCO->count(); ++i) { + if (fontModule->fontsTypewriterCO->itemText(i) == + toqstr(bp_.fontsTypewriter)) { + fontModule->fontsTypewriterCO->setCurrentIndex(i); + return; + } + } + } else { + int n = findToken(tex_fonts_roman, bp_.fontsRoman); + if (n >= 0) { + fontModule->fontsRomanCO->setCurrentIndex(n); + romanChanged(n); + } + + n = findToken(tex_fonts_sans, bp_.fontsSans); + if (n >= 0) { + fontModule->fontsSansCO->setCurrentIndex(n); + sansChanged(n); + } + + n = findToken(tex_fonts_monospaced, bp_.fontsTypewriter); + if (n >= 0) { + fontModule->fontsTypewriterCO->setCurrentIndex(n); + ttChanged(n); + } } if (!bp_.fontsCJK.empty()) @@ -2074,9 +2177,10 @@ void GuiDocument::paramsToDialog() fontModule->fontOsfCB->setChecked(bp_.fontsOSF); fontModule->scaleSansSB->setValue(bp_.fontsSansScale); fontModule->scaleTypewriterSB->setValue(bp_.fontsTypewriterScale); - n = findToken(GuiDocument::fontfamilies, bp_.fontsDefaultFamily); - if (n >= 0) - fontModule->fontsDefaultCO->setCurrentIndex(n); + + int nn = findToken(GuiDocument::fontfamilies, bp_.fontsDefaultFamily); + if (nn >= 0) + fontModule->fontsDefaultCO->setCurrentIndex(nn); // paper bool const extern_geometry = @@ -2153,9 +2257,9 @@ void GuiDocument::paramsToDialog() pdfSupportModule->pdfusetitleCB->setChecked(pdf.pdfusetitle); pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks); - n = findToken(backref_opts, pdf.backref); - if (n >= 0) - pdfSupportModule->backrefCO->setCurrentIndex(n); + nn = findToken(backref_opts, pdf.backref); + if (nn >= 0) + pdfSupportModule->backrefCO->setCurrentIndex(nn); pdfSupportModule->fullscreenCB->setChecked (pdf.pagemode == pdf.pagemode_fullscreen); diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index e9964a9971..04338820fc 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -69,6 +69,7 @@ public: void paramsToDialog(); void updateFontsize(std::string const &, std::string const &); + void updateFontlist(); void updatePagestyle(std::string const &, std::string const &); void showPreamble(); @@ -97,7 +98,7 @@ private Q_SLOTS: void classChanged(); void updateModuleInfo(); void modulesChanged(); - + void xetexChanged(bool); private: /// validate listings parameters and return an error message, if any QString validateListingsParameters(); @@ -185,7 +186,7 @@ private: std::list const & getModuleInfo(); /// Modules in use in current buffer std::list const getSelectedModules(); - /// + /// std::list const getProvidedModules(); /// std::list const diff --git a/src/frontends/qt4/GuiSendto.cpp b/src/frontends/qt4/GuiSendto.cpp index 392bcc88a3..3eff7f4cc3 100644 --- a/src/frontends/qt4/GuiSendto.cpp +++ b/src/frontends/qt4/GuiSendto.cpp @@ -15,6 +15,7 @@ #include "qt_helpers.h" #include "Buffer.h" +#include "BufferParams.h" #include "Converter.h" #include "Format.h" #include "FuncRequest.h" @@ -174,8 +175,12 @@ vector GuiSendTo::allFormats() const exports.push_back("text"); if (buffer().isLatex()) { - exports.push_back("latex"); - exports.push_back("pdflatex"); + if (buffer().params().useXetex) + exports.push_back("xetex"); + else { + exports.push_back("latex"); + exports.push_back("pdflatex"); + } } else if (buffer().isDocBook()) exports.push_back("docbook"); diff --git a/src/frontends/qt4/ui/FontUi.ui b/src/frontends/qt4/ui/FontUi.ui index 20d12b553e..574152d66c 100644 --- a/src/frontends/qt4/ui/FontUi.ui +++ b/src/frontends/qt4/ui/FontUi.ui @@ -5,94 +5,49 @@ 0 0 - 414 - 268 + 543 + 361 FontUi - - - 9 - - - 6 - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 391 - 16 - + + + + + Use the XeTeX processor, which allows access to all system fonts - - - - - C&JK: - - - cjkFontLE + Use &XeTeX - - - - Input the font to be used for Chinese, Japanese or Korean (CJK) script - - - - - + + Qt::Horizontal - - - 151 - 20 - - - - - - - - Use old style instead of lining figures - - - Use &Old Style Figures - - - - - Use a real small caps shape, if the font provides one - + + - Use true S&mall Caps + &Default Family: + + + fontsDefaultCO - + Select the default family for the document - + &Base Size: @@ -102,37 +57,57 @@ - + - - + + + + Qt::Horizontal + + + + 182 + 16 + + + + + + - &Default Family: + &Roman: - fontsDefaultCO + fontsRomanCO + + + + + + + Select the roman (serif) typeface - + Qt::Horizontal - + - 182 - 16 + 131 + 20 - + &Sans Serif: @@ -142,14 +117,14 @@ - + Select the Sans Serif (grotesque) typeface - + S&cale (%): @@ -159,37 +134,20 @@ - + Scale the Sans Serif font to match the base font's dimensions - - 200 - 10 - - - - - - &Roman: - - - fontsRomanCO - - - - - - - Select the roman (serif) typeface + + 200 - + &Typewriter: @@ -199,14 +157,14 @@ - + Select the typewriter (monospaced) typeface - + Sc&ale (%): @@ -216,32 +174,85 @@ - + Scale the Typewriter font to match the base font's dimensions + + 10 + 200 - - 10 + + + + + + C&JK: + + + cjkFontLE - + + + + Input the font to be used for Chinese, Japanese or Korean (CJK) script + + + + Qt::Horizontal - + - 131 + 151 20 + + + + Use a real small caps shape, if the font provides one + + + Use true S&mall Caps + + + + + + + Use old style instead of lining figures + + + Use &Old Style Figures + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 391 + 16 + + + + diff --git a/src/output_latex.cpp b/src/output_latex.cpp index c9538ca9a6..534bf48be4 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -697,9 +697,11 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, // If this is the last paragraph, and a local_font was set upon entering // the inset, and we're using "auto" or "default" encoding, the encoding // should be set back to that local_font's encoding. + // However, do not change the encoding when XeTeX is used. if (nextpit == paragraphs.end() && runparams_in.local_font != 0 && runparams_in.encoding != runparams_in.local_font->language()->encoding() - && (bparams.inputenc == "auto" || bparams.inputenc == "default")) { + && (bparams.inputenc == "auto" || bparams.inputenc == "default") + && (!bparams.useXetex)) { runparams_in.encoding = runparams_in.local_font->language()->encoding(); os << setEncoding(runparams_in.encoding->iconvName()); } -- 2.39.2