4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jürgen Spitzmüller
9 * Full author contact details are available in file CREDITS.
15 #include "support/docstring.h"
25 /// LaTeX Font definition
29 LaTeXFont() : switchdefault_(false) {}
31 docstring const & name() { return name_; }
32 /// The name to appear in the document dialog
33 docstring const & guiname() { return guiname_; }
34 /// Font family (rm, sf, tt)
35 docstring const & family() { return family_; }
36 /// The package that provides this font
37 docstring const & package() { return package_; }
38 /// Alternative font if package() is not available
39 std::vector<docstring> const & altfonts() { return altfonts_; }
40 /// A font that provides all families
41 docstring const & completefont() { return completefont_; }
42 /// A font specifically needed for OT1 font encoding
43 docstring const & ot1font() { return ot1font_; }
44 /// A font that provides Old Style Figures for this type face
45 docstring const & osffont() { return osffont_; }
46 /// A package option needed to load this font
47 docstring const & packageoption() { return packageoption_; }
48 /// A package option for Old Style Figures
49 docstring const & osfoption() { return osfoption_; }
50 /// A package option for true SmallCaps
51 docstring const & scoption() { return scoption_; }
52 /// A package option for both Old Style Figures and SmallCaps
53 docstring const & osfscoption() { return osfscoption_; }
54 /// A package option for font scaling
55 docstring const & scaleoption() { return scaleoption_; }
56 /// Alternative requirement to test for
57 docstring const & requires() { return requires_; }
58 /// Does this font provide a given \p feature
59 bool provides(std::string const & name, bool ot1,
60 bool complete, bool nomath);
61 /// Issue the familydefault switch
62 bool switchdefault() const { return switchdefault_; }
63 /// Does the font provide Old Style Figures as default?
64 bool osfDefault() const { return osfdefault_; }
65 /// Is this font available?
66 bool available(bool ot1, bool nomath);
67 /// Does this font provide an alternative without math?
68 bool providesNoMath(bool ot1, bool complete);
69 /// Does this font provide Old Style Figures?
70 bool providesOSF(bool ot1, bool complete, bool nomath);
71 /// Does this font provide optional true SmallCaps?
72 bool providesSC(bool ot1, bool complete, bool nomath);
73 /// Does this font provide scaling?
74 bool providesScale(bool ot1, bool complete, bool nomath);
75 /// Return the LaTeX Code
76 std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
77 bool sc, bool osf, bool nomath,
78 int const & scale = 100);
79 /// Return the actually used font
80 docstring const getUsedFont(bool ot1, bool complete, bool nomath);
82 bool read(Lexer & lex);
84 bool readFont(Lexer & lex);
86 /// Return the preferred available package
87 std::string const getAvailablePackage(bool dryrun);
88 /// Return the package options
89 std::string const getPackageOptions(bool ot1,
95 /// Return an alternative font
96 LaTeXFont altFont(docstring const & name);
106 std::vector<docstring> altfonts_;
108 docstring completefont_;
110 docstring nomathfont_;
116 docstring packageoption_;
118 docstring osfoption_;
122 docstring osfscoption_;
124 docstring scaleoption_;
126 std::vector<std::string> provides_;
136 /** The list of available LaTeX fonts
141 typedef std::map<docstring, LaTeXFont> TexFontMap;
142 /// Get all LaTeXFonts
143 TexFontMap getLaTeXFonts();
144 /// Get a specific LaTeXFont \p name
145 LaTeXFont getLaTeXFont(docstring const & name);
146 /// Get a specific AltFont \p name
147 LaTeXFont getAltFont(docstring const & name);
150 void readLaTeXFonts();
152 TexFontMap texfontmap_;
154 TexFontMap texaltfontmap_;
157 /// Implementation is in LyX.cpp
158 extern LaTeXFonts & theLaTeXFonts();