------------------------------------------------------------------------------
| 392 | |
| 393 | //------------------------------------------------------------------------------ |
| 394 | PyObject* vtkMatplotlibMathTextUtilities::GetFontProperties(vtkTextProperty* tprop) |
| 395 | { |
| 396 | if (!this->IsAvailable()) |
| 397 | { |
| 398 | vtkErrorMacro(<< "Matplotlib rendering is unavailable."); |
| 399 | return nullptr; |
| 400 | } |
| 401 | |
| 402 | if (!this->FontPropertiesClass) |
| 403 | { |
| 404 | if (!this->InitializeFontPropertiesClass()) |
| 405 | { |
| 406 | vtkErrorMacro(<< "FontPropertiesClass is not initialized!"); |
| 407 | return nullptr; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | char tpropFamily[16]; |
| 412 | char tpropStyle[16]; |
| 413 | char tpropWeight[16]; |
| 414 | long tpropFontSize; |
| 415 | |
| 416 | switch (tprop->GetFontFamily()) |
| 417 | { |
| 418 | default: |
| 419 | case VTK_ARIAL: |
| 420 | strcpy(tpropFamily, "sans-serif"); |
| 421 | break; |
| 422 | case VTK_COURIER: |
| 423 | strcpy(tpropFamily, "monospace"); |
| 424 | break; |
| 425 | case VTK_TIMES: |
| 426 | strcpy(tpropFamily, "serif"); |
| 427 | break; |
| 428 | } |
| 429 | |
| 430 | if (tprop->GetItalic()) |
| 431 | { |
| 432 | strcpy(tpropStyle, "italic"); |
| 433 | } |
| 434 | else |
| 435 | { |
| 436 | strcpy(tpropStyle, "normal"); |
| 437 | } |
| 438 | |
| 439 | if (tprop->GetBold()) |
| 440 | { |
| 441 | strcpy(tpropWeight, "bold"); |
| 442 | } |
| 443 | else |
| 444 | { |
| 445 | strcpy(tpropWeight, "normal"); |
| 446 | } |
| 447 | |
| 448 | tpropFontSize = tprop->GetFontSize(); |
| 449 | |
| 450 | vtkPythonScopeGilEnsurer gilEnsurer; |
| 451 |
no test coverage detected