2001-08-06 06:23:09 +00:00
|
|
|
// -*- C++ -*-
|
2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
* \file InsetMathChar.h
|
2003-08-19 13:00:56 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-19 13:00:56 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2001-08-06 06:23:09 +00:00
|
|
|
#ifndef MATH_CHARINSET_H
|
|
|
|
#define MATH_CHARINSET_H
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMath.h"
|
2001-08-06 06:23:09 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2016-05-25 12:16:51 +00:00
|
|
|
class latexkeys;
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
/// The base character inset.
|
2006-09-16 18:11:38 +00:00
|
|
|
class InsetMathChar : public InsetMath {
|
2001-08-06 06:23:09 +00:00
|
|
|
public:
|
2001-08-17 09:48:24 +00:00
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
explicit InsetMathChar(char_type c);
|
2001-08-06 06:23:09 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
2001-08-06 17:20:26 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const override;
|
2001-08-06 06:23:09 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void metricsT(TextMetricsInfo const & mi, Dimension & dim) const override;
|
2002-03-19 16:55:58 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void drawT(TextPainter &, int x, int y) const override;
|
2004-02-03 11:21:08 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
int kerning(BufferView const *) const override { return kerning_; }
|
2004-02-02 17:32:56 +00:00
|
|
|
|
2002-03-19 16:55:58 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void write(WriteStream & os) const override;
|
2001-08-06 06:23:09 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void validate(LaTeXFeatures & features) const override;
|
2008-05-31 20:54:50 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void normalize(NormalStream & ns) const override;
|
2002-06-18 15:44:30 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void octave(OctaveStream & os) const override;
|
2005-07-14 22:41:59 +00:00
|
|
|
///
|
2020-12-26 19:02:46 +00:00
|
|
|
void mathmlize(MathMLStream & ms) const override;
|
2010-03-29 23:03:37 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void htmlize(HtmlStream & ms) const override;
|
2001-08-06 06:23:09 +00:00
|
|
|
/// identifies Charinsets
|
2020-10-01 07:42:11 +00:00
|
|
|
InsetMathChar const * asCharInset() const override { return this; }
|
2001-08-06 06:23:09 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
char_type getChar() const override { return char_; }
|
2001-08-09 08:53:16 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
MathClass mathClass() const override;
|
2009-07-16 19:00:24 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
InsetCode lyxCode() const override { return MATH_CHAR_CODE; }
|
2001-08-06 06:23:09 +00:00
|
|
|
|
|
|
|
private:
|
2020-10-01 07:42:11 +00:00
|
|
|
Inset * clone() const override;
|
2001-08-06 06:23:09 +00:00
|
|
|
/// the character
|
2016-05-25 12:16:51 +00:00
|
|
|
char_type const char_;
|
2007-03-21 17:21:59 +00:00
|
|
|
/// cached kerning for superscript
|
|
|
|
mutable int kerning_;
|
2016-05-25 12:16:51 +00:00
|
|
|
/// Inset to substitute char for, for on-screen display in math mode, as
|
|
|
|
/// performed by LaTeX (#9893):
|
|
|
|
/// * -> \ast (U+2217)
|
|
|
|
/// - -> \lyxminus (U+2212)
|
|
|
|
/// : -> \ordinarycolon (U+2236)
|
|
|
|
///
|
|
|
|
/// For cosmetic reasons, +, >, <, and = are also substituted to force the
|
|
|
|
/// use of CM fonts for uniformity. If CM fonts are replaced with unicode
|
|
|
|
/// math fonts, this should be removed, and substitutions of "'", ",", and
|
|
|
|
/// ";" added.
|
|
|
|
///
|
|
|
|
/// Null if there is no substitute.
|
|
|
|
latexkeys const * const subst_;
|
2001-08-06 06:23:09 +00:00
|
|
|
};
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2001-08-06 06:23:09 +00:00
|
|
|
#endif
|