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 packages if package() is not available
39 std::vector<docstring> const & altpackages() { return altpackages_; }
40 /// A package that provides all families
41 docstring const & completepackage() { return completepackage_; }
42 /// A package specifically needed for OT1 font encoding
43 docstring const & ot1package() { return ot1package_; }
44 /// A package that provides Old Style Figures for this font
45 docstring const & osfpackage() { return osfpackage_; }
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) const;
60 /// Issue the familydefault switch
61 bool switchdefault() const { return switchdefault_; }
62 /// Does the font provide Old Style Figures as default?
63 bool osfDefault() const { return osfdefault_; }
64 /// Is this font available?
65 bool available(bool ot1 = false) const;
66 /// Does this font provide Old Style Figures?
67 bool providesOSF(bool ot1 = false) const;
68 /// Does this font provide optional true SmallCaps?
69 bool providesSC(bool ot1 = false) const;
70 /// Does this font provide scaling?
71 bool providesScale(bool ot1 = false) const;
72 /// Return the LaTeX Code
73 std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
75 int const & scale = 100);
77 bool read(Lexer & lex);
79 bool readFont(Lexer & lex);
81 /// Return the preferred available package
82 std::string const getAvailablePackage(bool dryrun,
86 /// Return the package options
87 std::string const getPackageOptions(bool ot1,
100 std::vector<docstring> altpackages_;
102 docstring completepackage_;
104 docstring ot1package_;
106 docstring osfpackage_;
108 docstring packageoption_;
110 docstring osfoption_;
114 docstring osfscoption_;
116 docstring scaleoption_;
118 std::vector<std::string> provides_;
132 /** The list of available LaTeX fonts
137 typedef std::map<docstring, LaTeXFont> TexFontMap;
138 /// Get all LaTeXFonts
139 TexFontMap getLaTeXFonts();
140 /// Get a specific LaTeXFont \p name
141 LaTeXFont getLaTeXFont(docstring const & name);
144 void readLaTeXFonts();
146 TexFontMap texfontmap_;
149 /// Implementation is in LyX.cpp
150 extern LaTeXFonts & theLaTeXFonts();