MCPcopy Create free account
hub / github.com/Kitware/VTK / DrawText

Method DrawText

IO/ExportPDF/vtkPDFContextDevice2D.cxx:238–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
277private:
278 bool LoadFont()

Callers 1

DrawStringMethod · 0.80

Calls 12

JustifyStartPointMethod · 0.95
HPDF_Page_BeginTextFunction · 0.85
HPDF_Page_SetFontAndSizeFunction · 0.85
HPDF_Page_SetTextLeadingFunction · 0.85
HPDF_Page_SetTextMatrixFunction · 0.85
HPDF_Page_EndTextFunction · 0.85
assertFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected