Changeset 1254 for trunk/src/placement_finder.cpp
- Timestamp:
- 07/20/09 11:30:19 (12 months ago)
- Files:
-
- 1 modified
-
trunk/src/placement_finder.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/placement_finder.cpp
r1167 r1254 76 76 label_placement(sym.get_label_placement()), 77 77 wrap_width(sym.get_wrap_width()), 78 wrap_char(sym.get_wrap_char()), 78 79 text_ratio(sym.get_text_ratio()), 79 80 label_spacing(sym.get_label_spacing()), … … 215 216 double label_x, 216 217 double label_y, 217 vertical_alignment_e valign) 218 vertical_alignment_e valign, 219 unsigned line_spacing, 220 unsigned character_spacing) 218 221 { 219 222 double x, y; … … 240 243 if (wrap_at < string_width && p.info.num_characters() > 0) 241 244 { 242 int last_ space= 0;245 int last_wrap_char = 0; 243 246 string_width = 0; 244 247 string_height = 0; … … 251 254 character_info ci; 252 255 ci = p.info.at(ii); 256 257 unsigned cwidth = ci.width + character_spacing; 253 258 254 259 unsigned c = ci.character; 255 word_width += c i.width;256 word_height = word_height > ci.height ? word_height : ci.height;260 word_width += cwidth; 261 word_height = word_height > (ci.height + line_spacing) ? word_height : (ci.height + line_spacing); 257 262 258 if (c == ' ')263 if (c == p.wrap_char) 259 264 { 260 last_ space= ii;265 last_wrap_char = ii; 261 266 line_width += word_width; 262 267 line_height = line_height > word_height ? line_height : word_height; … … 267 272 { 268 273 // Remove width of breaking space character since it is not rendered 269 line_width -= c i.width;274 line_width -= cwidth; 270 275 string_width = string_width > line_width ? string_width : line_width; 271 276 string_height += line_height; 272 line_breaks.push_back(last_ space);277 line_breaks.push_back(last_wrap_char); 273 278 line_widths.push_back(line_width); 274 279 line_heights.push_back(line_height); 275 ii = last_ space;280 ii = last_wrap_char; 276 281 line_width = 0; 277 282 line_height = 0; … … 327 332 ci = p.info.at(i); 328 333 334 unsigned cwidth = ci.width + character_spacing; 335 329 336 unsigned c = ci.character; 330 337 if (i == index_to_wrap_at) … … 368 375 p.envelopes.push(e); 369 376 } 370 x += c i.width;377 x += cwidth; 371 378 } 372 379 p.placements.push_back(current_placement.release());
