16 # include <ft2build.h>
17 # include FT_FREETYPE_H
101 ((
TText&)text).Copy(*
this);
114 *
reinterpret_cast<std::wstring *
>(
fWcsTitle) =
115 *reinterpret_cast<std::wstring *>(((
TText&)obj).fWcsTitle);
118 new std::wstring(*reinterpret_cast<std::wstring *>(
119 dynamic_cast<TText &>(obj).fWcsTitle));
129 return reinterpret_cast<std::wstring *
>(
fWcsTitle)->c_str();
155 Int_t cBoxX[5], cBoxY[5];
224 static Int_t px1, py1, pxold, pyold,
Size, height, width;
225 static Bool_t resize,turn;
228 Int_t len = strlen(text);
236 static Bool_t right, ndcsav;
238 Int_t ax, ay, bx, by, cx, cy;
242 Int_t cBoxX[4], cBoxY[4], part;
246 if (!
gPad->IsEditable())
return;
271 div = ((cBoxX[3]-cBoxX[0])*co-(cBoxY[3]-cBoxY[0])*
si);
272 if (
TMath::Abs(div) > 1e-8) part = (
Int_t)(3*((px-cBoxX[0])*co-(py-cBoxY[0])*
si)/ div);
312 if (dtheta<0) theta = -theta;
314 if (theta<0) theta += 360;
315 if (right) {theta = theta+180;
if (theta>=360) theta -= 360;}
323 case 1 : ax = px1; ay = py1;
break;
324 case 2 : ax = px1+
Int_t(si*h/2); ay = py1+
Int_t(co*h/2);
break;
325 case 3 : ax = px1+
Int_t(si*h*3/2); ay = py1+
Int_t(co*h*3/2);
break;
330 case 1 : ax = px1-
Int_t(co*w/2); ay = py1+
Int_t(si*w/2);
break;
331 case 2 : ax = px1-
Int_t(co*w/2+si*h/2); ay = py1+
Int_t(si*w/2+co*h/2);
break;
332 case 3 : ax = px1-
Int_t(co*w/2+si*h*3/2); ay = py1+
Int_t(si*w/2+co*h*3/2);
break;
337 case 1 : ax = px1-
Int_t(co*w); ay = py1+
Int_t(si*w);
break;
338 case 2 : ax = px1-
Int_t(co*w+si*h/2); ay = py1+
Int_t(si*w+co*h/2);
break;
339 case 3 : ax = px1-
Int_t(co*w+si*h*3/2); ay = py1+
Int_t(si*w+co*h*3/2);
break;
342 if (height == 3) {bx = ax-
Int_t(si*h); by = ay-
Int_t(co*h);}
343 else {bx = ax; by = ay;}
345 lambda =
Double_t(((px-bx)*(cx-bx)+(py-by)*(cy-by)))/
Double_t(((cx-bx)*(cx-bx)+(cy-by)*(cy-by)));
349 if (Size<4) Size = 4;
354 dx = px - pxold; px1 += dx;
355 dy = py - pyold; py1 += dy;
361 if (resize)
gPad->ShowGuidelines(
this, event,
't',
false);
362 if ((!resize)&&(!turn))
gPad->ShowGuidelines(
this, event,
'i',
true);
363 gPad->ShowGuidelines(
this, event, !resize&!turn);
369 pxold = px; pyold = py;
379 gPad->ShowGuidelines(
this, event, !resize&!turn);
382 dpx =
gPad->GetX2() -
gPad->GetX1();
383 dpy =
gPad->GetY2() -
gPad->GetY1();
386 fX = (
gPad->AbsPixeltoX(px1)-xp1)/dpx;
387 fY = (
gPad->AbsPixeltoY(py1)-yp1)/dpy;
402 event =
gVirtualX->RequestLocator(1, 1, px, py);
431 case 1 : Dx = 0 ;
break;
432 case 2 : Dx = cBoxW/2;
break;
433 case 3 : Dx = cBoxW ;
break;
436 case 1 : Dy = 0 ;
break;
437 case 2 : Dy = cBoxH/2;
break;
438 case 3 : Dy = cBoxH ;
break;
445 cBoxY[1] = y-cBoxH+Dy;
446 cBoxX[2] = x+cBoxW-Dx;
447 cBoxY[2] = y-cBoxH+Dy;
448 cBoxX[3] = x+cBoxW-Dx;
455 for (
int i=0; i<4 ; i++) {
456 Int_t hcBoxX = cBoxX[i];
457 Int_t hcBoxY = cBoxY[i];
458 cBoxX[i] = (
Int_t)((hcBoxX-x)*cosTheta-(hcBoxY-
y)*sinTheta+x);
459 cBoxY[i] = (
Int_t)((hcBoxX-x)*sinTheta+(hcBoxY-
y)*cosTheta+y);
478 Int_t cBoxX[4], cBoxY[4];
492 for (
Int_t i=1; i<4; i++) {
493 if (cBoxX[i] < x1) x1 = cBoxX[i];
494 if (cBoxX[i] > x2) x2 = cBoxX[i];
495 if (cBoxY[i] < y1) y1 = cBoxY[i];
496 if (cBoxY[i] > y2) y2 = cBoxY[i];
540 gVirtualX->GetTextExtent(w, a, (
char*)text);
572 gVirtualX->GetTextExtent(w, a, (
wchar_t*)text);
600 gVirtualX->GetTextExtent(w, h, (
char*)text);
634 gVirtualX->GetTextExtent(a, h, (
char*)text);
660 gVirtualX->GetTextExtent(w, h, (
wchar_t*)text);
689 Int_t cBoxX[4], cBoxY[4];
698 gVirtualX->DrawLine(cBoxX[0], cBoxY[0], cBoxX[1], cBoxY[1]);
699 gVirtualX->DrawLine(cBoxX[1], cBoxY[1], cBoxX[2], cBoxY[2]);
700 gVirtualX->DrawLine(cBoxX[2], cBoxY[2], cBoxX[3], cBoxY[3]);
701 gVirtualX->DrawLine(cBoxX[3], cBoxY[3], cBoxX[0], cBoxY[0]);
705 Int_t ix = 0, iy = 0;
709 case 1 : ix = 0 ; iy = 0 ;
break;
710 case 2 : ix = 0 ; iy = 1 ;
break;
711 case 3 : ix = 1 ; iy = 1 ;
break;
716 case 1 : ix = 0 ; iy = 3 ;
break;
717 case 2 : ix = 0 ; iy = 2 ;
break;
718 case 3 : ix = 1 ; iy = 2 ;
break;
723 case 1 : ix = 3 ; iy = 3 ;
break;
724 case 2 : ix = 2 ; iy = 3 ;
break;
725 case 3 : ix = 2 ; iy = 2 ;
break;
729 p.
fX = (cBoxX[ix]+cBoxX[iy])/2;
730 p.
fY = (cBoxY[ix]+cBoxY[iy])/2;
743 gPad->PaintText(x,y,text);
752 gPad->PaintText(x,y,text);
761 gPad->PaintTextNDC(u,v,text);
770 gPad->PaintTextNDC(u,v,text);
798 out<<
"text = new TText("<<
fX<<
","<<
fY<<
","<<quote<<s.
Data()<<quote<<
");"<<std::endl;
803 out<<
" text->Draw();"<<std::endl;
820 char *mb_title =
new char[MB_CUR_MAX * wcslen(title) + 1]();
822 size_t length = wcslen(title);
823 for (
size_t i = 0; i <
length; i++) {
824 const int n = wctomb(p, title[i]);
835 void TText::Streamer(
TBuffer &R__b)
845 TNamed::Streamer(R__b);
846 TAttText::Streamer(R__b);
870 case 1 : Dx = 0 ;
break;
871 case 2 : Dx = w/2 ;
break;
872 case 3 : Dx = w ;
break;
875 case 1 : Dy =
h ;
break;
876 case 2 : Dy = h/2 ;
break;
877 case 3 : Dy = 0 ;
break;
virtual const char * GetTitle() const
Returns title of object.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual Float_t GetTextAngle() const
virtual Font_t GetTextFont() const
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the point given by Alignment as 'center'.
void Copy(TAttText &atttext) const
Copy this text attributes to a new TAttText.
virtual void SetMbTitle(const wchar_t *title=L"")
Change (i.e. set) the title of the TNamed.
virtual void SetX(Double_t x)
TString & ReplaceAll(const TString &s1, const TString &s2)
static Bool_t IsInitialized()
virtual void SetName(const char *name)
Change (i.e.
Buffer base class used for serializing objects.
virtual Float_t GetTextSize() const
virtual void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t cBoxX[4], Int_t cBoxY[4])
Return the text control box.
virtual void Paint(Option_t *option="")
Paint this text with its current attributes.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual void PaintTextNDC(Double_t u, Double_t v, const char *text)
Draw this text with new coordinates in NDC.
virtual ~TText()
Text default destructor.
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual void Modify()
Change current text attributes if necessary.
const char * Data() const
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
static const double x2[5]
virtual Short_t GetTextAlign() const
virtual TPoint GetBBoxCenter()
Return the point given by Alignment as 'center'.
virtual void Print(Option_t *option="") const
Dump this text with its attributes.
static void SetTextFont(Font_t fontnumber)
Set specified font.
The TNamed class is the base class for all named ROOT classes.
static void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Get width (w) and height (h) when text is horizontal.
virtual TText * DrawTextNDC(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates in NDC.
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const
Return text ascent and descent for string text.
virtual Color_t GetTextColor() const
virtual void PaintControlBox(Int_t x, Int_t y, Double_t theta)
Paint the text control box.
virtual void Copy(TObject &named) const
Copy this to obj.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a string.
virtual void ls(Option_t *option="") const
List this text with its attributes.
Base class for several text objects.
static void GetTextAdvance(UInt_t &a, char *text)
Get advance (a) when text is horizontal.
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Double_t length(const TVector2 &v)
virtual Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
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.
void Copy(TObject &text) const
Copy this text to text.
static Bool_t GetKerning()
virtual void SetTextAngle(Float_t tangle=0)
Bool_t TestBit(UInt_t f) const
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
Return text extent for string text.
static void SetKerning(Bool_t state)
Set kerning flag.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
static const double x1[5]
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Mother of all ROOT objects.
virtual void SetBBoxCenter(const TPoint &p)
Set the point given by Alignment as 'center'.
Abstract base class for elements drawn in the editor.
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the point given by Alignment as 'center'.
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
ClassImp(TSlaveInfo) Int_t TSlaveInfo const TSlaveInfo * si
Used to sort slaveinfos by ordinal.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
static void SetTextSize(Float_t textsize)
Set current text size.
virtual void SetY(Double_t y)
virtual void GetTextAdvance(UInt_t &a, const char *text, const Bool_t kern=kTRUE) const
Return text advance for string text if kern is true (default) kerning is taken into account...
Double_t Sqrt(Double_t x)
virtual void SetTextSize(Float_t tsize=1)
double norm(double *x, double *p)
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
static const FT_BBox & GetBox()
virtual void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
Return text size in pixels.
const void * GetWcsTitle(void) const
Returns the text as UNICODE.