ROOT logo
// @(#)root/x11ttf:$Id: TGX11TTF.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Olivier Couet     01/10/02
// Author: Fons Rademakers   21/11/98

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGX11TTF
#define ROOT_TGX11TTF


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGX11TTF                                                             //
//                                                                      //
// Interface to low level X11 (Xlib). This class gives access to basic  //
// X11 graphics via the parent class TGX11. However, all text and font  //
// handling is done via the Freetype TrueType library. When the         //
// shared library containing this class is loaded the global gVirtualX  //
// is redirected to point to this class.                                //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGX11
#include "TGX11.h"
#endif

#ifndef ROOT_TTF
#include "TTF.h"
#endif

#ifndef ROOT_RConfigure
#include "RConfigure.h"
#endif

#ifdef R__HAS_XFT
class TXftFontHash;
#endif


class TGX11TTF : public TGX11 {

private:
   enum EAlign { kNone, kTLeft, kTCenter, kTRight, kMLeft, kMCenter, kMRight,
                        kBLeft, kBCenter, kBRight };

   FT_Vector   fAlign;                 // alignment vector
#ifdef R__HAS_XFT
   TXftFontHash  *fXftFontHash;        // hash table for Xft fonts
#endif

   void    Align(void);
   void    DrawImage(FT_Bitmap *source, ULong_t fore, ULong_t back, XImage *xim,
                     Int_t bx, Int_t by);
   Bool_t  IsVisible(Int_t x, Int_t y, UInt_t w, UInt_t h);
   XImage *GetBackground(Int_t x, Int_t y, UInt_t w, UInt_t h);
   void    RenderString(Int_t x, Int_t y, ETextMode mode);

public:
   TGX11TTF(const TGX11 &org);
   virtual ~TGX11TTF() { }

   Bool_t Init(void *display);
   void   DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
                   const char *text, ETextMode mode);
   void   SetTextFont(Font_t fontnumber);
   Int_t  SetTextFont(char *fontname, ETextSetMode mode);
   void   SetTextSize(Float_t textsize);

#ifdef R__HAS_XFT
   //---- Methods used text/fonts handling via Xft -----
   //void         SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n);
   FontStruct_t LoadQueryFont(const char *font_name);
   void         DeleteFont(FontStruct_t fs);
   void         DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len);
   Int_t        TextWidth(FontStruct_t font, const char *s, Int_t len);
   void         GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent);
#endif

   static void  Activate();

   ClassDef(TGX11TTF,0)  //Interface to X11 + TTF font handling
};

#endif
 TGX11TTF.h:1
 TGX11TTF.h:2
 TGX11TTF.h:3
 TGX11TTF.h:4
 TGX11TTF.h:5
 TGX11TTF.h:6
 TGX11TTF.h:7
 TGX11TTF.h:8
 TGX11TTF.h:9
 TGX11TTF.h:10
 TGX11TTF.h:11
 TGX11TTF.h:12
 TGX11TTF.h:13
 TGX11TTF.h:14
 TGX11TTF.h:15
 TGX11TTF.h:16
 TGX11TTF.h:17
 TGX11TTF.h:18
 TGX11TTF.h:19
 TGX11TTF.h:20
 TGX11TTF.h:21
 TGX11TTF.h:22
 TGX11TTF.h:23
 TGX11TTF.h:24
 TGX11TTF.h:25
 TGX11TTF.h:26
 TGX11TTF.h:27
 TGX11TTF.h:28
 TGX11TTF.h:29
 TGX11TTF.h:30
 TGX11TTF.h:31
 TGX11TTF.h:32
 TGX11TTF.h:33
 TGX11TTF.h:34
 TGX11TTF.h:35
 TGX11TTF.h:36
 TGX11TTF.h:37
 TGX11TTF.h:38
 TGX11TTF.h:39
 TGX11TTF.h:40
 TGX11TTF.h:41
 TGX11TTF.h:42
 TGX11TTF.h:43
 TGX11TTF.h:44
 TGX11TTF.h:45
 TGX11TTF.h:46
 TGX11TTF.h:47
 TGX11TTF.h:48
 TGX11TTF.h:49
 TGX11TTF.h:50
 TGX11TTF.h:51
 TGX11TTF.h:52
 TGX11TTF.h:53
 TGX11TTF.h:54
 TGX11TTF.h:55
 TGX11TTF.h:56
 TGX11TTF.h:57
 TGX11TTF.h:58
 TGX11TTF.h:59
 TGX11TTF.h:60
 TGX11TTF.h:61
 TGX11TTF.h:62
 TGX11TTF.h:63
 TGX11TTF.h:64
 TGX11TTF.h:65
 TGX11TTF.h:66
 TGX11TTF.h:67
 TGX11TTF.h:68
 TGX11TTF.h:69
 TGX11TTF.h:70
 TGX11TTF.h:71
 TGX11TTF.h:72
 TGX11TTF.h:73
 TGX11TTF.h:74
 TGX11TTF.h:75
 TGX11TTF.h:76
 TGX11TTF.h:77
 TGX11TTF.h:78
 TGX11TTF.h:79
 TGX11TTF.h:80
 TGX11TTF.h:81
 TGX11TTF.h:82
 TGX11TTF.h:83
 TGX11TTF.h:84
 TGX11TTF.h:85
 TGX11TTF.h:86
 TGX11TTF.h:87
 TGX11TTF.h:88
 TGX11TTF.h:89
 TGX11TTF.h:90