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),
31 osffontonly_(false) { fontenc_.push_back("T1"); }
33 docstring const & name() { return name_; }
34 /// The name to appear in the document dialog
35 docstring const & guiname() { return guiname_; }
36 /// Font family (rm, sf, tt)
37 docstring const & family() { return family_; }
38 /// The package that provides this font
39 docstring const & package() { return package_; }
40 /// Does this provide a specific font encoding?
41 bool hasFontenc(std::string const &) const;
42 /// The font encoding(s)
43 std::vector<std::string> const & fontencs() const { return fontenc_; }
44 /// Alternative font if package() is not available
45 std::vector<docstring> const & altfonts() { return altfonts_; }
46 /// A font that provides all families
47 docstring const & completefont() { return completefont_; }
48 /// A font specifically needed for OT1 font encoding
49 docstring const & ot1font() { return ot1font_; }
50 /// A font that provides Old Style Figures for this type face
51 docstring const & osffont() { return osffont_; }
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 /// Does this provide additional options?
61 bool providesMoreOptions(bool ot1, bool complete, bool nomath);
62 /// Alternative requirement to test for
63 docstring const & required() { return required_; }
64 /// Does this font provide a given \p feature
65 bool provides(std::string const & name, bool ot1,
66 bool complete, bool nomath);
67 /// Issue the familydefault switch
68 bool switchdefault() const { return switchdefault_; }
69 /// Does the font provide Old Style Figures as default?
70 bool osfDefault() const { return osfdefault_; }
71 /// Does OSF font replace (rather than complement) the non-OSF one?
72 bool osfFontOnly() const { return osffontonly_; }
73 /// Is this font available?
74 bool available(bool ot1, bool nomath);
75 /// Does this font provide an alternative without math?
76 bool providesNoMath(bool ot1, bool complete);
77 /// Does this font provide Old Style Figures?
78 bool providesOSF(bool ot1, bool complete, bool nomath);
79 /// Does this font provide optional true SmallCaps?
80 bool providesSC(bool ot1, bool complete, bool nomath);
81 /** does this font provide OSF and Small Caps only via
82 * a single, undifferentiated expert option?
84 bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath);
85 /// Does this font provide scaling?
86 bool providesScale(bool ot1, bool complete, bool nomath);
87 /// Return the LaTeX Code
88 std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
89 bool sc, bool osf, bool nomath,
90 std::string const & extraopts = std::string(),
91 int const & scale = 100);
92 /// Return the actually used font
93 docstring const getUsedFont(bool ot1, bool complete, bool nomath, bool osf);
94 /// Return the actually used package
95 docstring const getUsedPackage(bool ot1, bool complete, bool nomath);
97 bool read(Lexer & lex);
99 bool readFont(Lexer & lex);
101 /// Return the preferred available package
102 std::string const getAvailablePackage(bool dryrun);
103 /// Return the package options
104 std::string const getPackageOptions(bool ot1,
109 std::string const & extraopts,
111 /// Return an alternative font
112 LaTeXFont altFont(docstring const & name);
122 std::vector<std::string> fontenc_;
124 std::vector<docstring> altfonts_;
126 docstring completefont_;
128 docstring nomathfont_;
134 docstring packageoptions_;
136 docstring osfoption_;
140 docstring osfscoption_;
142 docstring scaleoption_;
144 std::vector<std::string> provides_;
160 /** The list of available LaTeX fonts
165 typedef std::map<docstring, LaTeXFont> TexFontMap;
166 /// Get all LaTeXFonts
167 TexFontMap getLaTeXFonts();
168 /// Get a specific LaTeXFont \p name
169 LaTeXFont getLaTeXFont(docstring const & name);
170 /// Get a specific AltFont \p name
171 LaTeXFont getAltFont(docstring const & name);
174 void readLaTeXFonts();
176 TexFontMap texfontmap_;
178 TexFontMap texaltfontmap_;
181 /// Implementation is in LyX.cpp
182 extern LaTeXFonts & theLaTeXFonts();