Print programs with editor-based layout and typesetting#264
Merged
Conversation
This doesn't seem to affect folk-hex, but it might affect other systems / require re-measuring geometry. This still doesn't provide perfectly calibrated prints: I think there are some margin issues: https://moral.net.au/writing/2023/05/19/printer_actual_size/
where there was a risk we would reuse a not-yet-destroyed match and then accidentally stomp its destructorSet in the final stage of match destruction. This now uses a sentinel to distinguish 'removed' and 'fully destroyed' stages.
Want to use for on-top editor.
Goal here is to be able to prototype and preview fields at scale / in context while writing a program that uses them. The detached editor wouldn't work for this.
so that tag masking works.
Printing should share as much layout logic with draw as possible.
Turn off Hold of quad rendering -- this may cause blinking, but hopefully -atomically can handle. Make tag in print preview not detect.
It's not perfectly aligned -- need to look into. Also still some subtleties with different paper formats to fix / make sure work. Basically, I think the editor needs to be format-aware/media-aware in order for this all to make sense.
Next: use the calibration pdf to calibrate tag size and margins such that we can print at accurate scale after calibration, and such that we calibrate at exactly the same tag size that we print programs at.
so that we can live-update them when we hotpatch a dependency program (they won't just hang around the global namespace for that interp).
Need to make everything use the same print pipeline so we can be sure that the user is actually calibrating what they'll actually use to print programs.
Collaborator
Author
|
Some weird other changes here:
|
cwervo
reviewed
May 27, 2026
smj-edison
reviewed
May 28, 2026
smj-edison
reviewed
May 28, 2026
smj-edison
reviewed
May 28, 2026
Collaborator
smj-edison
left a comment
There was a problem hiding this comment.
This is really exciting, it feels like the digital and physical worlds are coming even closer with this.
Collaborator
Author
|
How would people feel about merging this? I'm not sure what it does at A4 but everything else seems OK. |
Collaborator
Author
|
This PR also removes word-wrap (since you can manually wrap your lines as you choose) and interactively-refine (which ended up not being that effective) |
This fixes quad blinking so it mostly behaves the same as when we were using Hold to render quads.
We can hopefully factor all of this out and automate it soon, but it's a useful exercise right now to figure out where we need atomic scopes.
Centralize paper formats in print.folk
so on USB printer driver which has huge margins, we don't end up with even huger tag/code margins, we can just subtract them to get close to the margin we're actually targeting. We re-enable scaling so that the page _never_ cuts off, which I realized was an issue with no-scaling.
so that we can target even closer when you point an editor at an existing program.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP. Still needs support for
multi-page printingIMG_5302.MOV
The program gets printed at whatever text scale you had in the editor at print time, and with the editor's exact margins and font.
The goal here is to let you edit 'in place' and preview in place so you can test real-world geometric constructs like fields as you program. We want to make the printed code feel like a real interaction element and not just a nice-to-have for the human reader.