------------------------------------------------------------------------------
| 243 | |
| 244 | //------------------------------------------------------------------------------ |
| 245 | bool vtkMatplotlibMathTextUtilities::InitializePathParser() |
| 246 | { |
| 247 | #if VTK_MODULE_ENABLE_VTK_PythonInterpreter |
| 248 | if (!Py_IsInitialized()) |
| 249 | { |
| 250 | // ensure that Python is initialized. |
| 251 | vtkPythonInterpreter::Initialize(); |
| 252 | } |
| 253 | #endif |
| 254 | if (!Py_IsInitialized()) |
| 255 | { |
| 256 | return false; |
| 257 | } |
| 258 | |
| 259 | vtkPythonScopeGilEnsurer gilEnsurer; |
| 260 | vtkSmartPyObject mplTextPathLib(PyImport_ImportModule("matplotlib.textpath")); |
| 261 | if (this->CheckForError(mplTextPathLib)) |
| 262 | { |
| 263 | return false; |
| 264 | } |
| 265 | |
| 266 | vtkSmartPyObject textToPathClass(PyObject_GetAttrString(mplTextPathLib, "TextToPath")); |
| 267 | if (this->CheckForError(textToPathClass)) |
| 268 | { |
| 269 | return false; |
| 270 | } |
| 271 | |
| 272 | this->PathParser = PyObject_CallFunction(textToPathClass, nullptr); |
| 273 | if (this->CheckForError(this->PathParser)) |
| 274 | { |
| 275 | Py_CLEAR(this->PathParser); |
| 276 | return false; |
| 277 | } |
| 278 | |
| 279 | return true; |
| 280 | } |
| 281 | |
| 282 | //------------------------------------------------------------------------------ |
| 283 | bool vtkMatplotlibMathTextUtilities::InitializeFontPropertiesClass() |
no test coverage detected