Friday, November 16, 2018

Fancy ROOT

TAttText

Text Alignment

The text alignment is an integer number (align) allowing to control the horizontal and vertical position of the text string with respect to the text position. The text alignment of any class inheriting from TAttText can be changed using the method SetTextAlign and retrieved using the method GetTextAlign.
align = 10*HorizontalAlign + VerticalAlign
For horizontal alignment the following convention applies:
1=left adjusted, 2=centered, 3=right adjusted
For vertical alignment the following convention applies:
1=bottom adjusted, 2=centered, 3=top adjusted
For example:
align = 11 = left adjusted and bottom adjusted
align = 32 = right adjusted and vertically centered
pict1_TAttText_001.png

color

The text color is a color index (integer) pointing in the ROOT color table. The text color of any class inheriting from TAttText can be changed using the method SetTextColor and retrieved using the method GetTextColor. The following table shows the first 50 default colors.
pict1_TAttText_003.png

Text Size

If the text precision (see next paragraph) is smaller than 3, the text size (textsize) is a fraction of the current pad size. Therefore the same textsize value can generate text outputs with different absolute sizes in two different pads. The text size in pixels (charheight) is computed the following way:
pad_width = gPad->XtoPixel(gPad->GetX2());
pad_height = gPad->YtoPixel(gPad->GetY1());
if (pad_width < pad_height) charheight = textsize*pad_width;
else charheight = textsize*pad_height;
If the text precision is equal to 3, the text size doesn’t depend on the pad’s dimensions. A given textsize value always generates the same absolute size. The text size (charheight) is given in pixels:
charheight = textsize;
Note that to scale fonts to the same size as the old True Type package a scale factor of 0.93376068 is apply to the text size before drawing.
The text size of any class inheriting from TAttText can be changed using the method SetTextSize and retrieved using the method GetTextSize.

Text Font

pict1_TAttText_004.png

No comments:

Post a Comment