25#include "../../../graf2d/mathtext/inc/mathtext.h"
26#include "../../../graf2d/mathtext/inc/mathrender.h"
56 public mathtext::math_text_renderer_t {
71 const unsigned int family,
const bool serif =
false)
const
73 static const int precision = 2;
75 if (family >= mathtext::math_text_renderer_t::
77 family <= mathtext::math_text_renderer_t::
79 const unsigned int offset = family -
80 mathtext::math_text_renderer_t::FAMILY_REGULAR;
83 ((
offset + 4) * 10 + precision);
84 }
else if (family >= mathtext::math_text_renderer_t::
86 const unsigned int offset = family -
87 mathtext::math_text_renderer_t::FAMILY_STIX_REGULAR;
88 return (
offset + 16) * 10 + precision;
95 return mathtext::math_text_renderer_t::is_cyrillic(
c) ||
96 mathtext::math_text_renderer_t::is_cjk(
c);
99 const bool serif =
false)
const
101 return (
serif ? 28 : 29) * 10 + 2;
104 inline mathtext::affine_transform_t
107 return mathtext::affine_transform_t::identity;
109 inline mathtext::affine_transform_t
112 return mathtext::affine_transform_t::identity;
130 for (i = 0; i < mathtext::math_text_renderer_t::NFAMILY; i++)
_current_font_size[i] = 0;
138 point(
const float ,
const float )
override
189 const float x,
const float y)
const
223 rectangle(
const mathtext::bounding_box_t &)
override
226 inline mathtext::bounding_box_t
228 const unsigned int family)
259 const mathtext::bounding_box_t
ret =
260 mathtext::bounding_box_t(
270 inline mathtext::bounding_box_t
277 return mathtext::bounding_box_t(0, 0, 0, 0, 0, 0);
280 std::wstring::const_iterator iterator =
string.begin();
282 mathtext::bounding_box_t
ret =
286 for (; iterator !=
string.end(); ++iterator) {
287 const mathtext::point_t position =
298 const std::wstring
string,
309 for (std::wstring::const_iterator iterator =
string.begin(); iterator !=
string.end(); ++iterator) {
318 const mathtext::bounding_box_t
b =
335 const unsigned int )
override
338 using mathtext::math_text_renderer_t::bounding_box;
385 TAttFill::operator=(
rhs);
398 delete tgt.fRenderer;
411 const mathtext::math_text_t
math_text(t);
424 const mathtext::math_text_t
math_text(t);
436 x0 = std::min(std::min(
x[0],
x[1]), std::min(
x[2],
x[3]));
437 y0 = std::min(std::min(
y[0],
y[1]), std::min(
y[2],
y[3]));
438 x1 = std::max(std::max(
x[0],
x[1]), std::max(
x[2],
x[3]));
439 y1 = std::max(std::max(
y[0],
y[1]), std::max(
y[2],
y[3]));
450 const mathtext::math_text_t
math_text(t);
461 case 0:
x = bounding_box.left();
break;
462 case 1:
x = 0;
break;
463 case 2:
x = bounding_box.horizontal_center();
break;
464 case 3:
x = bounding_box.right();
break;
467 case 0:
y = bounding_box.bottom();
break;
468 case 1:
y = 0;
break;
469 case 2:
y = bounding_box.vertical_center();
break;
470 case 3:
y = bounding_box.top();
break;
588 if (
gPad->IsBatch()) {
616 if (
newText.Length() == 0)
return;
619 newText.ReplaceAll(
"\\omicron",
"o");
620 newText.ReplaceAll(
"\\Alpha",
"A");
621 newText.ReplaceAll(
"\\Beta",
"B");
622 newText.ReplaceAll(
"\\Epsilon",
"E");
623 newText.ReplaceAll(
"\\Zeta",
"Z");
624 newText.ReplaceAll(
"\\Eta",
"H");
625 newText.ReplaceAll(
"\\Iota",
"I");
626 newText.ReplaceAll(
"\\Kappa",
"K");
627 newText.ReplaceAll(
"\\Mu",
"M");
628 newText.ReplaceAll(
"\\Nu",
"N");
629 newText.ReplaceAll(
"\\Omicron",
"O");
630 newText.ReplaceAll(
"\\Rho",
"P");
631 newText.ReplaceAll(
"\\Tau",
"T");
632 newText.ReplaceAll(
"\\Chi",
"X");
633 newText.ReplaceAll(
"\\varomega",
"\\varpi");
634 newText.ReplaceAll(
"\\mbox",
"\\hbox");
635 newText.ReplaceAll(
"\\bar",
"\\wwbar");
636 if (
newText.Contains(
"\\frac")) {
639 while (
newText.Contains(
"\\frac")) {
643 i2 = str.Index(
"}{");
648 if (
newText.Contains(
"\\splitline")) {
651 while (
newText.Contains(
"\\splitline")) {
655 i2 = str.Index(
"}{");
679 const char quote =
'"';
684 out <<
" TMathText *";
691 out <<
"mathtex = new TMathText("<<
fX <<
"," <<
fY <<
","
694 out <<
"mathtex->SetNDC();" << std::endl;
700 out<<
" mathtex->Draw();" << std::endl;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t SetFillStyle
Option_t Option_t SetTextSize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t SetTextFont
Option_t Option_t TPoint TPoint angle
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TVirtualPS * gVirtualPS
Fill Area Attributes class.
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
virtual void Modify()
Change current fill area attributes if necessary.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
virtual Float_t GetTextSize() const
Return the text size.
virtual void Modify()
Change current text attributes if necessary.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Color_t fTextColor
Text color.
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual Float_t GetTextAngle() const
Return the text angle.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Font_t fTextFont
Text font.
virtual void SaveTextAttributes(std::ostream &out, const char *name, Int_t alidef=12, Float_t angdef=0, Int_t coldef=1, Int_t fondef=61, Float_t sizdef=1)
Save text attributes as C++ statement(s) on output stream out.
virtual Float_t GetTextSizePercent(Float_t size)
Return the text in percent of the pad size.
Short_t fTextAlign
Text alignment.
void Copy(TAttText &atttext) const
Copy this text attributes to a new TAttText.
void set_font_size(const float size, const unsigned int family) override
float _current_font_size[mathtext::math_text_renderer_t::NFAMILY]
void text_raw(const float x, const float y, const std::wstring string, const unsigned int family=FAMILY_PLAIN) override
void text_with_bounding_box(const float, const float, const std::wstring, const unsigned int) override
float _pad_pixel_transform[6]
float _pad_scale_x_relative
TMathTextRenderer(TMathText *parent)
float font_size(const unsigned int family=FAMILY_PLAIN) const override
mathtext::affine_transform_t transform_pixel_to_logical(void) const override
size_t root_cjk_face_number(const bool serif=false) const
bool is_cyrillic_or_cjk(const wchar_t c) const
size_t root_face_number(const unsigned int family, const bool serif=false) const
mathtext::bounding_box_t bounding_box(const wchar_t character, float ¤t_x, const unsigned int family)
void reset_font_size(const unsigned int) override
void point(const float, const float) override
void rectangle(const mathtext::bounding_box_t &) override
void transform_pad(double &xt, double &yt, const float x, const float y) const
void set_parameter(const float x, const float y, const float size, const float angle_degree)
mathtext::affine_transform_t transform_logical_to_pixel(void) const override
float _pad_scale_y_relative
void filled_rectangle(const mathtext::bounding_box_t &bounding_box_0) override
To draw TeX Mathematical Formula.
friend class TMathTextRenderer
void Paint(Option_t *option="") override
Paint text.
Double_t GetYsize()
Get Y size.
TMathText & operator=(const TMathText &)
TMathText Painter.
void GetSize(Double_t &x0, Double_t &y0, Double_t &x1, Double_t &y1, const Double_t size, const Double_t angle, const Char_t *t, const Int_t length)
Get the text bounding box.
void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE) override
Get the text width and height.
TMathTextRenderer * fRenderer
Double_t GetXsize()
Get X size.
void GetAlignPoint(Double_t &x0, Double_t &y0, const Double_t size, const Double_t angle, const Char_t *t, const Int_t length, const Short_t align)
Alignment.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
void Render(const Double_t x, const Double_t y, const Double_t size, const Double_t angle, const Char_t *t, const Int_t length)
Render the text.
~TMathText() override
Destructor.
TMathText * DrawMathText(Double_t x, Double_t y, const char *text)
Make a copy of this object with the new parameters and copy object attributes.
TMathText()
Default constructor.
virtual void PaintMathText(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Paint text (used by Paint()).
void Copy(TObject &text) const override
Copy.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
@ kCanDelete
if object in a list can be deleted
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static FT_Face fgFace[kTTMaxFonts]
font face
static void SetTextFont(Font_t fontnumber)
Set specified font.
static Int_t fgCurFontIdx
current font index
Base class for several text objects.
Double_t fY
Y position of text (left,center,etc..)
void Copy(TObject &text) const override
Copy this text to text.
TText & operator=(const TText &src)
Assignment operator.
Double_t fX
X position of text (left,center,etc..)
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.