Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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#include "TGX11.h"
17
18#include "RConfigure.h"
19
20#ifdef R__HAS_XFT
21class TXftFontHash;
22#endif
23
24class TGX11TTF : public TGX11 {
25
26private:
27#ifdef R__HAS_XFT
28 TXftFontHash *fXftFontHash; ///< hash table for Xft fonts
29 static Bool_t gXftInit; ///< does xft was initialized
30#endif
31
32 void DrawFTGlyph(void *source, ULong_t fore, ULong_t back, RXImage *xim,
33 Int_t bx, Int_t by);
35
36 template<class CharType>
37 void DrawTextHelper(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn,
38 const CharType *text, ETextMode mode);
39
40public:
41 TGX11TTF(TGX11 &&org);
42 ~TGX11TTF() override { }
43
44 Bool_t Init(void *display) override;
45
46 void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn,
47 const char *text, ETextMode mode) override;
48 void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn,
49 const wchar_t *text, ETextMode mode) override;
50
51#ifdef R__HAS_XFT
52 //---- Methods used text/fonts handling via Xft -----
53 //void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n);
54 FontStruct_t LoadQueryFont(const char *font_name) override;
55 void DeleteFont(FontStruct_t fs) override;
56 void DeleteGC(GContext_t gc) override;
57 void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len) override;
58 Int_t TextWidth(FontStruct_t font, const char *s, Int_t len) override;
59 void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override;
62 void MapGCFont(GContext_t gc, FontStruct_t font) override;
63#endif
64
65 static void Activate();
66
67 ClassDefOverride(TGX11TTF,0) //Interface to X11 + TTF font handling
68};
69
70#endif
Handle_t WinContext_t
Window drawing context.
Definition GuiTypes.h:30
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index).
Definition GuiTypes.h:36
Handle_t Drawable_t
Drawable handle.
Definition GuiTypes.h:32
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:39
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:40
#define h(i)
Definition RSha256.hxx:106
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
static void Activate()
Static method setting TGX11TTF as the acting gVirtualX.
Definition TGX11TTF.cxx:173
void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw text using TrueType fonts.
Definition TGX11TTF.cxx:440
Bool_t Init(void *display) override
Initialize X11 system. Returns kFALSE in case of failure.
Definition TGX11TTF.cxx:184
void DrawFTGlyph(void *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:208
TGX11TTF(TGX11 &&org)
Create copy of TGX11 but now use TrueType fonts.
Definition TGX11TTF.cxx:157
void DrawTextHelper(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const CharType *text, ETextMode mode)
Definition TGX11TTF.cxx:300
RXImage * GetBackground(WinContext_t wctxt, 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:459
~TGX11TTF() override
Definition TGX11TTF.h:42
FontStruct_t LoadQueryFont(const char *font_name) override
Load font and query font.
Definition GX11Gui.cxx:941
TGX11(TGX11 &&org)
Copy constructor. Currently only used by TGX11TTF.
Definition TGX11.cxx:259
void DeleteGC(GContext_t gc) override
Explicitly delete a graphics context.
Definition GX11Gui.cxx:1032
void DeleteFont(FontStruct_t fs) override
Explicitly delete font structure obtained with LoadQueryFont().
Definition GX11Gui.cxx:962
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len) override
Return length of string in pixels. Size depends on font.
Definition GX11Gui.cxx:2069
FontH_t GetFontHandle(FontStruct_t fs) override
Return handle to font described by font structure.
Definition GX11Gui.cxx:950
void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len) override
Draw a string using a specific graphics context in position (x,y).
Definition GX11Gui.cxx:2058
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override
Return some font properties.
Definition GX11Gui.cxx:2077
virtual FontStruct_t GetGCFont(GContext_t gc)
Return the font associated with the graphics context gc.
virtual void MapGCFont(GContext_t, FontStruct_t)
Map the XftFont with the Graphics Context using it.
TText * text
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17