maxitg / SetReplace

C++/Wolfram Language package for exploring set and graph rewriting systems
MIT License
216 stars 43 forks source link

Fix cell label rasterization on Linux platforms #542

Closed taliesinb closed 3 years ago

taliesinb commented 3 years ago

This branch introduces $EnableLabelRasterizationWorkaround, which defaults to True on Linux, and which manually attaches cell labels in the right places. It is not 100% pixel accurate compared to the normal behavior on macOS, but I don't think should be a goal -- the underlying bug needs to be fixed upstream.

Example shown below (the setting of $EnableLabelRasterizationWorkaround is so you can toggle the effect on your platform to see it do its thing, which should appear to be nothing on macOS and to make the labels appear correctly on Linux).

PixelSnap 2020-12-03 at 07 37 46@2x


This change is Reviewable

taliesinb commented 3 years ago

@daneelsan Can we confirm this fixes the issue on Linux before we merge this?

aokellermann commented 3 years ago
$ uname -a
Linux arch 5.9.11-arch2-1 #1 SMP PREEMPT Sat, 28 Nov 2020 02:07:22 +0000 x86_64 GNU/Linux
taliesinb commented 3 years ago

Thanks for testing @aokellermann !

But now I'm confused -- so you were using Linux and it rendered correctly before I introduced this fix, but not after? Now we need to understand why your Linux install rasterized the cell labels but @daneelsan did not -- perhaps he can run uname -a as well.

In any case, I've made a small tweak --so @aokellermann do you mind running again? Also, can you paste screenshots of the behavior after setting $EnableLabelRasterizationWorkaround = False and $EnableLabelRasterizationWorkaround = True? Thanks so much!

aokellermann commented 3 years ago

@taliesinb

master: image

your branch: image

image

daneelsan commented 3 years ago

@taliesinb @aokellermann

$ uname -a
Linux pop-os 5.8.0-7630-generic #32~1605108853~20.04~8bcf10e-Ubuntu SMP Wed Nov 11 22:42:16 UTC  x86_64 x86_64 x86_64 GNU/Linux

I had to reinstall the OS in my PC as I had some horrible issue. The label now appears in when I'm in the master branch: image

There seems to be a cropping issue but the label is working (again in master branch).

daneelsan commented 3 years ago

Running @aokellermann examples:

master: image

branch: image

I feel bad that it works now but I swear the label was not appearing before...

aokellermann commented 3 years ago

@daneelsan Are you sure cropping issue is on master? I get that exact issue but only when I use this branch.

daneelsan commented 3 years ago

Double-checked and yes, in master.

Have you tried with "RasterizeInput" -> False? image

maxitg commented 3 years ago

@daneelsan, can you include the prior cells with the input so that we can try to reproduce?

daneelsan commented 3 years ago
RandomHypergraph[10] // HypergraphPlot
RasterizePreviousInputOutputAndExportToMarkdown["Test.png", "DryRun" -> True, "RasterizeInput" -> False]

image

maxitg commented 3 years ago

I cannot reproduce the cropping issue on a Mac. I'm wondering if some of the hard-coded size constants need to be different on Linux.

maxitg commented 3 years ago

I can however reproduce the cropping issue on Windows: image

aokellermann commented 3 years ago

With "RasterizeInput" -> False

master: image

this branch: image

maxitg commented 3 years ago

$EnableLabelRasterizationWorkaround=True from this branch fixes the cropping on Windows as well.

taliesinb commented 3 years ago

Ok, it seems like things are inconsistent enough and strange enough between platforms that I cannot use Rasterize[Notebook[...]] to do anything, and need to resort to creating the complete image myself using my previous ImageColumn code. I will try to do this some time this week.

maxitg commented 3 years ago

Closing for now due to inactivity. Can be reopened in the future if there are any updates.