Skip to content

the ultimate vocal synthesizer - sing, speak, beatbox, and more

Rust

Consonant chart headings fit their columns; the lint checks text wider than its box

Jameson Hodgee43404d3d83a
diff --git a/src/ui/styles.css b/src/ui/styles.css
index b5d7e35..dc46d2f 100644
--- a/src/ui/styles.css
+++ b/src/ui/styles.css
@@ -2007,6 +2007,12 @@ input[type="range"]::-moz-range-thumb {
text-align: left;
}
+/* column headings fit their column at the chart's narrowest (600 px), instead of running together */
+.ipa-chart thead th {
+ padding: 1px 0;
+ letter-spacing: 0.05em;
+}
+
.ipa-chart td {
border: 1px solid var(--frame);
padding: 0 1px;
diff --git a/tools/layout-lint.ts b/tools/layout-lint.ts
index 8093e9b..fff318b 100644
--- a/tools/layout-lint.ts
+++ b/tools/layout-lint.ts
@@ -6,6 +6,7 @@
*
* - overlap two pieces of text or controls drawn over each other (DOM text, buttons, inputs,
* dials, and text drawn on canvases, which the page reports by wrapping fillText)
+ * - overflow text wider than its own box, running into whatever is beside it
* - clipped content cut off by an overflow: hidden box (a panel too short for what it holds)
* - spill content that runs outside its screen's frame
* - screens two screens, or a screen and the top bar, overlapping
@@ -115,7 +116,15 @@ function inspect(): Problem[] {
if (size < 8) problems.push({ kind: "small-text", detail: `${nameOf(el, text)} is ${size}px` });
const range = document.createRange();
range.selectNodeContents(n);
- for (const b of range.getClientRects()) consider(el, rect(b), nameOf(el, text), {}, true);
+ const own = rect(el.getBoundingClientRect());
+ const cs = getComputedStyle(el);
+ for (const b of range.getClientRects()) {
+ const r = rect(b);
+ consider(el, r, nameOf(el, text), {}, true);
+ // text wider than its own box (a table heading over its neighbour's) where nothing clips it
+ if (cs.display !== "inline" && cs.overflowX === "visible" && (own.x0 - r.x0 > TOL || r.x1 - own.x1 > TOL))
+ problems.push({ kind: "overflow", detail: `${nameOf(el, text)} ${fmt(r)} is wider than its box ${fmt(own)}` });
+ }
}
// controls and drawings without text of their own
for (const el of document.querySelectorAll("button, input, textarea, select, svg, img")) {