Changeset 7894 for trunk/MagicSoft/Mars/mtools
- Timestamp:
- 08/20/06 12:10:58 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtools/MCalendar.cc
r7893 r7894 1538 1538 #define __CINT__ 1539 1539 #include <TTF.h> 1540 1541 1540 TASImage *MCalendar::DrawTTF(Float_t x1, Float_t x2, Float_t y1, Float_t y2, 1542 1541 const char *text, Float_t sz, const char *font) … … 1546 1545 return NULL; 1547 1546 1548 const Int_t size = TMath::Nint(sz*941);1547 const UInt_t size = TMath::Nint(sz*941); 1549 1548 1550 1549 TTF::SetTextFont(file); 1551 1550 TTF::SetTextSize(size); 1552 1551 1552 UInt_t wi, hi; 1553 TTF::GetTextExtent(wi, hi, (char*)text); 1554 1555 const FT_BBox &box = TTF::GetBox(); 1556 1553 1557 delete file; 1554 1558 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; 1569 1561 1570 1562 TASImage img(wi, hi); … … 1577 1569 Double_t h = gPad->PixeltoY(hi)/2; 1578 1570 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); 1581 1576 return DrawImage(img, x-w, y-h, x+w, y+h); 1582 1577 }
Note:
See TracChangeset
for help on using the changeset viewer.