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 // FIXME Add fontenc tag to classes which is used if no font is specified?
30 LaTeXFont() : osfdefault_(false), switchdefault_(false) { fontenc_.push_back("T1"); }
32 docstring const & name() { return name_; }
33 /// The name to appear in the document dialog
34 docstring const & guiname() { return guiname_; }
35 /// Font family (rm, sf, tt)
36 docstring const & family() { return family_; }
37 /// The package that provides this font
38 docstring const & package() { return package_; }
39 /// Does this provide a specific font encoding?
40 bool hasFontenc(std::string const &) const;
41 /// The font encoding(s)
42 std::vector<std::string> const & fontencs() const { return fontenc_; }
43 /// Alternative font if package() is not available
44 std::vector<docstring> const & altfonts() { return altfonts_; }
45 /// A font that provides all families
46 docstring const & completefont() { return completefont_; }
47 /// A font specifically needed for OT1 font encoding
48 docstring const & ot1font() { return ot1font_; }
49 /// A font that provides Old Style Figures for this type face
50 docstring const & osffont() { return osffont_; }
51 /// A package option needed to load this font
52 docstring const & packageoption() { return packageoption_; }
53 /// A package option for Old Style Figures
54 docstring const & osfoption() { return osfoption_; }
55 /// A package option for true SmallCaps
56 docstring const & scoption() { return scoption_; }
57 /// A package option for both Old Style Figures and SmallCaps
58 docstring const & osfscoption() { return osfscoption_; }
59 /// A package option for font scaling
60 docstring const & scaleoption() { return scaleoption_; }
61 /// Alternative requirement to test for
62 docstring const & requires() { return requires_; }
63 /// Does this font provide a given \p feature
64 bool provides(std::string const & name, bool ot1,
65 bool complete, bool nomath);
66 /// Issue the familydefault switch
67 bool switchdefault() const { return switchdefault_; }
68 /// Does the font provide Old Style Figures as default?
69 bool osfDefault() const { return osfdefault_; }
70 /// Is this font available?
71 bool available(bool ot1, bool nomath);
72 /// Does this font provide an alternative without math?
73 bool providesNoMath(bool ot1, bool complete);
74 /// Does this font provide Old Style Figures?
75 bool providesOSF(bool ot1, bool complete, bool nomath);
76 /// Does this font provide optional true SmallCaps?
77 bool providesSC(bool ot1, bool complete, bool nomath);
78 /** does this font provide OSF and Small Caps only via
79 * a single, undifferentiated expert option?
81 bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath);
82 /// Does this font provide scaling?
83 bool providesScale(bool ot1, bool complete, bool nomath);
84 /// Return the LaTeX Code
85 std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
86 bool sc, bool osf, bool nomath,
87 int const & scale = 100);
88 /// Return the actually used font
89 docstring const getUsedFont(bool ot1, bool complete, bool nomath);
90 /// Return the actually used package
91 docstring const getUsedPackage(bool ot1, bool complete, bool nomath);
93 bool read(Lexer & lex);
95 bool readFont(Lexer & lex);
97 /// Return the preferred available package
98 std::string const getAvailablePackage(bool dryrun);
99 /// Return the package options
100 std::string const getPackageOptions(bool ot1,
106 /// Return an alternative font
107 LaTeXFont altFont(docstring const & name);
117 std::vector<std::string> fontenc_;
119 std::vector<docstring> altfonts_;
121 docstring completefont_;
123 docstring nomathfont_;
129 docstring packageoption_;
131 docstring osfoption_;
135 docstring osfscoption_;
137 docstring scaleoption_;
139 std::vector<std::string> provides_;
151 /** The list of available LaTeX fonts
156 typedef std::map<docstring, LaTeXFont> TexFontMap;
157 /// Get all LaTeXFonts
158 TexFontMap getLaTeXFonts();
159 /// Get a specific LaTeXFont \p name
160 LaTeXFont getLaTeXFont(docstring const & name);
161 /// Get a specific AltFont \p name
162 LaTeXFont getAltFont(docstring const & name);
165 void readLaTeXFonts();
167 TexFontMap texfontmap_;
169 TexFontMap texaltfontmap_;
172 /// Implementation is in LyX.cpp
173 extern LaTeXFonts & theLaTeXFonts();