diff --git a/lib/latexfonts b/lib/latexfonts index 4898c18e93..b840784861 100644 --- a/lib/latexfonts +++ b/lib/latexfonts @@ -22,6 +22,9 @@ # OsfScOption # ScaleOption # Provides +# Preamble +# +# EndPreamble # EndFont # # @@ -53,8 +56,8 @@ # The value "none" tells LyX not to load any font in OT1 encoding. # OT1Fonts need to be defined separately using AltFont ... EndFont tags. # * 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" -# as opposed to "beraserif"). +# both sf and tt are set to "default" (this allows for instance to load +# "bera" as opposed to "beraserif"). # CompleteFonts need to be defined separately using AltFont ... EndFont # tags. # * 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 # to OsfOption. # * ScaleOption supports the placeholder $$val for the scale value. +# * The Preamble code is output immediately after the respective font +# loading command. # ########################################################################## + # # ROMAN FONTS # diff --git a/src/LaTeXFonts.cpp b/src/LaTeXFonts.cpp index c837815fc6..4cc1b82315 100644 --- a/src/LaTeXFonts.cpp +++ b/src/LaTeXFonts.cpp @@ -275,6 +275,9 @@ string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool if (osf && providesOSF(ot1, complete, nomath) && !osffont_.empty()) os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf, nomath, scale); + if (!preamble_.empty()) + os << preamble_; + return os.str(); } @@ -295,6 +298,7 @@ bool LaTeXFont::readFont(Lexer & lex) LF_OT1_FONT, LF_PACKAGE, LF_PACKAGEOPTION, + LF_PREAMBLE, LF_PROVIDES, LF_REQUIRES, LF_SCALEOPTION, @@ -317,6 +321,7 @@ bool LaTeXFont::readFont(Lexer & lex) { "ot1font", LF_OT1_FONT }, { "package", LF_PACKAGE }, { "packageoption", LF_PACKAGEOPTION }, + { "preamble", LF_PREAMBLE }, { "provides", LF_PROVIDES }, { "requires", LF_REQUIRES }, { "scaleoption", LF_SCALEOPTION }, @@ -386,6 +391,9 @@ bool LaTeXFont::readFont(Lexer & lex) case LF_PACKAGEOPTION: lex >> packageoption_; break; + case LF_PREAMBLE: + preamble_ = lex.getLongString("EndPreamble"); + break; case LF_PROVIDES: { lex.eatLine(); string features = lex.getString(); diff --git a/src/LaTeXFonts.h b/src/LaTeXFonts.h index d79d45651c..f4f09b717f 100644 --- a/src/LaTeXFonts.h +++ b/src/LaTeXFonts.h @@ -127,6 +127,8 @@ private: /// docstring requires_; /// + std::string preamble_; + /// bool osfdefault_; /// bool switchdefault_;