Check for fontspec an configure the GUI accordingly.

If fontspec is not found, the "Use non-TeX fonts" checkbox is disabled, and the tooltip hints at installing the package.
Also add fontspec to LaTeXConfig.lyx, documenting that v2 of the package is needed for LuaTeX support.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37567 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2011-02-09 08:23:11 +00:00
parent c376379908
commit 5a2121f77e
3 changed files with 45 additions and 4 deletions

View File

@ -261,6 +261,7 @@
\TestPackage{endnotes} \TestPackage{endnotes}
\TestPackage{enumitem} \TestPackage{enumitem}
\TestPackage{esint} \TestPackage{esint}
\TestPackage{fontspec}
\TestPackage{hhline} \TestPackage{hhline}
\TestPackage{ifsym} \TestPackage{ifsym}
\TestPackage{ifthen} \TestPackage{ifthen}

View File

@ -1,11 +1,12 @@
#LyX 2.0.0svn created this file. For more info see http://www.lyx.org/ #LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
\lyxformat 410 \lyxformat 412
\begin_document \begin_document
\begin_header \begin_header
\textclass article \textclass article
\use_default_options false \use_default_options false
\maintain_unincluded_children false \maintain_unincluded_children false
\language english \language english
\language_package default
\inputencoding default \inputencoding default
\fontencoding global \fontencoding global
\font_roman default \font_roman default
@ -448,6 +449,37 @@ Diagram
). ).
\end_layout \end_layout
\begin_layout Subsection
fontspec
\end_layout
\begin_layout Description
Found:
\begin_inset Info
type "package"
arg "fontspec"
\end_inset
\end_layout
\begin_layout Description
CTAN:
\family typewriter
macros/latex/contrib/fontspec
\end_layout
\begin_layout Description
Notes: The package
\family sans
fontspec
\family default
provides access to your Operating System's OpenType, TrueType and PostScript
fonts.
The package needs either the XeTeX or the LuaTeX engine for this.
Note that LuaTeX is only supported as of fontspec version 2.0 (2010/07/11).
\end_layout
\begin_layout Subsection \begin_layout Subsection
fourier-GUTenberg fourier-GUTenberg
\end_layout \end_layout

View File

@ -798,6 +798,11 @@ GuiDocument::GuiDocument(GuiView & lv)
fontModule->fontsDefaultCO->addItem( fontModule->fontsDefaultCO->addItem(
qt_(GuiDocument::fontfamilies_gui[n])); qt_(GuiDocument::fontfamilies_gui[n]));
if (!LaTeXFeatures::isAvailable("fontspec"))
fontModule->osFontsCB->setToolTip(
qt_("Use OpenType- and TrueType fonts directly (requires XeTeX or LuaTeX)\n"
"You need to install the package \"fontspec\" to use this feature"));
// page layout // page layout
pageLayoutModule = new UiWidget<Ui::PageLayoutUi>; pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
@ -2874,9 +2879,12 @@ void GuiDocument::paramsToDialog()
if (index == -1) if (index == -1)
index = 0; index = 0;
outputModule->defaultFormatCO->setCurrentIndex(index); outputModule->defaultFormatCO->setCurrentIndex(index);
fontModule->osFontsCB->setEnabled(bp_.baseClass()->outputType() == lyx::LATEX); bool const os_fonts_available =
bp_.baseClass()->outputType() == lyx::LATEX
&& LaTeXFeatures::isAvailable("fontspec");
fontModule->osFontsCB->setEnabled(os_fonts_available);
fontModule->osFontsCB->setChecked( fontModule->osFontsCB->setChecked(
bp_.baseClass()->outputType() == lyx::LATEX && bp_.useNonTeXFonts); os_fonts_available && bp_.useNonTeXFonts);
outputModule->outputsyncCB->setChecked(bp_.output_sync); outputModule->outputsyncCB->setChecked(bp_.output_sync);
outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro)); outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro));
@ -2889,7 +2897,7 @@ void GuiDocument::paramsToDialog()
updateFontsize(documentClass().opt_fontsize(), updateFontsize(documentClass().opt_fontsize(),
bp_.fontsize); bp_.fontsize);
if (bp_.useNonTeXFonts) { if (bp_.useNonTeXFonts && os_fonts_available) {
fontModule->fontencLA->setEnabled(false); fontModule->fontencLA->setEnabled(false);
fontModule->fontencCO->setEnabled(false); fontModule->fontencCO->setEnabled(false);
fontModule->fontencLE->setEnabled(false); fontModule->fontencLE->setEnabled(false);