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

Function GetMetrics

Rendering/GL2PSOpenGL2/vtkOpenGLGL2PSHelperImpl.cxx:38–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36{
37
38bool GetMetrics(
39 vtkRenderWindow* renwin, vtkTextProperty* tprop, const char* str, vtkTextRenderer::Metrics& m)
40{
41 int dpi = renwin->GetDPI();
42 vtkTextRenderer* tren = vtkTextRenderer::GetInstance();
43 if (!tren)
44 {
45 return false;
46 }
47 vtkNew<vtkTextProperty> tpropTmp;
48 tpropTmp->ShallowCopy(tprop);
49 tpropTmp->SetOrientation(0.);
50 return tren->GetMetrics(tpropTmp, str, m, dpi);
51}
52
53// replace \n with space as PS treats it as a space but PDF just removes them.
54// we also need this so that we get the correct bounding box for PDFs

Callers 1

DrawStringMethod · 0.70

Calls 3

ShallowCopyMethod · 0.45
SetOrientationMethod · 0.45
GetMetricsMethod · 0.45

Tested by

no test coverage detected