Changeset 7894 for trunk


Ignore:
Timestamp:
08/20/06 12:10:58 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7888 r7894  
    1818
    1919                                                 -*-*- 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
    2031 2006/08/19 Thomas Bretz
    2132
     
    3243     mpointing/MPointingPos.cc, mbase/MEvtLoop.cc:
    3344     - 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
    3463
    3564
  • trunk/MagicSoft/Mars/macros/tutorials/calendar.C

    r7890 r7894  
    141141        c.cd();
    142142
     143        // "comic" is the ttf-font name. You find other ones typically
     144        // in $ROOTSYS/fonts or /usr/X11R6/lib/X11/fonts/truetype
    143145        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");
    145147        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");
    147149
    148150
  • 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.