OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
852 stars 310 forks source link

[Bug] DejaVuSans.ttf default font for grass.jupyter not found on Windows #4375

Closed echoix closed 1 month ago

echoix commented 1 month ago

Describe the bug

When enabling Pytest tests on Windows, I had to disable a test named "test_save", as the save() function in grass.jupyter.timeseriesmap has a default value for font, and it isn't found on Windows.

The current solution I had is to just let Pillow use its default value for the font if none is passed. I don't know know how to see the result with it.


    def save(
        self,
        filename,
        duration=500,
        label=True,
-       font="DejaVuSans.ttf",
+       font=None,
        text_size=12,
        text_color="gray",
    ):

And adding

        if font is None and not sys.platform.startswith("win"):
            font = "DejaVuSans.ttf"

The code in question is

https://github.com/OSGeo/grass/blob/04cc9ead399a85475b5390741645a7e56b39f7a8/python/grass/jupyter/timeseriesmap.py#L316-L360

I'd like some help to know how to address it.

To reproduce

  1. Go to a OSGeo4w job log, in the pytest section.
  2. In the xfail verbose logs, look at test_save.
  3. See error. Between https://github.com/OSGeo/grass/actions/runs/10992700384/job/30517619655#step:12:978 and https://github.com/OSGeo/grass/actions/runs/10992700384/job/30517619655#step:12:1065

Expected behavior

Screenshots

image image

System description

Additional context