mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 19:59:46 +00:00
2e1863b704
This is a follow-up to758de957
. - unify the metrics and drawing of \sqrt and \root using helper functions mathed_root_metrics and mathed_draw_root. - compute the vertical spacing above the nucleus of the root following rule 11 of the TeXbook. In particular, it is different in inline and display style. - draw the root glyph without hard-coded pixel values. Make the line width depend on the zoom. more work is needed to implement properly rule 11: - Ideally, we should use sqrt glyphs from the math fonts. Note that then we would get rule thickness from there. - The positioning of the root MathData is arbitrary. It should follow the definition of \root...\of... in The Texbook in Apprendix B page 360. Fixes bug #10814. (cherry picked from commit16af6e7c50
) (cherry picked from commit6cb6f78ae9
)
66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file InsetMathRoot.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Alejandro Aguilar Sierra
|
|
* \author André Pönitz
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef MATH_ROOT_H
|
|
#define MATH_ROOT_H
|
|
|
|
#include "InsetMathNest.h"
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
/// The general n-th root inset.
|
|
class InsetMathRoot : public InsetMathNest {
|
|
public:
|
|
///
|
|
InsetMathRoot(Buffer * buf);
|
|
///
|
|
bool idxUpDown(Cursor & cur, bool up) const;
|
|
///
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
|
///
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
|
|
|
///
|
|
void write(WriteStream & os) const;
|
|
///
|
|
void normalize(NormalStream &) const;
|
|
///
|
|
void mathmlize(MathStream &) const;
|
|
///
|
|
void htmlize(HtmlStream &) const;
|
|
///
|
|
void maple(MapleStream &) const;
|
|
///
|
|
void mathematica(MathematicaStream &) const;
|
|
///
|
|
void octave(OctaveStream &) const;
|
|
///
|
|
InsetCode lyxCode() const { return MATH_ROOT_CODE; }
|
|
///
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
private:
|
|
virtual Inset * clone() const;
|
|
};
|
|
|
|
void mathed_root_metrics(MetricsInfo & mi, MathData const & nucleus,
|
|
MathData const * root, Dimension & dim);
|
|
|
|
void mathed_draw_root(PainterInfo & pi, int x, int y, MathData const & nucleus,
|
|
MathData const * root, Dimension const & dim);
|
|
|
|
|
|
} // namespace lyx
|
|
#endif
|