conda-forge / vtk-feedstock

A conda-smithy repository for vtk.
BSD 3-Clause "New" or "Revised" License
13 stars 64 forks source link

compile with mathtext support #79

Closed banesullivan closed 1 year ago

banesullivan commented 5 years ago

Would it be possible to build vtk with mathtext support?

Please see https://github.com/vtkiorg/vtki/issues/83 (and https://github.com/vtkiorg/vtki/issues/127 because we've added pyvista to conda-forge)

banesullivan commented 1 year ago

What concerns me is that after install matplotlib, VTK thinks it is supported with this build even though it isn't:

conda install vtk
>>> import vtk
>>> vtk.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()
False
conda install matplotlib
>>> import vtk
>>> vtk.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()
True

but it still doesn't work?

$ conda install pyvista
$ python
>>> import pyvista
>>> plotter = pyvista.Plotter()
>>> plotter.add_text(r'$\rho$', position='upper_left', font_size=150, color='blue')
>>> plotter.show()

Screen Shot 2023-01-06 at 9 06 15 AM

Tobias-Fischer commented 1 year ago

https://github.com/conda-forge/vtk-feedstock/blob/026b413f5e5318744af5b6919571ac6bf88079c6/recipe/build.sh#L130 - matplotlib support is already set to ON. Which version of vtk are you installing? And is there some way to check whether matplotlib rendering works without using pyvista?

banesullivan commented 1 year ago

matplotlib support is already set to ON.

@mathstuf, is this all that is needed?

Which version of vtk are you installing?

Latest from this feedstock. Not only locally, but also with PyVista's CI, ref https://github.com/pyvista/pyvista/pull/3781

Locally: vtk 9.2.2 qt_py310h032bd38_204 conda-forge

And is there some way to check whether matplotlib rendering works without using pyvista?

Here is a pure VTK example to check for math text symbols (effectively equivalent to what PyVista is doing above):

import vtk

actor = vtk.vtkTextActor()
actor.SetInput(r'$\rho$')
actor.GetTextProperty().SetFontSize(75)
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.AddActor(actor)
iren.Initialize()
renWin.Render()
iren.Start()
Screen Shot 2023-01-08 at 7 31 35 PM
banesullivan commented 1 year ago

FWIW, I noticed this error from VTK this time:

2023-01-08 19:35:30.642 (  27.136s) [        162395FE]vtkMatplotlibMathTextUt:1084   ERR| vtkMatplotlibMathTextUtilities (0x600001908000): MaskParser is not initialized!
2023-01-08 19:35:30.643 (  27.137s) [        162395FE]vtkMatplotlibMathTextUt:515    ERR| vtkMatplotlibMathTextUtilities (0x600001908000): MaskParser is not initialized!
mathstuf commented 1 year ago

Yes, that will need 9.2.5; it added support for matplotlib 3.6.

banesullivan commented 1 year ago

Aahh, right. I just checked and this feedstock works for matplotlib<3.6.

I doubt we'd want to limit matplotlib in this recipe, so I'm happy to close this issue knowing that VTK_MODULE_ENABLE_VTK_RenderingMatplotlib is enabled

Tobias-Fischer commented 1 year ago

9.2.5 just landed :)