CairoMakie and Fontconfig

Hi all.

Just wondering if this is a known problem that can be easily fixed, or if it’s a bug.

Using Github CI tools, we use Documenter.jl to run and build examples. Recently all of our plotting has moved over to Makie so we’re using CairoMakie as the backend. Things are working well for the most part, but sometimes we get labeling issues

(Note the title).

I fixed a problem with Fontconfig previously. GH CI is using an old ubuntu version for their latest, so fontconfig was ancient and was spitting errors everywhere. Now that I’ve forced the CI to use the true latest ubuntu version, those issues have been mitigated.

I’m wondering if this issue above is somewhat connected though. Am I missing some particular font on the CI VM that I should install? Some missed setting?

Links to relevant portions of our setup:
Bottom of this documentation page
Source for the page
CI Script

That looks really weird and I haven’t seen this issue before. Is it happening the same way everytime this script runs?

I do have the same issue but just if I change la figure size, i.e. if I specify the resolution. I didn’t try to solve it, I’m simple calling GLMakie instead :smiley:

@jules, unsure just yet - we’ve just transitioned, so I’ll have to make a few more commits :slight_smile:
It’s not happening everywhere throughout the documentation though, so it does seem to be an intermittent problem

@lazarusA, do you run GLMakie on CI though? I’ve seen the complications of getting that to work. Unsure if it’s really worth the effort for some mangled strings.

I have seen some issues with scaled or rotated glyphs when switching back and forth between GLMakie and CairoMakie. But not totally wrong order or placement like here. Is there anything threaded going on? Probably not right

No threading. Just a simple VM. It’s not happening locally, so it probably has something to do with the GHActions environment .

So on two different build of the docs: current stable, current dev, both produce the same error.

At least on this page, the first figure looks fine, then the other titles fail in exactly the same manner. So yes - happening the same way at different times.

Compare daisyworld and predator_prey though. Both have multiple static plots, diasywold has issues, but predator_prey is fine.

Side note, if you save the svg as a file and then manually include it, it will not overflow like that

One thing to try could be using a different font, you can supply one by giving its path directly if you’re not sure what CI has available. If you have incorrect glyphs, that could be because something font-related is messed up. Or CairoMakie requests the wrong glyphs (very unlikely as it works locally), or something else is using fonts at the same time and you have side effects (what could that be? I don’t know how isolated Cairo’s use of fonts is)

Is this the same issue as the one where multiple SVGs in a page have text blocks that interfere with other text blocks?

My first meeting:

After some research:

1 Like

Thanks all. Some good avenues to explore. I’ll try some of these things and report back.

aha that makes a lot of sense. I’m always saving svg’s as separate files in the docs, because of the size issue. And that probably stops them from interacting, as they are not part of the same DOM tree.

yup that’s it, just tested with your own site @Libbum. First it looked like this:

then I deleted the upper, intact svg from the DOM with the browser dev tools, then the messed up one looked fine:

2 Likes

In an older version of Luxor, I used to rewrite the SVG, Luxor.jl/drawings.jl at 3cfae3e9df741f2f85b02a5fe652e64fee4fae26 · JuliaGraphics/Luxor.jl · GitHub

but I couldn’t work out how to integrate this with the changes in show() so it’s not automatic at the moment…

In VSCode, I used the src string mode for img tags, which gives svg nicer scaling behavior anyway. Just made an issue for that over at Documenter Handling svg images resulting from `@example` blocks better · Issue #1537 · JuliaDocs/Documenter.jl · GitHub

So saving out to file has worked fine. I’ll keep track of the issue on Documenter, but for the moment using files is no hassle.

Thanks for pointing me in the right direction!

Same problem appears in jupyter notebooks with CairoMakie btw

1 Like