mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
LaTeXFonts: Add ScaleCommand
This is needed to add support for scaling to fonts that are switched via command
This commit is contained in:
parent
3335344261
commit
780d9a5f4c
@ -23,6 +23,7 @@
|
|||||||
# ScOption <option for true smallcaps support>
|
# ScOption <option for true smallcaps support>
|
||||||
# OsfScOption <option for combined osf and true smallcaps support>
|
# OsfScOption <option for combined osf and true smallcaps support>
|
||||||
# ScaleOption <option for font scaling>
|
# ScaleOption <option for font scaling>
|
||||||
|
# ScaleCommand <command sequence to set scale value of the font>
|
||||||
# MoreOptions <0|1>
|
# MoreOptions <0|1>
|
||||||
# Provides <features provided by the font packages (comma-separated)>
|
# Provides <features provided by the font packages (comma-separated)>
|
||||||
# Preamble
|
# Preamble
|
||||||
@ -75,7 +76,8 @@
|
|||||||
# * Set OsfDefault to true for fonts which have Old Style Figures by
|
# * Set OsfDefault to true for fonts which have Old Style Figures by
|
||||||
# default and provide an option for lining figures. Pass this option
|
# default and provide an option for lining figures. Pass this option
|
||||||
# to OsfOption.
|
# to OsfOption.
|
||||||
# * ScaleOption supports the placeholder $$val for the scale value.
|
# * ScaleOption and ScaleCommand support the placeholder $$val for the
|
||||||
|
# scale value.
|
||||||
# * If MoreOptions is true, then the user can insert additional options to
|
# * If MoreOptions is true, then the user can insert additional options to
|
||||||
# the font package via the Document Settings.
|
# the font package via the Document Settings.
|
||||||
# * The Preamble code is output immediately after the respective font
|
# * The Preamble code is output immediately after the respective font
|
||||||
|
@ -134,7 +134,7 @@ bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath)
|
|||||||
return altFont(usedfont).providesScale(ot1, complete, nomath);
|
return altFont(usedfont).providesScale(ot1, complete, nomath);
|
||||||
else if (!available(ot1, nomath))
|
else if (!available(ot1, nomath))
|
||||||
return false;
|
return false;
|
||||||
return (!scaleoption_.empty());
|
return (!scaleoption_.empty() || !scalecmd_.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -329,6 +329,15 @@ string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool
|
|||||||
if (osf && providesOSF(ot1, complete, nomath) && !osffont_.empty())
|
if (osf && providesOSF(ot1, complete, nomath) && !osffont_.empty())
|
||||||
os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf,
|
os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf,
|
||||||
nomath, extraopts, scale);
|
nomath, extraopts, scale);
|
||||||
|
if (scale != 100 && !scalecmd_.empty()
|
||||||
|
&& providesScale(ot1, complete, nomath)) {
|
||||||
|
if (contains(scalecmd_, '@'))
|
||||||
|
os << "\\makeatletter\n";
|
||||||
|
os << subst(to_ascii(scalecmd_), "$$val",
|
||||||
|
convert<std::string>(float(scale) / 100)) << '\n';
|
||||||
|
if (contains(scalecmd_, '@'))
|
||||||
|
os << "\\makeatother\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (!preamble_.empty())
|
if (!preamble_.empty())
|
||||||
os << to_utf8(preamble_);
|
os << to_utf8(preamble_);
|
||||||
@ -369,6 +378,7 @@ bool LaTeXFont::readFont(Lexer & lex)
|
|||||||
LF_PREAMBLE,
|
LF_PREAMBLE,
|
||||||
LF_PROVIDES,
|
LF_PROVIDES,
|
||||||
LF_REQUIRES,
|
LF_REQUIRES,
|
||||||
|
LF_SCALECMD,
|
||||||
LF_SCALEOPTION,
|
LF_SCALEOPTION,
|
||||||
LF_SCOPTION,
|
LF_SCOPTION,
|
||||||
LF_SWITCHDEFAULT
|
LF_SWITCHDEFAULT
|
||||||
@ -395,6 +405,7 @@ bool LaTeXFont::readFont(Lexer & lex)
|
|||||||
{ "preamble", LF_PREAMBLE },
|
{ "preamble", LF_PREAMBLE },
|
||||||
{ "provides", LF_PROVIDES },
|
{ "provides", LF_PROVIDES },
|
||||||
{ "requires", LF_REQUIRES },
|
{ "requires", LF_REQUIRES },
|
||||||
|
{ "scalecommand", LF_SCALECMD },
|
||||||
{ "scaleoption", LF_SCALEOPTION },
|
{ "scaleoption", LF_SCALEOPTION },
|
||||||
{ "scoption", LF_SCOPTION },
|
{ "scoption", LF_SCOPTION },
|
||||||
{ "switchdefault", LF_SWITCHDEFAULT }
|
{ "switchdefault", LF_SWITCHDEFAULT }
|
||||||
@ -483,6 +494,9 @@ bool LaTeXFont::readFont(Lexer & lex)
|
|||||||
case LF_REQUIRES:
|
case LF_REQUIRES:
|
||||||
lex >> required_;
|
lex >> required_;
|
||||||
break;
|
break;
|
||||||
|
case LF_SCALECMD:
|
||||||
|
lex >> scalecmd_;
|
||||||
|
break;
|
||||||
case LF_SCALEOPTION:
|
case LF_SCALEOPTION:
|
||||||
lex >> scaleoption_;
|
lex >> scaleoption_;
|
||||||
break;
|
break;
|
||||||
|
@ -57,6 +57,8 @@ public:
|
|||||||
docstring const & osfscoption() { return osfscoption_; }
|
docstring const & osfscoption() { return osfscoption_; }
|
||||||
/// A package option for font scaling
|
/// A package option for font scaling
|
||||||
docstring const & scaleoption() { return scaleoption_; }
|
docstring const & scaleoption() { return scaleoption_; }
|
||||||
|
/// A macro for font scaling
|
||||||
|
docstring const & scalecmd() { return scalecmd_; }
|
||||||
/// Does this provide additional options?
|
/// Does this provide additional options?
|
||||||
bool providesMoreOptions(bool ot1, bool complete, bool nomath);
|
bool providesMoreOptions(bool ot1, bool complete, bool nomath);
|
||||||
/// Alternative requirement to test for
|
/// Alternative requirement to test for
|
||||||
@ -141,6 +143,8 @@ private:
|
|||||||
///
|
///
|
||||||
docstring scaleoption_;
|
docstring scaleoption_;
|
||||||
///
|
///
|
||||||
|
docstring scalecmd_;
|
||||||
|
///
|
||||||
std::vector<std::string> provides_;
|
std::vector<std::string> provides_;
|
||||||
///
|
///
|
||||||
docstring required_;
|
docstring required_;
|
||||||
|
Loading…
Reference in New Issue
Block a user