Logo ROOT  
Reference Guide
TGX11TTF.h
Go to the documentation of this file.
1 // @(#)root/x11ttf:$Id$
2 // Author: Olivier Couet 01/10/02
3 // Author: Fons Rademakers 21/11/98
4 
5 /*************************************************************************
6  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
7  * All rights reserved. *
8  * *
9  * For the licensing terms see $ROOTSYS/LICENSE. *
10  * For the list of contributors see $ROOTSYS/README/CREDITS. *
11  *************************************************************************/
12 
13 #ifndef ROOT_TGX11TTF
14 #define ROOT_TGX11TTF
15 
16 
17 #include "TGX11.h"
18 
19 #include "TTF.h"
20 
21 #include "RConfigure.h"
22 
23 #ifdef R__HAS_XFT
24 class TXftFontHash;
25 #endif
26 
27 class TGX11TTF : public TGX11 {
28 
29 private:
32 
33  FT_Vector fAlign; ///< alignment vector
34 #ifdef R__HAS_XFT
35  TXftFontHash *fXftFontHash; ///< hash table for Xft fonts
36 #endif
37 
38  void Align(void);
39  void DrawImage(FT_Bitmap *source, ULong_t fore, ULong_t back, RXImage *xim,
40  Int_t bx, Int_t by);
42  RXImage *GetBackground(Int_t x, Int_t y, UInt_t w, UInt_t h);
43  void RenderString(Int_t x, Int_t y, ETextMode mode);
44 
45 public:
46  TGX11TTF(const TGX11 &org);
47  virtual ~TGX11TTF() { }
48 
49  Bool_t Init(void *display);
50  void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
51  const char *text, ETextMode mode);
52  void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
53  const wchar_t *text, ETextMode mode);
54  void SetTextFont(Font_t fontnumber);
55  Int_t SetTextFont(char *fontname, ETextSetMode mode);
56  void SetTextSize(Float_t textsize);
57 
58 #ifdef R__HAS_XFT
59  //---- Methods used text/fonts handling via Xft -----
60  //void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n);
61  FontStruct_t LoadQueryFont(const char *font_name);
62  void DeleteFont(FontStruct_t fs);
63  void DeleteGC(GContext_t gc);
64  void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len);
65  Int_t TextWidth(FontStruct_t font, const char *s, Int_t len);
66  void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent);
69  void MapGCFont(GContext_t gc, FontStruct_t font);
70 #endif
71 
72  static void Activate();
73 
74  ClassDef(TGX11TTF,0) //Interface to X11 + TTF font handling
75 };
76 
77 #endif
TGX11TTF::kTCenter
@ kTCenter
Definition: TGX11TTF.h:30
TGX11TTF::RenderString
void RenderString(Int_t x, Int_t y, ETextMode mode)
Perform the string rendering in the pad.
Definition: TGX11TTF.cxx:464
TGX11TTF::DrawText
void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode)
Draw text using TrueType fonts.
Definition: TGX11TTF.cxx:373
TGX11TTF::Activate
static void Activate()
Static method setting TGX11TTF as the acting gVirtualX.
Definition: TGX11TTF.cxx:178
TGX11::TextWidth
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len)
Return length of string in pixels. Size depends on font.
Definition: GX11Gui.cxx:2081
TGX11TTF::DrawImage
void DrawImage(FT_Bitmap *source, ULong_t fore, ULong_t back, RXImage *xim, Int_t bx, Int_t by)
Draw FT_Bitmap bitmap to xim image at position bx,by using specified foreground color.
Definition: TGX11TTF.cxx:250
TGX11TTF::kBCenter
@ kBCenter
Definition: TGX11TTF.h:31
TGX11TTF::SetTextFont
void SetTextFont(Font_t fontnumber)
Set specified font.
Definition: TGX11TTF.cxx:554
FontH_t
Handle_t FontH_t
Definition: GuiTypes.h:34
TVirtualX::MapGCFont
virtual void MapGCFont(GContext_t, FontStruct_t)
Map the XftFont with the Graphics Context using it.
Definition: TVirtualX.cxx:2504
TGX11
This class is the basic interface to the X11 (Xlib) graphics system.
Definition: TGX11.h:83
FontStruct_t
Handle_t FontStruct_t
Definition: GuiTypes.h:38
TGX11TTF::TGX11TTF
TGX11TTF(const TGX11 &org)
Create copy of TGX11 but now use TrueType fonts.
Definition: TGX11TTF.cxx:158
TVirtualX::ETextSetMode
ETextSetMode
Definition: TVirtualX.h:52
TGX11::DeleteFont
void DeleteFont(FontStruct_t fs)
Explicitly delete font structure obtained with LoadQueryFont().
Definition: GX11Gui.cxx:977
Float_t
float Float_t
Definition: RtypesCore.h:57
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
Int_t
int Int_t
Definition: RtypesCore.h:45
Font_t
short Font_t
Definition: RtypesCore.h:79
x
Double_t x[n]
Definition: legend1.C:17
TGX11TTF::Init
Bool_t Init(void *display)
Initialize X11 system. Returns kFALSE in case of failure.
Definition: TGX11TTF.cxx:190
TGX11TTF::kTRight
@ kTRight
Definition: TGX11TTF.h:30
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGX11TTF::Align
void Align(void)
Compute alignment variables.
Definition: TGX11TTF.cxx:219
text
TText * text
Definition: entrylist_figure1.C:10
TVirtualX::GetGCFont
virtual FontStruct_t GetGCFont(GContext_t gc)
Return the font associated with the graphics context gc.
Definition: TVirtualX.cxx:1844
TGX11.h
bool
TGX11TTF::kBRight
@ kBRight
Definition: TGX11TTF.h:31
Drawable_t
Handle_t Drawable_t
Definition: GuiTypes.h:30
GContext_t
Handle_t GContext_t
Definition: GuiTypes.h:37
TGX11::DrawString
void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len)
Draw a string using a specific graphics context in position (x,y).
Definition: GX11Gui.cxx:2070
TGX11TTF::kMLeft
@ kMLeft
Definition: TGX11TTF.h:30
TGX11::LoadQueryFont
FontStruct_t LoadQueryFont(const char *font_name)
Load font and query font.
Definition: GX11Gui.cxx:956
TTF.h
TGX11TTF::EAlign
EAlign
Definition: TGX11TTF.h:30
h
#define h(i)
Definition: RSha256.hxx:106
TGX11TTF::kNone
@ kNone
Definition: TGX11TTF.h:30
TGX11::GetFontHandle
FontH_t GetFontHandle(FontStruct_t fs)
Return handle to font described by font structure.
Definition: GX11Gui.cxx:965
TGX11TTF::GetBackground
RXImage * GetBackground(Int_t x, Int_t y, UInt_t w, UInt_t h)
Get the background of the current window in an XImage.
Definition: TGX11TTF.cxx:410
TGX11TTF::kBLeft
@ kBLeft
Definition: TGX11TTF.h:31
y
Double_t y[n]
Definition: legend1.C:17
org
#define org(otri, vertexptr)
Definition: triangle.c:1037
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGX11::DeleteGC
void DeleteGC(GContext_t gc)
Explicitly delete a graphics context.
Definition: GX11Gui.cxx:1047
unsigned int
TGX11::GetFontProperties
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Return some font properties.
Definition: GX11Gui.cxx:2089
TGX11TTF::~TGX11TTF
virtual ~TGX11TTF()
Definition: TGX11TTF.h:47
TGX11TTF::SetTextSize
void SetTextSize(Float_t textsize)
Set current text size.
Definition: TGX11TTF.cxx:586
TGX11TTF::kTLeft
@ kTLeft
Definition: TGX11TTF.h:30
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGX11TTF::kMCenter
@ kMCenter
Definition: TGX11TTF.h:30
TGX11TTF::kMRight
@ kMRight
Definition: TGX11TTF.h:30
TGX11TTF
Interface to low level X11 (Xlib).
Definition: TGX11TTF.h:27
TGX11TTF::fAlign
FT_Vector fAlign
alignment vector
Definition: TGX11TTF.h:33
TVirtualX::ETextMode
ETextMode
Definition: TVirtualX.h:51
int
TGX11TTF::IsVisible
Bool_t IsVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
Test if there is really something to render.
Definition: TGX11TTF.cxx:436