------------------------------------------------------------------------------
| 448 | |
| 449 | //------------------------------------------------------------------------------ |
| 450 | bool vtkFreeTypeTools::GetBoundingBox( |
| 451 | vtkTextProperty* tprop, const vtkStdString& str, int dpi, int bbox[4]) |
| 452 | { |
| 453 | // We need the tprop and bbox |
| 454 | if (!tprop || !bbox) |
| 455 | { |
| 456 | vtkErrorMacro(<< "Wrong parameters, one of them is nullptr or zero"); |
| 457 | return false; |
| 458 | } |
| 459 | |
| 460 | if (str.empty()) |
| 461 | { |
| 462 | std::fill(bbox, bbox + 4, 0); |
| 463 | return true; |
| 464 | } |
| 465 | |
| 466 | MetaData metaData; |
| 467 | bool result = this->PrepareMetaData(tprop, dpi, metaData); |
| 468 | if (result) |
| 469 | { |
| 470 | result = this->CalculateBoundingBox(str, metaData); |
| 471 | if (result) |
| 472 | { |
| 473 | memcpy(bbox, metaData.bbox.GetData(), sizeof(int) * 4); |
| 474 | } |
| 475 | } |
| 476 | return result; |
| 477 | } |
| 478 | |
| 479 | //------------------------------------------------------------------------------ |
| 480 | bool vtkFreeTypeTools::GetMetrics( |