1 // -*- C++ -*-
2 /**
3  * \file InsetMathChar.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11 
12 #ifndef MATH_CHARINSET_H
13 #define MATH_CHARINSET_H
14 
15 #include "InsetMath.h"
16 
17 namespace lyx {
18 
19 class latexkeys;
20 
21 /// The base character inset.
22 class InsetMathChar : public InsetMath {
23 public:
24 	///
25 	explicit InsetMathChar(char_type c);
26 	///
27 	void metrics(MetricsInfo & mi, Dimension & dim) const;
28 	///
29 	void draw(PainterInfo & pi, int x, int y) const;
30 	///
31 	void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
32 	///
33 	void drawT(TextPainter &, int x, int y) const;
34 	///
kerning(BufferView const *)35 	int kerning(BufferView const *) const { return kerning_; }
36 
37 	///
38 	void write(WriteStream & os) const;
39 	///
40 	void validate(LaTeXFeatures & features) const;
41 	///
42 	void normalize(NormalStream & ns) const;
43 	///
44 	void octave(OctaveStream & os) const;
45 	///
46 	void mathmlize(MathStream & ms) const;
47 	///
48 	void htmlize(HtmlStream & ms) const;
49 	/// identifies Charinsets
asCharInset()50 	InsetMathChar const * asCharInset() const { return this; }
51 	///
getChar()52 	char_type getChar() const { return char_; }
53 	///
54 	MathClass mathClass() const;
55 	///
lyxCode()56 	InsetCode lyxCode() const { return MATH_CHAR_CODE; }
57 
58 private:
59 	virtual Inset * clone() const;
60 	/// the character
61 	char_type const char_;
62 	/// cached kerning for superscript
63 	mutable int kerning_;
64 	/// Inset to substitute char for, for on-screen display in math mode, as
65 	/// performed by LaTeX (#9893):
66 	/// * -> \ast (U+2217)
67 	/// - -> \lyxminus (U+2212)
68 	/// : -> \ordinarycolon (U+2236)
69 	///
70 	/// For cosmetic reasons, +, >, <, and = are also substituted to force the
71 	/// use of CM fonts for uniformity. If CM fonts are replaced with unicode
72 	/// math fonts, this should be removed, and substitutions of "'", ",", and
73 	/// ";" added.
74 	///
75 	/// Null if there is no substitute.
76 	latexkeys const * const subst_;
77 };
78 
79 } // namespace lyx
80 
81 #endif
82