Preamble tag for LaTeXFonts (#8530)

This commit is contained in:
Juergen Spitzmueller 2013-02-09 11:00:42 +01:00
parent 33e185e5ed
commit 9cbba74a62
3 changed files with 18 additions and 2 deletions

View File

@ -22,6 +22,9 @@
# 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>
# Provides <features provided by the font packages (comma-separated)> # Provides <features provided by the font packages (comma-separated)>
# Preamble
# <some arbitrary LaTeX code to be issued in the preamble>
# EndPreamble
# EndFont # EndFont
# #
# #
@ -53,8 +56,8 @@
# The value "none" tells LyX not to load any font in OT1 encoding. # The value "none" tells LyX not to load any font in OT1 encoding.
# OT1Fonts need to be defined separately using AltFont ... EndFont tags. # OT1Fonts need to be defined separately using AltFont ... EndFont tags.
# * The CompleteFont is loaded if the current font is selected as rm and # * The CompleteFont is loaded if the current font is selected as rm and
# both sf and tt are set to "default" (this allows f. ex. to load "bera" # both sf and tt are set to "default" (this allows for instance to load
# as opposed to "beraserif"). # "bera" as opposed to "beraserif").
# CompleteFonts need to be defined separately using AltFont ... EndFont # CompleteFonts need to be defined separately using AltFont ... EndFont
# tags. # tags.
# * OsfFont is a font that is loaded additionally in and that provides # * OsfFont is a font that is loaded additionally in and that provides
@ -65,9 +68,12 @@
# 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 supports the placeholder $$val for the scale value.
# * The Preamble code is output immediately after the respective font
# loading command.
# #
########################################################################## ##########################################################################
# #
# ROMAN FONTS # ROMAN FONTS
# #

View File

@ -275,6 +275,9 @@ 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, nomath, scale); os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf, nomath, scale);
if (!preamble_.empty())
os << preamble_;
return os.str(); return os.str();
} }
@ -295,6 +298,7 @@ bool LaTeXFont::readFont(Lexer & lex)
LF_OT1_FONT, LF_OT1_FONT,
LF_PACKAGE, LF_PACKAGE,
LF_PACKAGEOPTION, LF_PACKAGEOPTION,
LF_PREAMBLE,
LF_PROVIDES, LF_PROVIDES,
LF_REQUIRES, LF_REQUIRES,
LF_SCALEOPTION, LF_SCALEOPTION,
@ -317,6 +321,7 @@ bool LaTeXFont::readFont(Lexer & lex)
{ "ot1font", LF_OT1_FONT }, { "ot1font", LF_OT1_FONT },
{ "package", LF_PACKAGE }, { "package", LF_PACKAGE },
{ "packageoption", LF_PACKAGEOPTION }, { "packageoption", LF_PACKAGEOPTION },
{ "preamble", LF_PREAMBLE },
{ "provides", LF_PROVIDES }, { "provides", LF_PROVIDES },
{ "requires", LF_REQUIRES }, { "requires", LF_REQUIRES },
{ "scaleoption", LF_SCALEOPTION }, { "scaleoption", LF_SCALEOPTION },
@ -386,6 +391,9 @@ bool LaTeXFont::readFont(Lexer & lex)
case LF_PACKAGEOPTION: case LF_PACKAGEOPTION:
lex >> packageoption_; lex >> packageoption_;
break; break;
case LF_PREAMBLE:
preamble_ = lex.getLongString("EndPreamble");
break;
case LF_PROVIDES: { case LF_PROVIDES: {
lex.eatLine(); lex.eatLine();
string features = lex.getString(); string features = lex.getString();

View File

@ -127,6 +127,8 @@ private:
/// ///
docstring requires_; docstring requires_;
/// ///
std::string preamble_;
///
bool osfdefault_; bool osfdefault_;
/// ///
bool switchdefault_; bool switchdefault_;