Repository navigation
fix: fit the tower section labels to their faces - #5
Merged
Merged
Conversation
The temperature, retraction and flow towers sized each section label
from the section height alone, so every label in their examples was
wider than the face it is carved into: 9.1 to 11.6 mm on faces of 8.0
and 8.4 mm. A printed tower lost the label's first and last strokes
off the edges ("180C" read as "80C").
Each label now shrinks, when it has to, until it spans at most 90% of
its face, measured with textmetrics(). An assert stops the render if a
label still overruns, so just test catches a regression: with the fit
disabled it fails on "220C". OpenSCAD 2021.01, which has no
textmetrics(), keeps the old size.
The label fit uses textmetrics(), which the 2026.08.19 snapshot still treats as experimental: CI's --hardwarnings render stopped on that warning. CI now pins 2026.10.15, the snapshot the docs engine uses. On 2026.08.19 without --hardwarnings the flow tower example still renders (exit 0): textmetrics() warns, the fit returns the full font size (3.3688), and the labels keep their old size. The README says so.
CameronBrooks11
added a commit
that referenced
this pull request
Nov 16, 2026
The README had no pictures, and `.gitignore` excluded every PNG. `just images` renders three labelled sheets into `images/` with OpenSCAD and ImageMagick: - **`towers.png`:** temperature, detailed temperature, retraction, flow and speed. - **`bed-level-patterns.png`:** the eight patterns, seen from straight above (orthographic), where single lines read best. - **`cube-and-torture-test.png`:** the XYZ calibration cube and the torture test. Each model is trimmed to its outline before it goes on a sheet. Each sheet is then quantized to 128 colours without dithering: 1.4 MB for the three instead of 3.2 MB. I compared both versions and saw no banding, even on the shaded retraction column. `.gitignore` now lets `images/*.png` through, and the README shows the three sheets under its opening paragraph. These pictures are rendered after #5, so the towers show the fitted labels. They're also how #5's defect was found: the first render showed "180C", "6mm" and "115%" running off their faces. I looked at all three sheets. `just test` renders all 16 examples.
CameronBrooks11
added a commit
that referenced
this pull request
Nov 16, 2026
Since #5, `section_label_height_multiplier` sets the largest section label size on the flow, temperature and retraction towers: a label wider than its face is drawn smaller. The three parameter tables in `docs/towers.md` still described it as the size. The detailed temperature and speed towers don't fit their labels, so their rows are unchanged.
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.
The temperature, retraction and flow towers sized each section label from the section height alone (
size × 0.401). In their examples, every label came out wider than the face it's carved into. Head-on renders show the first and last strokes cut off at the face edges: "180C" reads as "80C", and "6mm" and "115%" are clipped the same way. The detailed temperature and speed towers carve their labels on wider faces and were already fine.Measured with
textmetrics()at each example's settings (font "Arial:style=Bold", which resolves to Liberation Sans Bold here):Each tower gets a
*_label_size()function. It shrinks a label, only when needed, until the label spans at most 90% of its face. An assert stops the render if a label still overruns. OpenSCAD 2021.01 has notextmetrics(); there, the label keeps its old size.Checked:
just testexits 1 withsection label "220C" is wider than its face. Restored, it passes all 16.The labels are smaller than before, about 2.2–2.8 mm instead of 3.2–3.4 mm. Shorter suffixes (e.g. no "C") would let them stay bigger, if you'd rather.
OpenSCAD version:
textmetrics()is built in from the 2026.10.15 snapshot. CI's earlier pin, 2026.08.19, still treats it as experimental, and CI's--hardwarningsstopped on that warning. CI now pins 2026.10.15, the same snapshot the docs engine uses. I ran the flow example on 2026.08.19 without--hardwarnings: it warns, the fit returns the full font size (3.3688), and the model renders (exit 0) with the old, overrunning labels. The README now says this.