Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken fonts and markers when using GLMakie with a custom system image #2480

Closed
lassepe opened this issue Dec 8, 2022 · 6 comments
Closed

Comments

@lassepe
Copy link
Contributor

lassepe commented Dec 8, 2022

To reduce load time, I have GLMakie baked into my custom dev system image. I generate this image from the following precompile work load:

using GLMakie: GLMakie
GLMakie.scatter([0])

This has worked great for a long time but recently this causes issues with fonts and markers. For example, a simple scatter plot now looks like this

image

Note that the marker is a square instead of a circle and there are various artifacts in the tick labels as well.

This seems to be tied to the system image generation process. Since JuliaLang/julia#47184 (review) introduces package images, this will probably show up even in a non-custom environment soon. In fact, if I simply run the above workload with julia compiled from that branch, I observe the exact same issue (without a custom system image, just the package image).

@lassepe lassepe changed the title Broken fonts when using GLMakie with a custom system image Broken fonts and markers when using GLMakie with a custom system image Dec 8, 2022
@SimonDanisch
Copy link
Member

Yeah I noticed this too! First thought, it was maybe linux on wsl2 (since I'm never using that, but used it for once to build JuliaLang/julia#47184 (review))...
I maybe have some explanation but still need to investigate!

@lassepe
Copy link
Contributor Author

lassepe commented Dec 8, 2022

Fwiw, I saw this on Ubuntu 20.04 and on Arch Linux

@qwjyh
Copy link

qwjyh commented Dec 8, 2022

I also saw this with sysimage with Makie without GLMakie on Manjaro Linux.
It doesn't work with GLMakie(fonts are broken), but it works with CairoMakie.

@shaul-pollak
Copy link

shaul-pollak commented Dec 9, 2022

I was able to solve this by redefining the following function in my startup.jl

function Makie.sdistancefield(img, downsample, pad)
    # we pad before downsampling, so we need to have `downsample` as much padding
    pad = downsample * pad
    # padd the image
    padded_size = size(img) .+ 2pad

    # for the downsampling, we need to make sure that
    # we can divide the image size by `downsample` without reminder
    dividable_size = ceil.(Int, padded_size ./ downsample) .* downsample

    in_or_out = fill(false, dividable_size)
    # the size we fill the image up to
    wend, hend = size(img) .+ pad
    in_or_out[pad+1:wend, pad+1:hend] .= img .> (0.5 * 255)

    yres, xres = dividable_size .÷ downsample
    # divide by downsample to normalize distances!
    return Float16.(Makie.sdf(in_or_out, xres, yres) ./ downsample)
end

@lassepe
Copy link
Contributor Author

lassepe commented Dec 26, 2022

As of Julia 1.8.4, this problem also appears in GLMakie 0.6.x. So just pinning to 0.7.2 (which is what I did before) no longer circumvents this issue.

@SimonDanisch
Copy link
Member

SimonDanisch commented Dec 29, 2022

This should be fixed on master by #2498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants