Revision a2e6dbc6

b/main.c
97 97

  
98 98
  double vertical_offset = (double) option_height / (double) option_number_of_lines;
99 99
  // double horizontal_offset = (double) option_width / (double) option_number_of_lines;
100
  double first_line_x_offset;
100 101

  
101 102
  /* Draw the text N times */
102 103
  for (i = 0; i < (option_number_of_lines + 1); i++)
......
123 124
      double current_horizontal_offset = g_rand_int_range(random_gen, 0, option_width); // horizontal_offset * i;
124 125
      if (option_verbose)
125 126
        g_print("draw at       (%d, %d)\n", (int) current_horizontal_offset, (int) current_vertical_offset);
127
      
128
      // Make sure the last line is aligned with first:
129
      if (i == 0)
130
        first_line_x_offset = current_horizontal_offset;
131
      if (i == option_number_of_lines)
132
        current_horizontal_offset = first_line_x_offset;
133
      
134
      // Move the pen, show the text:
126 135
      cairo_move_to (cairo_context, current_horizontal_offset, current_vertical_offset);
127 136
      /* draw the text */
128 137
      pango_cairo_show_layout (cairo_context, layout);
......
134 143
      int rightmost_pixel = text_width + current_horizontal_offset;
135 144
      if (text_width == 0)
136 145
        g_error("A null width of text will result in a division by zero. Aborting.");
146

  
147
      // Draw it a second time if its rightmost pixel is offscreen
137 148
      if (rightmost_pixel > option_width)
138 149
      {
139 150
        int leftover = rightmost_pixel % option_width;

Also available in: Unified diff