- Timestamp:
- 08/20/06 12:10:58 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7888 r7894 18 18 19 19 -*-*- END OF LINE -*-*- 20 2006/08/20 Thomas Bretz 21 22 * mtools/MCalendar.cc: 23 - fixed the font-size issue (which I don't understand at all - 24 bug report submitted) 25 26 * macros/tutorials/calendar.C: 27 - changed the font name to a font supported by root 28 29 30 20 31 2006/08/19 Thomas Bretz 21 32 … … 32 43 mpointing/MPointingPos.cc, mbase/MEvtLoop.cc: 33 44 - replaced MString::Form by new function name MString::Format 45 46 * macros/tutorials/calendar.C, macros/tutorials/calendar.rc, 47 macros/tutorials/holidays.rc: 48 - added 49 50 * mtools/MCalendar.[h,cc]: 51 - added some dead code 52 - changed the default a little bit 53 - added fOrientation to allow changing the orientation 54 - added code to paint a clock for the change from summer- to 55 winter-time and vice versa 56 - removed the direct dependance on the word "Easter" to 57 display the easter holidays 58 - added the possibility to restrict the display of some contents 59 to only some week days (eg to display "KW35" only on mondays) 60 - some updated to drawing the image 61 - improved the ResetLayout and SetDefaultLayout if called from 62 the context menu 34 63 35 64 -
trunk/MagicSoft/Mars/macros/tutorials/calendar.C
r7890 r7894 141 141 c.cd(); 142 142 143 // "comic" is the ttf-font name. You find other ones typically 144 // in $ROOTSYS/fonts or /usr/X11R6/lib/X11/fonts/truetype 143 145 if (hor) 144 cal->DrawTTFDate(0.64, 0.83, 1, 1, "%B %Y", 0.072, " minynbi_");146 cal->DrawTTFDate(0.64, 0.83, 1, 1, "%B %Y", 0.072, "comic"); 145 147 else 146 cal->DrawTTFDate(0.5, 0.83, 1, 1, "%B %Y", 0.085, " minynbi_");148 cal->DrawTTFDate(0.5, 0.83, 1, 1, "%B %Y", 0.085, "comic"); 147 149 148 150 -
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.