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 /// A macro for font scaling
61 docstring const & scalecmd() { return scalecmd_; }
62 /// Does this provide additional options?
63 bool providesMoreOptions(bool ot1, bool complete, bool nomath);
64 /// Alternative requirement to test for
65 docstring const & required() { return required_; }
66 /// Does this font provide a given \p feature
67 bool provides(std::string const & name, bool ot1,
68 bool complete, bool nomath);
69 /// Issue the familydefault switch
70 bool switchdefault() const { return switchdefault_; }
71 /// Does the font provide Old Style Figures as default?
72 bool osfDefault() const { return osfdefault_; }
73 /// Does OSF font replace (rather than complement) the non-OSF one?
74 bool osfFontOnly() const { return osffontonly_; }
75 /// Is this font available?
76 bool available(bool ot1, bool nomath);
77 /// Does this font provide an alternative without math?
78 bool providesNoMath(bool ot1, bool complete);
79 /// Does this font provide Old Style Figures?
80 bool providesOSF(bool ot1, bool complete, bool nomath);
81 /// Does this font provide optional true SmallCaps?
82 bool providesSC(bool ot1, bool complete, bool nomath);
83 /** does this font provide OSF and Small Caps only via
84 * a single, undifferentiated expert option?
86 bool hasMonolithicExpertSet(bool ot1, bool complete, bool nomath);
87 /// Does this font provide scaling?
88 bool providesScale(bool ot1, bool complete, bool nomath);
89 /// Return the LaTeX Code
90 std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
91 bool sc, bool osf, bool nomath,
92 std::string const & extraopts = std::string(),
93 int const & scale = 100);
94 /// Return the actually used font
95 docstring const getUsedFont(bool ot1, bool complete, bool nomath, bool osf);
96 /// Return the actually used package
97 docstring const getUsedPackage(bool ot1, bool complete, bool nomath);
99 bool read(Lexer & lex);
101 bool readFont(Lexer & lex);
103 /// Return the preferred available package
104 std::string const getAvailablePackage(bool dryrun);
105 /// Return the package options
106 std::string const getPackageOptions(bool ot1,
111 std::string const & extraopts,
113 /// Return an alternative font
114 LaTeXFont altFont(docstring const & name);
124 std::vector<std::string> fontenc_;
126 std::vector<docstring> altfonts_;
128 docstring completefont_;
130 docstring nomathfont_;
136 docstring packageoptions_;
138 docstring osfoption_;
142 docstring osfscoption_;
144 docstring scaleoption_;
148 std::vector<std::string> provides_;
164 /** The list of available LaTeX fonts
169 typedef std::map<docstring, LaTeXFont> TexFontMap;
170 /// Get all LaTeXFonts
171 TexFontMap getLaTeXFonts();
172 /// Get a specific LaTeXFont \p name
173 LaTeXFont getLaTeXFont(docstring const & name);
174 /// Get a specific AltFont \p name
175 LaTeXFont getAltFont(docstring const & name);
178 void readLaTeXFonts();
180 TexFontMap texfontmap_;
182 TexFontMap texaltfontmap_;
185 /// Implementation is in LyX.cpp
186 extern LaTeXFonts & theLaTeXFonts();