Problems printing dotted/dashed lines - cairo_set_dash working?



Hi,

I'm have an application that uses GTK and print pages to a printer with text
overlaid in a grid using pango/cairo and GtkPrintOperation etc. This works
great, but I am currently updating it to do some more with that and have hit
a couple of problems with things that don't seem to be working as they
should. These are happening with a Windows build with GTK 2.22.1, Pango
1.28.3 and Cairo 1.10.2 - I haven't tried to see if the same happens in a
Linux build.

This is the first of them:

I want to print a line of the grid dotted or dashed. I found some info on
how to do this as follows:

This is my existing code that prints a line of the grid:

  cairo_t     *cr = gtk_print_context_get_cairo_context(context);
  ...
  cairo_move_to(cr, start, currPos_y);
  cairo_line_to(cr, end, currPos_y);
  cairo_stroke(cr);

And I added these two lines before the "cairo_move_to":

  static const double dotted[] = {1.0};
  cairo_set_dash(cr, dotted, 1, 0);

This had no effect and the line is still printed solid. The same happened
when I tried this instead:

  static const double dashed[] = {4.0, 1.0};  /* dash on len, dash off len
*/
  cairo_set_dash(cr, dashed, 2, 0);

Anyone know if cairo_set_dash should work OK in a Windows build?

Ian




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]