start XeTeX support.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29119 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-04-06 06:58:30 +00:00
parent ed6f569fc8
commit 737e9b2c20
13 changed files with 427 additions and 210 deletions

View File

@ -1,6 +1,9 @@
LyX file-format changes
-----------------------
2009-04-05 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 349: initial support for XeTeX.
2009-01-30 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 348: support for \*phantom.

View File

@ -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"'])
@ -362,6 +364,9 @@ def checkConverterEntries():
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
search for tex2lyx.

View File

@ -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]]
]

View 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";

View File

@ -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<string>(useXetex)
<< "\n\\font_sc " << convert<string>(fontsSC)
<< "\n\\font_osf " << convert<string>(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);

View File

@ -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;

View File

@ -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)

View File

@ -32,6 +32,7 @@ public:
enum FLAVOR {
LATEX,
PDFLATEX,
XETEX,
XML
};

View File

@ -54,6 +54,7 @@
#include <QAbstractItemModel>
#include <QCloseEvent>
#include <QFontDatabase>
#include <QScrollBar>
#include <QTextCursor>
@ -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()];
bool const xetex = fontModule->xetexCB->isChecked();
bp_.useXetex = xetex;
bp_.fontsSans =
tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
if (xetex) {
if (fontModule->fontsRomanCO->currentIndex() == 0)
bp_.fontsRoman = "default";
else
bp_.fontsRoman =
fromqstr(fontModule->fontsRomanCO->currentText());
bp_.fontsTypewriter =
tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
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);
}
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;
}
}
n = findToken(tex_fonts_monospaced, bp_.fontsTypewriter);
if (n >= 0) {
fontModule->fontsTypewriterCO->setCurrentIndex(n);
ttChanged(n);
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);

View File

@ -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<modInfoStruct> const & getModuleInfo();
/// Modules in use in current buffer
std::list<modInfoStruct> const getSelectedModules();
///
///
std::list<modInfoStruct> const getProvidedModules();
///
std::list<modInfoStruct> const

View File

@ -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<Format const *> 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");

View File

