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), moreopts_(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 /// Does this provide additional options?
62 bool providesMoreOptions(bool ot1, bool complete, bool nomath);
63 /// Alternative requirement to test for
64 docstring const & requires() { return requires_; }
65 /// Does this font provide a given \p feature
66 bool provides(std::string const & name, bool ot1,
67 bool complete, bool nomath);
68 /// Issue the familydefault switch
69 bool switchdefault() const { return switchdefault_; }
70 /// Does the font provide Old Style Figures as default?
71 bool osfDefault() const { return osfdefault_; }
72 /// Is this font available?
73 bool available(bool ot1, bool nomath);
74 /// Does this font provide an alternative without math?
75 bool providesNoMath(bool ot1, bool complete);
76 /// Does this font provide Old Style Figures?
77 bool providesOSF(bool ot1, bool complete, bool nomath);
78 /// Does this font provide optional true SmallCaps?
79 bool providesSC(bool ot1, bool complete, bool nomath);
80 /** does this font provide OSF and Small Caps only via
81 * a single, undifferentiated expert option?
83 bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath);
84 /// Does this font provide scaling?
85 bool providesScale(bool ot1, bool complete, bool nomath);
86 /// Return the LaTeX Code
87 std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
88 bool sc, bool osf, bool nomath,
89 std::string const extraopts = std::string(),
90 int const & scale = 100);
91 /// Return the actually used font
92 docstring const getUsedFont(bool ot1, bool complete, bool nomath);
93 /// Return the actually used package
94 docstring const getUsedPackage(bool ot1, bool complete, bool nomath);
96 bool read(Lexer & lex);
98 bool readFont(Lexer & lex);
100 /// Return the preferred available package
101 std::string const getAvailablePackage(bool dryrun);
102 /// Return the package options
103 std::string const getPackageOptions(bool ot1,
108 std::string const extraopts,
110 /// Return an alternative font
111 LaTeXFont altFont(docstring const & name);
121 std::vector<std::string> fontenc_;
123 std::vector<docstring> altfonts_;
125 docstring completefont_;
127 docstring nomathfont_;
133 docstring packageoption_;
135 docstring osfoption_;
139 docstring osfscoption_;
141 docstring scaleoption_;
143 std::vector<std::string> provides_;
157 /** The list of available LaTeX fonts
162 typedef std::map<docstring, LaTeXFont> TexFontMap;
163 /// Get all LaTeXFonts
164 TexFontMap getLaTeXFonts();
165 /// Get a specific LaTeXFont \p name
166 LaTeXFont getLaTeXFont(docstring const & name);
167 /// Get a specific AltFont \p name
168 LaTeXFont getAltFont(docstring const & name);
171 void readLaTeXFonts();
173 TexFontMap texfontmap_;
175 TexFontMap texaltfontmap_;
178 /// Implementation is in LyX.cpp
179 extern LaTeXFonts & theLaTeXFonts();