mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Consider CompleteFont with MoreOptions
This commit is contained in:
parent
e8d8716735
commit
0738ff08ba
@ -137,6 +137,21 @@ bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath)
|
||||
return (!scaleoption_.empty());
|
||||
}
|
||||
|
||||
|
||||
bool LaTeXFont::providesMoreOptions(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).providesMoreOptions(ot1, complete, nomath);
|
||||
else if (!available(ot1, nomath))
|
||||
return false;
|
||||
|
||||
return (moreopts_);
|
||||
}
|
||||
|
||||
bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool nomath)
|
||||
{
|
||||
docstring const usedfont = getUsedFont(ot1, complete, nomath);
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
/// A package option for font scaling
|
||||
docstring const & scaleoption() { return scaleoption_; }
|
||||
/// Does this provide additional options?
|
||||
bool moreoptions() const { return moreopts_; }
|
||||
bool providesMoreOptions(bool ot1, bool complete, bool nomath);
|
||||
/// Alternative requirement to test for
|
||||
docstring const & requires() { return requires_; }
|
||||
/// Does this font provide a given \p feature
|
||||
|
@ -2427,7 +2427,7 @@ void GuiDocument::fontScToggled(bool state)
|
||||
}
|
||||
|
||||
|
||||
void GuiDocument::updateFontOptions()
|
||||
void GuiDocument::updateExtraOpts()
|
||||
{
|
||||
bool const tex_fonts = !fontModule->osFontsCB->isChecked();
|
||||
QString font;
|
||||
@ -2438,15 +2438,34 @@ void GuiDocument::updateFontOptions()
|
||||
if (tex_fonts)
|
||||
font = fontModule->fontsSansCO->itemData(
|
||||
fontModule->fontsSansCO->currentIndex()).toString();
|
||||
bool scaleable = providesScale(font);
|
||||
bool const sf_opts = providesExtraOpts(font);
|
||||
if (tex_fonts)
|
||||
font = fontModule->fontsTypewriterCO->itemData(
|
||||
fontModule->fontsTypewriterCO->currentIndex()).toString();
|
||||
bool const tt_opts = providesExtraOpts(font);
|
||||
fontModule->fontspecRomanLA->setEnabled(!tex_fonts || rm_opts);
|
||||
fontModule->fontspecRomanLE->setEnabled(!tex_fonts || rm_opts);
|
||||
fontModule->fontspecSansLA->setEnabled(!tex_fonts || sf_opts);
|
||||
fontModule->fontspecSansLE->setEnabled(!tex_fonts || sf_opts);
|
||||
fontModule->fontspecTypewriterLA->setEnabled(!tex_fonts || tt_opts);
|
||||
fontModule->fontspecTypewriterLE->setEnabled(!tex_fonts || tt_opts);
|
||||
}
|
||||
|
||||
|
||||
void GuiDocument::updateFontOptions()
|
||||
{
|
||||
bool const tex_fonts = !fontModule->osFontsCB->isChecked();
|
||||
QString font;
|
||||
if (tex_fonts)
|
||||
font = fontModule->fontsSansCO->itemData(
|
||||
fontModule->fontsSansCO->currentIndex()).toString();
|
||||
bool scaleable = providesScale(font);
|
||||
fontModule->scaleSansSB->setEnabled(scaleable);
|
||||
fontModule->scaleSansLA->setEnabled(scaleable);
|
||||
if (tex_fonts)
|
||||
font = fontModule->fontsTypewriterCO->itemData(
|
||||
fontModule->fontsTypewriterCO->currentIndex()).toString();
|
||||
scaleable = providesScale(font);
|
||||
bool const tt_opts = providesExtraOpts(font);
|
||||
fontModule->scaleTypewriterSB->setEnabled(scaleable);
|
||||
fontModule->scaleTypewriterLA->setEnabled(scaleable);
|
||||
if (tex_fonts)
|
||||
@ -2454,12 +2473,7 @@ void GuiDocument::updateFontOptions()
|
||||
fontModule->fontsRomanCO->currentIndex()).toString();
|
||||
fontModule->fontScCB->setEnabled(providesSC(font));
|
||||
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
||||
fontModule->fontspecRomanLA->setEnabled(!tex_fonts || rm_opts);
|
||||
fontModule->fontspecRomanLE->setEnabled(!tex_fonts || rm_opts);
|
||||
fontModule->fontspecSansLA->setEnabled(!tex_fonts || sf_opts);
|
||||
fontModule->fontspecSansLE->setEnabled(!tex_fonts || sf_opts);
|
||||
fontModule->fontspecTypewriterLA->setEnabled(!tex_fonts || tt_opts);
|
||||
fontModule->fontspecTypewriterLE->setEnabled(!tex_fonts || tt_opts);
|
||||
updateExtraOpts();
|
||||
updateMathFonts(font);
|
||||
}
|
||||
|
||||
@ -2637,11 +2651,9 @@ void GuiDocument::romanChanged(int item)
|
||||
return;
|
||||
QString const font =
|
||||
fontModule->fontsRomanCO->itemData(item).toString();
|
||||
bool const opts = providesExtraOpts(font);
|
||||
fontModule->fontScCB->setEnabled(providesSC(font));
|
||||
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
||||
fontModule->fontspecRomanLA->setEnabled(opts);
|
||||
fontModule->fontspecRomanLE->setEnabled(opts);
|
||||
updateExtraOpts();
|
||||
updateMathFonts(font);
|
||||
}
|
||||
|
||||
@ -2653,11 +2665,9 @@ void GuiDocument::sansChanged(int item)
|
||||
QString const font =
|
||||
fontModule->fontsSansCO->itemData(item).toString();
|
||||
bool const scaleable = providesScale(font);
|
||||
bool const opts = providesExtraOpts(font);
|
||||
fontModule->scaleSansSB->setEnabled(scaleable);
|
||||
fontModule->scaleSansLA->setEnabled(scaleable);
|
||||
fontModule->fontspecSansLA->setEnabled(opts);
|
||||
fontModule->fontspecSansLE->setEnabled(opts);
|
||||
updateExtraOpts();
|
||||
}
|
||||
|
||||
|
||||
@ -2668,11 +2678,9 @@ void GuiDocument::ttChanged(int item)
|
||||
QString const font =
|
||||
fontModule->fontsTypewriterCO->itemData(item).toString();
|
||||
bool scaleable = providesScale(font);
|
||||
bool const opts = providesExtraOpts(font);
|
||||
fontModule->scaleTypewriterSB->setEnabled(scaleable);
|
||||
fontModule->scaleTypewriterLA->setEnabled(scaleable);
|
||||
fontModule->fontspecTypewriterLA->setEnabled(opts);
|
||||
fontModule->fontspecTypewriterLE->setEnabled(opts);
|
||||
updateExtraOpts();
|
||||
}
|
||||
|
||||
|
||||
@ -4957,7 +4965,9 @@ bool GuiDocument::providesExtraOpts(QString const & font) const
|
||||
if (fontModule->osFontsCB->isChecked())
|
||||
return true;
|
||||
return theLaTeXFonts().getLaTeXFont(
|
||||
qstring_to_ucs4(font)).moreoptions();
|
||||
qstring_to_ucs4(font)).providesMoreOptions(ot1(),
|
||||
completeFontset(),
|
||||
noMathFont());
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,6 +307,8 @@ private:
|
||||
///
|
||||
void updateMathFonts(QString const & rm);
|
||||
///
|
||||
void updateExtraOpts();
|
||||
///
|
||||
void updateFontOptions();
|
||||
///
|
||||
bool ot1() const;
|
||||
|
Loading…
Reference in New Issue
Block a user