Re: [ROOT] Different color palettes within one canvas

From: Valeri Fine (fine@bnl.gov)
Date: Thu May 10 2001 - 19:28:15 MEST


> Hi Valeri,
>
> On Wed, 9 May 2001 20:31:52 -0400
> "Valeri Fine" <fine@bnl.gov> wrote
> concerning ": Re: [ROOT] Different color palettes within one canvas":
> > What about
> >
> > http://root.cern.ch/root/htmldoc/TColor.html
> >
> > It seems to me one can use it to define color either way you described.
>
> Ok, I overlooked that one.  However, it would  nice if one could use
> RGB and/or CMYK directly in the various Set...Color
>
>    TH1D*   myHist  = new TH1D("myHist", "myHist", 100, 0, 10);
>    myHist->SetLineColor(.123, .456, .789);
>
> rather than having to do
>
>    TColor* myColor = new TColor(10000, .123, .456, .789, "myColor");
>    TH1D*   myHist  = new TH1D("myHist", "myHist", 100, 0, 10);
>    myHist->SetLineColor(1000);
>
> I guess it's a trick of looking up to see if there's a TColor already
> with that definition, and if not make one.

Even with small integer the problem can be solved by introducing
so-called "safe color schema". That  is now de-facto standard for all Web
browsers.


http://members.tripod.com/footinweb/tools.htm
http://the-light.com/netcol.html
http://the-light.com/colclick.html


On another hand one can image the pointer to TColor object rather index of
TColor object within
the global  ROOT  TColor table or event better Color_t class

     class Color_t

        private:
             short fSafeRGBValue:
      public:
              . . .
     }

  rather:
         typedef  short     Color_t;

>
> > Windows maps X11 fonts to Windows fonts as follows:
> >
/___________________________________________________________________________
___
> > void  TGWin32::SetTextFont(Font_t fontnumber)
> > {
> > /*-*-*-*-*-*-*-*-*-*-*-*-*Set current text font
number*-*-*-*-*-*-*-*-*-*-*-*
> > /*-*                      ===========================
> >
> >   fTextFont = fontnumber;
> >
> > /*-*  List of the currently supported fonts (screen and PostScript)
> > /*-*  =============================================================
> > /*-*   Font ID       X11                       Win32 TTF       lfItalic
lfWeight x 10
> > /*-*        1 : times-medium-i-normal      "Times New Roman"      1
4
>
> Ok, so Windoze expects a string and two intergers.  The issue then, is
> to translate font specifications of the form

  No it is not correct. The lines above define the font type and some
properties.
  They do not define the glyph size for example. Since Windows fonts are
always (almost)
  TTF its size can be defined separately with no problem.

   The method above is done to match the ROOT interface. Then Win32
implementation of TVirtaulX calls:

void  TGWin32::SetTextFont(char *fontname, int italic, int bold){

/*-*    mode              : Option message
/*-*    italic   : Italic attribut of the TTF font
/*-*    bold     : Weight attribute of the TTF font
/*-*    fontname : the name of True Type Font (TTF) to draw text.
/*-*
/*-*    Set text font to specified name. This function returns 0 if
/*-*    the specified font is found, 1 if not.

   fROOTFont.lfItalic = (BYTE) italic;
   fROOTFont.lfWeight = (LONG) bold*100;
   fROOTFont.lfHeight = (LONG)(fTextSize*1.1);    /mode[2]*1.1; // To
account "tail"
 //  fROOTFont.lfWidth  = (LONG) mode[2]*1.2
   fROOTFont.lfEscapement   = (LONG) fTextAngle*10; /(LONG)mode[3];
   fROOTFont.lfOutPrecision = 0;    // (LONG)mode[4];
   strcpy(fROOTFont.lfFaceName,fontname);

   fTextFontModified = 1;
//   SetWin32Font();
}

 to set WIN32 TTF font.
The rest members of the font-structure provided "by default" can be
customized as well
just one provides the proper interface via TVirtualX base class.

   Valeri

>
>   -<foundry>-<family>-<weigth>-<slant>-<set width>-<add style>-<pixel
size>-<point size>-<resolution x>-<resolution y>-<spacing>-<average
width>-<character set>
>
> into a string and two intergers, in some generic way perferably.
> Limiting ROOT to only use 5 fonts I believe is a shame.  Therefore, if
> one could specify a font as
>
>    TTextAttr::SetFont(const char* foundry,
>       const char* family,
>                       const char* weight,
>                       char        slant,
>       const char* set_width,
>       const char* add_style,
>                       int         pixel_size,
>                       int         point_size,
>                       int         resolution_x,
>                       int         resolution_y,
>                       char        spacing,
>                       int         average_width,
>       const char* charactre_set);
>
> and at least when using X, ask the font server to give back the right
> one.  For Windoze, I guess you can ask Windoze font server(?) for the
> font, based on the <family>, <slant> and <weight> only.
>
> It should be noted, that
>
>      times-medium-i-normal
>
> is really an alias in the X font server for something like
>
>      -*-times-medium-i-normal-*-*-*-*-*-*-*-*
>
> If you were able to specify fonts like I suggest, then you could use
> what ever font you may have on the system (ofcourse they may not be
> avaliable on your collaborators machines, but that's really your
> problem, not ROOTs).  For example, I have some 200 fonts avaliable
> from my X font server, and while I will never use all of them, it
> would be nice to use more then 5 :-)
>
> Uh, it still seems odd to me that the regular X fonts does not scale
> well in the Canvas.  I mean, looking at any other application, there
> seems to be no reason why you can't get them to scale better.  I
> haven't looked in the ROOT source code, so I'm just babling along
> uninformed, and ignorant of any problems there might be.
>
> Yours,
>
> Christian  -----------------------------------------------------------
> Holm Christensen                             Phone:  (+45) 35 35 96 91
>   Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305
>   DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm
>   Denmark                                    Email:       cholm@nbi.dk
>
>
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:45 MET