When I create a plot with GLMakie, the labels are all rotated in an odd way. Here’s the legend of a plot I tried to make recently:
It’s the same for all of the axis labels, too.
What’s weird is that this plot was working just fine a week ago. I’ve tried downgrading GLMakie, but that hasn’t seemed to help.
Has anyone else experienced this?
Thanks!
1 Like
Do you have an MWE that’s easy to reproduce this issue?
1 Like
I just made a fresh environment, added GLMakie (though the version it grabbed was already installed of course), and then did:
using GLMakie
lines(1:5)
And I got this:
I had tried deleting ~/.julia/makiegallery
. Is there some other cache I can clear out?
I suspect the odd glyph rotations are the same as what was happening here . I think I tracked down the issue to a problem of changing backend back and forth between WGLMakie and CairoMakie, but I’m not managing to reproduce it now…
1 Like
Ah yeah, this could be a caching issue…Try:
dirname(GLMakie.AbstractPlotting.get_cache_path())
Or on a newer version:
dirname(GLMakie.Makie.get_cache_path())
I cleared the cache, and at first I was able to make the simple lines(1:5)
plot successfully. Then I ran my actual script, and the problem returned.
Interestingly, my script does jump back and forth between using CairoMakie and GLMakie, which sounds similar to what @piever was talking about.
I’m having the same issue, and indeed is also happening when going back and forth between GLMakie and CairoMakie.
Hm there was indeed an issue with going back and forth between GLMakie/WGLMakie and CairoMakie … I did think we fixed that though
Cairo does mutate the fonts rotation matrix, so, if you ran some cairo code with the fonts that are shared with GLMakie, and then GLMakie created the text atlas with those mutated fonts, it can mess up the text atlas…
+1 for cashing issue. I had this happen after a recashing of fonts, for a specifik font only. No package upgrade.
I managed to create an MWE for this, but not sure how to fix it cleanly:
opened 09:15PM - 08 Jun 21 UTC
closed 04:51PM - 09 Jun 21 UTC
CairoMakie
Managed to create an MWE for Cairo messing with GLMakie's font atlas:
```juli… a
using CairoMakie
using FreeTypeAbstraction
using Colors
using Cairo
dfont = findfont("Dejavu Sans")
bitmap, extent = renderface(dfont, '5', 64)
display(Gray.(bitmap./255))
```
![image](https://user-images.githubusercontent.com/1010467/121258381-1c9fd180-c8af-11eb-85bf-c3881fad52d1.png)
```julia
function mwe(ctx, font)
Cairo.save(ctx)
cairoface = CairoMakie.set_ft_font(ctx, font)
Cairo.rotate(ctx, 0.5)
Cairo.text_path(ctx, "5")
CairoMakie.cairo_font_face_destroy(cairoface)
Cairo.rotate(ctx, 0.0)
Cairo.restore(ctx)
end
surf = Cairo.CairoARGBSurface(500, 500)
ctx = Cairo.CairoContext(surf)
mwe(ctx, dfont)
```
```julia
dfont = findfont("Dejavu Sans")
bitmap, extent = renderface(dfont, '5', 64)
display(Gray.(bitmap./255))
```
![image](https://user-images.githubusercontent.com/1010467/121258431-2d504780-c8af-11eb-9019-6d3450416791.png)
But no idea how to cleanly stop cairo from doing this... Maybe easiest would be to copy the fonts?
Fun fact: my google skills aren't good enough to figure out how to copy fonts with FreeType, so the copy solution would mean, we need to somehow save the path with the font and load it from there as a copy...Or something like that.