@ -5,111 +5,32 @@
<rect>
<x>0</x>
<y>0</y>
<width>414</width>
<height>268</height>
<width>543</width>
<height>361</height>
</rect>
</property>
<property name="windowTitle" >
<string>FontUi</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="8" column="0" colspan="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>391</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="cjkFontLA" >
<property name="text" >
<string>C&amp;JK:</string>
</property>
<property name="buddy" >
<cstring>cjkFontLE</cstring>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QLineEdit" name="cjkFontLE" >
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="xetexCB" >
<property name="toolTip" >
<string>Input the font to be used for Chinese, Japanese or Korean (CJK) script</string>
<string>Use the XeTeX processor, which allows access to all system fonts</string>
</property>
<property name="text" >
<string>Use &amp;XeTeX</string>
</property>
</widget>
</item>
<item row="5" column="2" colspan="2" >
<spacer>
<item row="1" column="0" colspan="4" >
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>151</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1" >
<widget class="QCheckBox" name="fontOsfCB" >
<property name="toolTip" >
<string>Use old style instead of lining figures</string>
</property>
<property name="text" >
<string>Use &amp;Old Style Figures</string>
</property>
</widget>
</item>
<item row="6" column="1" >
<widget class="QCheckBox" name="fontScCB" >
<property name="toolTip" >
<string>Use a real small caps shape, if the font provides one</string>
</property>
<property name="text" >
<string>Use true S&amp;mall Caps</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="fontsDefaultCO" >
<property name="toolTip" >
<string>Select the default family for the document</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="TextLabel2_2" >
<property name="text" >
<string>&amp;Base Size:</string>
</property>
<property name="buddy" >
<cstring>fontsizeCO</cstring>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QComboBox" name="fontsizeCO" >
<property name="toolTip" >
<string/>
</property>
</widget>
</item>
<item row="0" column="0" >
<item row="2" column="0" >
<widget class="QLabel" name="fontsDefaultLA" >
<property name="text" >
<string>&amp;Default Family:</string>
@ -119,12 +40,36 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<item row="2" column="1" >
<widget class="QComboBox" name="fontsDefaultCO" >
<property name="toolTip" >
<string>Select the default family for the document</string>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QLabel" name="TextLabel2_2" >
<property name="text" >
<string>&amp;Base Size:</string>
</property>
<property name="buddy" >
<cstring>fontsizeCO</cstring>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="QComboBox" name="fontsizeCO" >
<property name="toolTip" >
<string/>
</property>
</widget>
</item>
<item row="3" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>182</width>
<height>16</height>
@ -132,47 +77,7 @@
</property>
</spacer>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="fontsSansLA" >
<property name="text" >
<string>&amp;Sans Serif:</string>
</property>
<property name="buddy" >
<cstring>fontsSansCO</cstring>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QComboBox" name="fontsSansCO" >
<property name="toolTip" >
<string>Select the Sans Serif (grotesque) typeface</string>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QLabel" name="scaleSansLA" >
<property name="text" >
<string>S&amp;cale (%):</string>
</property>
<property name="buddy" >
<cstring>scaleSansSB</cstring>
</property>
</widget>
</item>
<item row="3" column="3" >
<widget class="QSpinBox" name="scaleSansSB" >
<property name="toolTip" >
<string>Scale the Sans Serif font to match the base font's dimensions</string>
</property>
<property name="maximum" >
<number>200</number>
</property>
<property name="minimum" >
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="0" >
<item row="4" column="0" >
<widget class="QLabel" name="fontsRomanLA" >
<property name="text" >
<string>&amp;Roman:</string>
@ -182,14 +87,67 @@
</property>
</widget>
</item>
<item row="2" column="1" >
<item row="4" column="1" >
<widget class="QComboBox" name="fontsRomanCO" >
<property name="toolTip" >
<string>Select the roman (serif) typeface</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<item row="4" column="2" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="fontsSansLA" >
<property name="text" >
<string>&amp;Sans Serif:</string>
</property>
<property name="buddy" >
<cstring>fontsSansCO</cstring>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QComboBox" name="fontsSansCO" >
<property name="toolTip" >
<string>Select the Sans Serif (grotesque) typeface</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QLabel" name="scaleSansLA" >
<property name="text" >
<string>S&amp;cale (%):</string>
</property>
<property name="buddy" >
<cstring>scaleSansSB</cstring>
</property>
</widget>
</item>
<item row="5" column="3" >
<widget class="QSpinBox" name="scaleSansSB" >
<property name="toolTip" >
<string>Scale the Sans Serif font to match the base font's dimensions</string>
</property>
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>200</number>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="fontsTypewriterLA" >
<property name="text" >
<string>&amp;Typewriter:</string>
@ -199,14 +157,14 @@
</property>
</widget>
</item>
<item row="4" column="1" >
<item row="6" column="1" >
<widget class="QComboBox" name="fontsTypewriterCO" >
<property name="toolTip" >
<string>Select the typewriter (monospaced) typeface</string>
</property>
</widget>
</item>
<item row="4" column="2" >
<item row="6" column="2" >
<widget class="QLabel" name="scaleTypewriterLA" >
<property name="text" >
<string>Sc&amp;ale (%):</string>
@ -216,32 +174,85 @@
</property>
</widget>
</item>
<item row="4" column="3" >
<item row="6" column="3" >
<widget class="QSpinBox" name="scaleTypewriterSB" >
<property name="toolTip" >
<string>Scale the Typewriter font to match the base font's dimensions</string>
</property>
<property name="maximum" >
<number>200</number>
</property>
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>200</number>
</property>
</widget>
</item>
<item row="2" column="2" colspan="2" >
<item row="7" column="0" >
<widget class="QLabel" name="cjkFontLA" >
<property name="text" >
<string>C&amp;JK:</string>
</property>
<property name="buddy" >
<cstring>cjkFontLE</cstring>
</property>
</widget>
</item>
<item row="7" column="1" >
<widget class="QLineEdit" name="cjkFontLE" >
<property name="toolTip" >
<string>Input the font to be used for Chinese, Japanese or Korean (CJK) script</string>
</property>
</widget>
</item>
<item row="7" column="2" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>131</width>
<width>151</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1" >
<widget class="QCheckBox" name="fontScCB" >
<property name="toolTip" >
<string>Use a real small caps shape, if the font provides one</string>
</property>
<property name="text" >
<string>Use true S&amp;mall Caps</string>
</property>
</widget>
</item>
<item row="9" column="1" >
<widget class="QCheckBox" name="fontOsfCB" >
<property name="toolTip" >
<string>Use old style instead of lining figures</string>
</property>
<property name="text" >
<string>Use &amp;Old Style Figures</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>391</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />

View File

@ -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());
}