> > corvid wrote:
> > > Version: 1.3-current
> > > 
> > > Shouldn't fl_draw.cxx:308 test for draw_symbols, or do I 
> misunderstand
> > > what's going on?
> > > 
> > > I have a string of the form "first @second third" that is 
> wrapped inside a
> > > bounding box so that each word is on a separate line, and 
> only the first
> > > line is drawn.
> > 
> > Please bring this discussion over to fltk-general, and 
> bring a minimal
> > worked example, so we can investigate what's going on. Also post the
> > example code here for reference, perhaps?
> 
> I don't use fltk outside of the context of dillo, so I can 
> take something like
> fl_draw("aaaaaa @bbbbbb cccccc", 0, 0, 80, 80, 
> FL_ALIGN_TOP_LEFT|FL_ALIGN_WRAP,
>         0, 0);
> and...fail to get a minimal example to display text at all 
> because I don't
> know exactly what it needs to be clothed in.


OK - here (assuming Outlook does not trash it, as it usually does) is a
simple test harness I think we can use to discuss your problem.

Can you play with the options and then let us know where the problem
lies?

FWIW, in my testing I think there is a bug, but I'm not going to lay
that out until we see what others think, in case I bias the results!

/***********************************************************/
// compile as:
// fltk-config --compile draw_test.cxx
//
#include <string.h>
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
#include <FL/fl_draw.H>

static Fl_Double_Window *main_win;

/***********************************************************/
class tst_box : public Fl_Box {
protected:
  void draw(void);
  const char *line;
public:
  tst_box(int X, int Y, int W, int H) : Fl_Box(X,Y,W,H)
    {line = NULL;}

  void set_data(const char *newdat);
};
/***********************************************************/
void tst_box::set_data(const char *newdat) {
  line = strdup(newdat);
}

/***********************************************************/
void tst_box::draw(void) {
  int wd = w(), ht = h();
  int xo = x(), yo = y();

  // first clear out the view
  fl_color(FL_WHITE); // background colour
  fl_rectf(xo, yo, wd, ht);

  if (!line) return;

  fl_color(FL_DARK_BLUE); // text colour
  fl_font(FL_COURIER, 14); // text face

// optional lines for testing symbols handling in fl_draw() - pick one
of these!
//  fl_draw(line, xo, yo, wd, ht, (Fl_Align)(FL_ALIGN_CLIP |
FL_ALIGN_TOP_LEFT | FL_ALIGN_WRAP), 0, 0);
  fl_draw(line, xo, yo, wd, ht, (Fl_Align)(FL_ALIGN_CLIP |
FL_ALIGN_TOP_LEFT | FL_ALIGN_WRAP), 0, 1);
}

/***********************************************************/
static tst_box *box_2; // image box

/***********************************************************/
void quit_cb(Fl_Button *, void *) {
  main_win->hide();
}

/***********************************************************/
int main(int argc, char **argv) {
  int WW = 60, HH = 60;

  main_win = new Fl_Double_Window(WW + 100, HH + 60);
  main_win->begin();

  box_2 = new tst_box(10, 10, WW, HH);

  Fl_Button *quit = new Fl_Button(WW + 20, HH + 20, 60, 30, "Quit");
  quit->callback((Fl_Callback *)quit_cb);

  main_win->end();
  main_win->resizable(box_2);
  main_win->show(argc, argv);

  // test string to be displayed - pick one!
//  box_2->set_data("first @second third");
  box_2->set_data("first @@second third");

  // run the main loop
  return Fl::run();
}

/* End of File */


SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

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

Reply via email to