]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathChar.h
Display properly math characters that behave like symbols
[lyx.git] / src / mathed / InsetMathChar.h
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         ///
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
50         InsetMathChar const * asCharInset() const { return this; }
51         ///
52         char_type getChar() const { return char_; }
53         ///
54         bool isMathBin() const;
55         ///
56         bool isMathRel() const;
57         ///
58         bool isMathPunct() const;
59         ///
60         InsetCode lyxCode() const { return MATH_CHAR_CODE; }
61
62 private:
63         virtual Inset * clone() const;
64         /// the character
65         char_type const char_;
66         /// cached kerning for superscript
67         mutable int kerning_;
68         /// Inset to substitute char for, for on-screen display in math mode, as
69         /// performed by LaTeX (#9893):
70         /// * -> \ast (U+2217)
71         /// - -> \lyxminus (U+2212)
72         /// : -> \ordinarycolon (U+2236)
73         ///
74         /// For cosmetic reasons, +, >, <, and = are also substituted to force the
75         /// use of CM fonts for uniformity. If CM fonts are replaced with unicode
76         /// math fonts, this should be removed, and substitutions of "'", ",", and
77         /// ";" added.
78         ///
79         /// Null if there is no substitute.
80         latexkeys const * const subst_;
81 };
82
83 } // namespace lyx
84
85 #endif