aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md24
1 files changed, 16 insertions, 8 deletions
diff --git a/README.md b/README.md
index f8f642f..8c56090 100644
--- a/README.md
+++ b/README.md
@@ -181,11 +181,16 @@ widget code. Three rules, all learned by getting them wrong:
elements. A fixed `+34` under a numeral that scales leaves a dead band in a tall
cell and overlaps in a short one.
-**Scale type off the WIDTH, not the height.** Height is what changes when you
-add a row to the grid, and a card that shrinks its text every time its cell gets
-shorter reads as broken beside its neighbours. Width is also usually what
-constrains the text, since rows run edge to edge. Clamp it: `math.max(lo,
-math.min(hi, inner.w * k))`.
+**Fill the cell with type, and shrink only on collision.** Height is what
+changes when you add a row to the grid. Size type off the width alone and a tall
+cell is left sparse; size it off the height alone and a short cell shrinks the
+text to a whisper. The robust way is a measured fit: `card.fit_unit()` returns
+the largest base size at which every row still fits the width, and the widget
+takes the smaller of that and its height budget. Larger cell, larger type; a row
+that would collide pulls the size back down. The GPU and cache cards do this. A
+card that cannot afford the measuring pass can still key off width with a clamp,
+`math.max(lo, math.min(hi, inner.w * k))`; the clock, weather, system and disks
+cards do.
**Decide where the slack goes, and let one element absorb it.** The clock pins
its date block to the bottom and gives the numerals everything above. The
@@ -314,9 +319,12 @@ for nil, string, table, boolean, NaN and negative arguments. It matters because
the parser's input is a file written by a network fetch, and a raise here is a
blank dashboard rather than a message.
-**Card type scales off the cell WIDTH, not its height.** Height changes with the
-grid, and scaling off it made the weather text shrink to a whisper beside the
-clock's numerals when its cell got shorter.
+**Type keyed on one dimension alone leaves the card broken or sparse.** The
+weather text once shrank to a whisper beside the clock when its cell got shorter
+because the size keyed on height; a card keyed only on width leaves a tall cell
+half empty. Fill the cell instead: `card.fit_unit()` measures the rows and
+returns the largest size that fits the width, the widget takes the smaller of
+that and its height budget, and a row that would collide pulls the size down.
**A bare `df` would silently mis-read every disk figure.** The user's shell
aliases `df` to `df -h`, so `bin/disks-sample.sh` calls `/usr/bin/df -P -B1` by