Ignore:
Timestamp:
08/20/06 12:10:58 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtools/MCalendar.cc

    r7893 r7894  
    15381538#define __CINT__
    15391539#include <TTF.h>
    1540 
    15411540TASImage *MCalendar::DrawTTF(Float_t x1, Float_t x2, Float_t y1, Float_t y2,
    15421541                             const char *text, Float_t sz, const char *font)
     
    15461545        return NULL;
    15471546
    1548     const Int_t size = TMath::Nint(sz*941);
     1547    const UInt_t size = TMath::Nint(sz*941);
    15491548
    15501549    TTF::SetTextFont(file);
    15511550    TTF::SetTextSize(size);
    15521551
     1552    UInt_t wi, hi;
     1553    TTF::GetTextExtent(wi, hi, (char*)text);
     1554
     1555    const FT_BBox &box = TTF::GetBox();
     1556
    15531557    delete file;
    15541558
    1555     UInt_t wi, hi;;
    1556     TTF::GetTextExtent(wi, hi, (char*)text);
    1557 
    1558     const FT_BBox &box = TTF::GetBox();
    1559     //cout << hi-box.yMax << " " <<   wi << " "<< (float)size/hi << endl;
    1560     //wi = wi;//TMath::Nint((float)wi*(size+hi-box.yMax)/size);
    1561     //wi += TMath::Nint(((float)size/hi-1)*wi);
    1562 
    1563     const UInt_t add = size-box.yMax;
    1564 
    1565     wi += size*(hi+add)/hi;
    1566     hi += add;
    1567     // wi += size*(hi+size-box.yMax)/hi;
    1568     // hi += size-box.yMax;
     1559    if (size>hi)
     1560        hi = size;
    15691561
    15701562    TASImage img(wi, hi);
     
    15771569    Double_t h = gPad->PixeltoY(hi)/2;
    15781570
    1579     // gROOT->GetColor(kBlack)->AsHexString()
    1580     DrawDate(img, 0, 0, text, size, "#00000000", font);
     1571    // This is the bounding box of the text
     1572    // If this box is not drawn part of the text disappears magically!
     1573    img.DrawBox(box.xMin, size, box.xMax, size-hi, "#ffffff");
     1574
     1575    DrawDate(img, 0, box.yMin, text, size, "#000000", font);
    15811576    return DrawImage(img, x-w, y-h, x+w, y+h);
    15821577}
Note: See TracChangeset for help on using the changeset viewer.