On Sun, Feb 01, 2009 at 03:29:10AM -0800, Greg Ercolano wrote:
> >>        Fl::set_font(FL_COURIER, 
> >> "-*-courier-medium-r-*-*-18-*-*-*-*-*-*-*");
> > 
> > Wow! This is great!                               
> > 
> > Just a question, if i copy that statement on my source it render the 
> > correct face but it does not scale very well,
> > in fact it seems that it does not scale at all! :-)
> 
>       That's probably because in my example I pasted a selection
>       that included the pixel size (-18-) in the font name.
> 
>       If you change the '18' to '*' then it should wildcard
>       the size so that FLTK can control the sizes.

I was expecting this too, but on my system the size of the rendered text do not 
change, i have write this few lines 
to check this behaviour:

#include <cstdlib>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/fl_draw.H>

class mywin: public Fl_Double_Window {
public:
  mywin()
    :Fl_Double_Window(10,10,320,200)
  {

  }
  
  virtual ~mywin(){}
  
  virtual void draw(){
    fl_color(255,255,255);
    fl_rectf(0, 0,320,200);
    fl_color(0,0,0);
    fl_font(FL_COURIER,49);
    fl_draw("courier",40,40);
  }
};

int main(int argc , char** argv){
  if(argc>1){
    Fl::visual(FL_DOUBLE|FL_INDEX);
    Fl::set_font(FL_COURIER, argv[1]);
    mywin w;
    w.show();
    Fl::run();
  }
  std::exit(0);
}


if you compile this source will be possible to check of the font changes, for 
example:

./test -*-courier-medium-r-*-*-*-*-*-*-*-*-*-*

give a fixed font size even if we are forcing to draw the text with a size of 
49 but if you do:

./test courier

on my system all works fine...

 
>       Or you can probably use the more generic 'postscript' names
>       as well; 
>       I don't have a full understanding of what Fl::set_font()
>       does behind the scenes to lookup font names. Other folks here may
>       chime in with more info on that..

I will check the library source but i do think i have not enought experience to 
figure out how it works.

Bye!
C.

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to