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() : osfdefault_(false), 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 /// Does this provide a specific font encoding?
39 bool hasFontenc(std::string const &) const;
40 /// The font encoding(s)
41 std::vector<std::string> const & fontencs() const { return fontenc_; }
42 /// Alternative font if package() is not available
43 std::vector<docstring> const & altfonts() { return altfonts_; }
44 /// A font that provides all families
45 docstring const & completefont() { return completefont_; }
46 /// A font specifically needed for OT1 font encoding
47 docstring const & ot1font() { return ot1font_; }
48 /// A font that provides Old Style Figures for this type face
49 docstring const & osffont() { return osffont_; }
50 /// A package option needed to load this font
51 docstring const & packageoption() { return packageoption_; }
52 /// A package option for Old Style Figures
53 docstring const & osfoption() { return osfoption_; }
54 /// A package option for true SmallCaps
55 docstring const & scoption() { return scoption_; }
56 /// A package option for both Old Style Figures and SmallCaps
57 docstring const & osfscoption() { return osfscoption_; }
58 /// A package option for font scaling
59 docstring const & scaleoption() { return scaleoption_; }
60 /// Alternative requirement to test for
61 docstring const & requires() { return requires_; }
62 /// Does this font provide a given \p feature
63 bool provides(std::string const & name, bool ot1,
64 bool complete, bool nomath);
65 /// Issue the familydefault switch
66 bool switchdefault() const { return switchdefault_; }
67 /// Does the font provide Old Style Figures as default?
68 bool osfDefault() const { return osfdefault_; }
69 /// Is this font available?
70 bool available(bool ot1, bool nomath);
71 /// Does this font provide an alternative without math?
72 bool providesNoMath(bool ot1, bool complete);
73 /// Does this font provide Old Style Figures?
74 bool providesOSF(bool ot1, bool complete, bool nomath);
75 /// Does this font provide optional true SmallCaps?
76 bool providesSC(bool ot1, bool complete, bool nomath);
77 /** does this font provide OSF and Small Caps only via
78 * a single, undifferentiated expert option?
80 bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath);
81 /// Does this font provide scaling?
82 bool providesScale(bool ot1, bool complete, bool nomath);
83 /// Return the LaTeX Code
84 std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
85 bool sc, bool osf, bool nomath,
86 int const & scale = 100);
87 /// Return the actually used font
88 docstring const getUsedFont(bool ot1, bool complete, bool nomath);
89 /// Return the actually used package
90 docstring const getUsedPackage(bool ot1, bool complete, bool nomath);
92 bool read(Lexer & lex);
94 bool readFont(Lexer & lex);
96 /// Return the preferred available package
97 std::string const getAvailablePackage(bool dryrun);
98 /// Return the package options
99 std::string const getPackageOptions(bool ot1,
105 /// Return an alternative font
106 LaTeXFont altFont(docstring const & name);
116 std::vector<std::string> fontenc_;
118 std::vector<docstring> altfonts_;
120 docstring completefont_;
122 docstring nomathfont_;
128 docstring packageoption_;
130 docstring osfoption_;
134 docstring osfscoption_;
136 docstring scaleoption_;
138 std::vector<std::string> provides_;
150 /** The list of available LaTeX fonts
155 typedef std::map<docstring, LaTeXFont> TexFontMap;
156 /// Get all LaTeXFonts
157 TexFontMap getLaTeXFonts();
158 /// Get a specific LaTeXFont \p name
159 LaTeXFont getLaTeXFont(docstring const & name);
160 /// Get a specific AltFont \p name
161 LaTeXFont getAltFont(docstring const & name);
164 void readLaTeXFonts();
166 TexFontMap texfontmap_;
168 TexFontMap texaltfontmap_;
171 /// Implementation is in LyX.cpp
172 extern LaTeXFonts & theLaTeXFonts();