From 5a2121f77eddd8c0762bae6849d2cc0d7a96c09e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 9 Feb 2011 08:23:11 +0000 Subject: [PATCH] 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 --- lib/chkconfig.ltx | 1 + lib/doc/LaTeXConfig.lyx | 34 ++++++++++++++++++++++++++++++- src/frontends/qt4/GuiDocument.cpp | 14 ++++++++++--- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index c02902a566..95ea1fe2b1 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -261,6 +261,7 @@ \TestPackage{endnotes} \TestPackage{enumitem} \TestPackage{esint} +\TestPackage{fontspec} \TestPackage{hhline} \TestPackage{ifsym} \TestPackage{ifthen} diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index c4e64230ab..b875fa7720 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -1,11 +1,12 @@ #LyX 2.0.0svn created this file. For more info see http://www.lyx.org/ -\lyxformat 410 +\lyxformat 412 \begin_document \begin_header \textclass article \use_default_options false \maintain_unincluded_children false \language english +\language_package default \inputencoding default \fontencoding global \font_roman default @@ -448,6 +449,37 @@ Diagram ). \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 fourier-GUTenberg \end_layout diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 01389e9b38..a73a12f877 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -798,6 +798,11 @@ GuiDocument::GuiDocument(GuiView & lv) fontModule->fontsDefaultCO->addItem( 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 pageLayoutModule = new UiWidget; @@ -2874,9 +2879,12 @@ void GuiDocument::paramsToDialog() if (index == -1) index = 0; 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( - bp_.baseClass()->outputType() == lyx::LATEX && bp_.useNonTeXFonts); + os_fonts_available && bp_.useNonTeXFonts); outputModule->outputsyncCB->setChecked(bp_.output_sync); outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro)); @@ -2889,7 +2897,7 @@ void GuiDocument::paramsToDialog() updateFontsize(documentClass().opt_fontsize(), bp_.fontsize); - if (bp_.useNonTeXFonts) { + if (bp_.useNonTeXFonts && os_fonts_available) { fontModule->fontencLA->setEnabled(false); fontModule->fontencCO->setEnabled(false); fontModule->fontencLE->setEnabled(false); -- 2.39.2