Changeset 718
- Timestamp:
- 07/27/08 07:12:32 (6 months ago)
- Files:
-
- 1 modified
-
trunk/src/placement_finder.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/placement_finder.cpp
r717 r718 233 233 std::vector<int> line_breaks; 234 234 std::vector<double> line_widths; 235 std::vector<double> line_heights; 235 236 if (wrap_at < string_width && p.info.num_characters() > 0) 236 237 { … … 261 262 if (line_width > 0 && line_width > wrap_at) 262 263 { 264 // Remove width of breaking space character since it is not rendered 265 line_width -= ci.width; 263 266 string_width = string_width > line_width ? string_width : line_width; 264 267 string_height += line_height; 265 268 line_breaks.push_back(last_space); 266 269 line_widths.push_back(line_width); 270 line_heights.push_back(line_height); 267 271 ii = last_space; 268 272 line_width = 0; … … 278 282 line_breaks.push_back(p.info.num_characters() + 1); 279 283 line_widths.push_back(line_width); 284 line_heights.push_back(line_height); 280 285 } 281 286 if (line_breaks.size() == 0) … … 283 288 line_breaks.push_back(p.info.num_characters() + 1); 284 289 line_widths.push_back(string_width); 290 line_heights.push_back(string_height); 285 291 } 286 292 … … 294 300 current_placement->starting_y += boost::tuples::get<1>(p.displacement_); 295 301 296 double line_height = 0;297 302 unsigned int line_number = 0; 298 303 unsigned int index_to_wrap_at = line_breaks[line_number]; 299 304 double line_width = line_widths[line_number]; 305 double line_height = line_heights[line_number]; 300 306 301 x = -line_width/2.0 - 1.0;302 y = - string_height/2.0 + 1.0;307 x = -line_width/2.0; 308 y = -line_height/2.0; 303 309 304 310 for (unsigned i = 0; i < p.info.num_characters(); i++) … … 312 318 index_to_wrap_at = line_breaks[++line_number]; 313 319 line_width = line_widths[line_number]; 320 line_height = line_heights[line_number]; 314 321 y -= line_height; 315 322 x = -line_width/2.0; 316 line_height = 0;317 323 continue; 318 324 } … … 348 354 } 349 355 x += ci.width; 350 line_height = line_height > ci.height ? line_height : ci.height;351 356 } 352 357 p.placements.push_back(current_placement.release());
