Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:30:21

0001 // @(#)root/x11ttf:$Id$
0002 // Author: Olivier Couet     01/10/02
0003 // Author: Fons Rademakers   21/11/98
0004 
0005 /*************************************************************************
0006  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0007  * All rights reserved.                                                  *
0008  *                                                                       *
0009  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0010  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0011  *************************************************************************/
0012 
0013 #ifndef ROOT_TGX11TTF
0014 #define ROOT_TGX11TTF
0015 
0016 
0017 #include "TGX11.h"
0018 
0019 #include "TTF.h"
0020 
0021 #include "RConfigure.h"
0022 
0023 #ifdef R__HAS_XFT
0024 class TXftFontHash;
0025 #endif
0026 
0027 class TGX11TTF : public TGX11 {
0028 
0029 private:
0030    FT_Vector   fAlign;                 ///< alignment vector
0031 #ifdef R__HAS_XFT
0032    TXftFontHash  *fXftFontHash;        ///< hash table for Xft fonts
0033    static Bool_t  gXftInit;            ///< does xft was initialized
0034 #endif
0035 
0036    void     Align(WinContext_t wctxt);
0037    void     DrawImage(FT_Bitmap *source, ULong_t fore, ULong_t back, RXImage *xim,
0038                       Int_t bx, Int_t by);
0039    Bool_t   IsVisible(WinContext_t wctxt, Int_t x, Int_t y, UInt_t w, UInt_t h);
0040    RXImage *GetBackground(WinContext_t wctxt, Int_t x, Int_t y, UInt_t w, UInt_t h);
0041    void     RenderString(WinContext_t wctxt, Int_t x, Int_t y, ETextMode mode);
0042 
0043 public:
0044    TGX11TTF(TGX11 &&org);
0045    ~TGX11TTF() override { }
0046 
0047    Bool_t Init(void *display) override;
0048 
0049    void   DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn,
0050                    const char *text, ETextMode mode) override;
0051    void   DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn,
0052                    const wchar_t *text, ETextMode mode) override;
0053 
0054    using TGX11::SetTextFont;
0055    Int_t  SetTextFont(char *fontname, ETextSetMode mode) override;
0056 
0057    //---- Methods used for new graphics -----
0058    void  SetAttText(WinContext_t wctxt, const TAttText &att) override;
0059 
0060 
0061 #ifdef R__HAS_XFT
0062    //---- Methods used text/fonts handling via Xft -----
0063    //void         SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n);
0064    FontStruct_t LoadQueryFont(const char *font_name) override;
0065    void         DeleteFont(FontStruct_t fs) override;
0066    void         DeleteGC(GContext_t gc) override;
0067    void         DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len) override;
0068    Int_t        TextWidth(FontStruct_t font, const char *s, Int_t len) override;
0069    void         GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override;
0070    FontH_t      GetFontHandle(FontStruct_t fs) override;
0071    FontStruct_t GetGCFont(GContext_t gc) override;
0072    void         MapGCFont(GContext_t gc, FontStruct_t font) override;
0073 #endif
0074 
0075    static void  Activate();
0076 
0077    ClassDefOverride(TGX11TTF,0)  //Interface to X11 + TTF font handling
0078 };
0079 
0080 #endif