Move the baseline of the first line to the appropriate location given the justification parameters
| 451 | // Move the baseline of the first line to the appropriate location given |
| 452 | // the justification parameters |
| 453 | void JustifyStartPoint(float pt[2]) const |
| 454 | { |
| 455 | std::array<float, 2> offset = { { 0.f, -this->Ascent } }; |
| 456 | |
| 457 | switch (this->TextProp->GetJustification()) |
| 458 | { |
| 459 | default: |
| 460 | case VTK_TEXT_LEFT: |
| 461 | break; |
| 462 | |
| 463 | case VTK_TEXT_CENTERED: |
| 464 | offset[0] -= this->BBoxWidth * 0.5f; |
| 465 | break; |
| 466 | |
| 467 | case VTK_TEXT_RIGHT: |
| 468 | offset[0] -= this->BBoxWidth; |
| 469 | break; |
| 470 | } |
| 471 | |
| 472 | switch (this->TextProp->GetVerticalJustification()) |
| 473 | { |
| 474 | case VTK_TEXT_BOTTOM: |
| 475 | offset[1] += this->BBoxHeight; |
| 476 | break; |
| 477 | |
| 478 | case VTK_TEXT_CENTERED: |
| 479 | offset[1] += this->BBoxHeight * 0.5f; |
| 480 | break; |
| 481 | |
| 482 | default: |
| 483 | case VTK_TEXT_TOP: |
| 484 | break; |
| 485 | } |
| 486 | |
| 487 | // Account for tprop rotation: |
| 488 | std::array<float, 2> tmp = { { |
| 489 | offset[0] * this->CosineTheta - offset[1] * this->SineTheta, |
| 490 | offset[0] * this->SineTheta + offset[1] * this->CosineTheta, |
| 491 | } }; |
| 492 | |
| 493 | pt[0] += tmp[0]; |
| 494 | pt[1] += tmp[1]; |
| 495 | } |
| 496 | |
| 497 | void PrintLeftJustifiedText() const |
| 498 | { |