The branch, master, has been updated. - Log -----------------------------------------------------------------
commit a063defd9f7c56e2ecb5ff11f0ad9bf62fa267ad Author: Juergen Spitzmueller <[email protected]> Date: Mon Feb 11 15:02:24 2013 +0100 If a LaTeX font has a monolithic option for all expert sets (Osf, SC), honor this in the GUI (#8547) diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp index 1694975..e37ad2e 100644 --- a/src/LaTeXFonts.cpp +++ b/src/LaTeXFonts.cpp @@ -110,6 +110,19 @@ bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath) } +bool LaTeXFont::hasMonolithicExpertSet(bool ot1, bool complete, bool nomath) +{ + docstring const usedfont = getUsedFont(ot1, complete, nomath); + + if (usedfont.empty()) + return false; + else if (usedfont != name_) + return altFont(usedfont).hasMonolithicExpertSet(ot1, complete, nomath); + return (!osfoption_.empty() && !scoption_.empty() && osfoption_ == scoption_) + || (osfoption_.empty() && scoption_.empty() && !osfscoption_.empty()); +} + + bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath) { docstring const usedfont = getUsedFont(ot1, complete, nomath); diff --git a/src/LaTeXFonts.h b/src/LaTeXFonts.h index f4f09b7..8c9da88 100644 --- a/src/LaTeXFonts.h +++ b/src/LaTeXFonts.h @@ -70,6 +70,10 @@ public: bool providesOSF(bool ot1, bool complete, bool nomath); /// Does this font provide optional true SmallCaps? bool providesSC(bool ot1, bool complete, bool nomath); + /** does this font provide OSF and Small Caps only via + * a single, undifferentiated expert option? + */ + bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath); /// Does this font provide scaling? bool providesScale(bool ot1, bool complete, bool nomath); /// Return the LaTeX Code diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 399d88d..1017d5d 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -850,8 +850,12 @@ GuiDocument::GuiDocument(GuiView & lv) this, SLOT(change_adaptor())); connect(fontModule->fontScCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); + connect(fontModule->fontScCB, SIGNAL(toggled(bool)), + this, SLOT(fontScToggled(bool))); connect(fontModule->fontOsfCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); + connect(fontModule->fontOsfCB, SIGNAL(toggled(bool)), + this, SLOT(fontOsfToggled(bool))); fontModule->fontencLE->setValidator(new NoNewLineValidator( fontModule->fontencLE)); @@ -1812,6 +1816,28 @@ void GuiDocument::mathFontChanged(int) } +void GuiDocument::fontOsfToggled(bool state) +{ + if (fontModule->osFontsCB->isChecked()) + return; + QString font = fontModule->fontsRomanCO->itemData( + fontModule->fontsRomanCO->currentIndex()).toString(); + if (hasMonolithicExpertSet(font)) + fontModule->fontScCB->setChecked(state); +} + + +void GuiDocument::fontScToggled(bool state) +{ + if (fontModule->osFontsCB->isChecked()) + return; + QString font = fontModule->fontsRomanCO->itemData( + fontModule->fontsRomanCO->currentIndex()).toString(); + if (hasMonolithicExpertSet(font)) + fontModule->fontOsfCB->setChecked(state); +} + + void GuiDocument::updateFontOptions() { bool const tex_fonts = !fontModule->osFontsCB->isChecked(); @@ -3763,6 +3789,17 @@ bool GuiDocument::providesNoMath(QString const & font) const } +bool GuiDocument::hasMonolithicExpertSet(QString const & font) const +{ + if (fontModule->osFontsCB->isChecked()) + return false; + return theLaTeXFonts().getLaTeXFont( + qstring_to_ucs4(font)).hasMonolithicExpertSet(ot1(), + completeFontset(), + noMathFont()); +} + + void GuiDocument::loadModuleInfo() { moduleNames_.clear(); diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index 0bfbc16..4c8d1cf 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -98,6 +98,8 @@ private Q_SLOTS: void romanChanged(int); void sansChanged(int); void ttChanged(int); + void fontOsfToggled(bool state); + void fontScToggled(bool state); void setIndent(int); void enableIndent(bool); void setSkip(int); @@ -231,6 +233,10 @@ private: bool providesOSF(QString const & font) const; /// does this font provide true Small Caps? bool providesSC(QString const & font) const; + /** does this font provide OSF and Small Caps only via + * a single, undifferentiated expert option? + */ + bool hasMonolithicExpertSet(QString const & font) const; /// does this font provide size adjustment? bool providesScale(QString const & font) const; /// does this font provide an alternative without math? ----------------------------------------------------------------------- Summary of changes: src/LaTeXFonts.cpp | 13 +++++++++++++ src/LaTeXFonts.h | 4 ++++ src/frontends/qt4/GuiDocument.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/frontends/qt4/GuiDocument.h | 6 ++++++ 4 files changed, 60 insertions(+), 0 deletions(-) hooks/post-receive -- The LyX Source Repository
