Print programs with editor-based layout and typesetting#264
Draft
osnr wants to merge 46 commits into
Draft
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.
Automatically check default display and camera in setup.folk for easier calibrate.
Problem: the projector calibration is off, so the whole thing is fairly inaccurate. Probably something we changed has thrown it off? Some assumption no longer correct.
Need this to localize fields in printed code.
so in future, we can change the format but still have old pages work + every page can have its own font size or weird geometry based on how you edited it.
Collaborator
Author
|
Some weird other changes here:
|
cwervo
reviewed
May 27, 2026
| </iframe> | ||
| <p>You can download the PDF and print it yourself, or print through Folk if your printer is set up: <button id="board-print-through-folk">Print Calibration Board through Folk</button></p> | ||
| <img width="200" src="/calibrate/board.png" style="border: 1px solid gray"> | ||
| <p>Make sure your printer is set up for Folk to print.</p> |
Collaborator
There was a problem hiding this comment.
Maybe we link to Printer Support — https://github.com/FolkComputer/folk#printer-support here?
smj-edison
reviewed
May 28, 2026
| When the calibration measurements are /measurements/ { | ||
| set m_tag [expr {double([string trimright [dict get $measurements tagSideLength] mm])}] | ||
| set m_left [expr {double([string trimright [dict get $measurements left] mm])}] | ||
| set m_bottom [expr {double([string trimright [dict get $measurements bottom] mm])}] |
Collaborator
There was a problem hiding this comment.
What's the point of using expr {double()} here?
smj-edison
reviewed
May 28, 2026
| When /k/ is a keyboard with /...opts/ &\ | ||
| /nobody/ wishes /k/ does not create an editor { | ||
| # Old editor data is incompatible. | ||
| file delete $::env(HOME)/folk-data/hold/editor.folk |
Collaborator
There was a problem hiding this comment.
Will this delete on every boot?
Collaborator
There was a problem hiding this comment.
Also, I believe it will still be loaded by the time this runs, which may be an issue (I haven't read the rest of the code yet though).
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.
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
IMG_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.