| 236 | } |
| 237 | |
| 238 | void DrawText(const float ptIn[2]) const |
| 239 | { |
| 240 | assert(this->Valid); |
| 241 | |
| 242 | // Copy point since we'll modify it: |
| 243 | std::array<float, 2> pt = { { ptIn[0], ptIn[1] } }; |
| 244 | |
| 245 | this->JustifyStartPoint(pt.data()); |
| 246 | |
| 247 | // Prepare text state |
| 248 | HPDF_Page_BeginText(this->Page); |
| 249 | HPDF_Page_SetFontAndSize(this->Page, this->Font, this->FontSize); |
| 250 | HPDF_Page_SetTextRenderingMode(this->Page, HPDF_FILL); |
| 251 | HPDF_Page_SetTextLeading(this->Page, this->Leading); |
| 252 | |
| 253 | // Initialize text matrix |
| 254 | HPDF_Page_SetTextMatrix(this->Page, this->CosineTheta, this->SineTheta, -this->SineTheta, |
| 255 | this->CosineTheta, pt[0], pt[1]); |
| 256 | |
| 257 | // Draw lines: |
| 258 | switch (this->TextProp->GetJustification()) |
| 259 | { |
| 260 | default: |
| 261 | case VTK_TEXT_LEFT: |
| 262 | this->PrintLeftJustifiedText(); |
| 263 | break; |
| 264 | |
| 265 | case VTK_TEXT_CENTERED: |
| 266 | this->PrintCenterJustifiedText(); |
| 267 | break; |
| 268 | |
| 269 | case VTK_TEXT_RIGHT: |
| 270 | this->PrintRightJustifiedText(); |
| 271 | break; |
| 272 | } |
| 273 | |
| 274 | HPDF_Page_EndText(this->Page); |
| 275 | } |
| 276 | |
| 277 | private: |
| 278 | bool LoadFont() |
no test coverage detected