From a820e603614784f29b997a8c9d51327f60de0581 Mon Sep 17 00:00:00 2001 From: bm Date: Thu, 24 Sep 2026 07:55:59 -0700 Subject: [PATCH] UI: remove selectors superseded by the spec (font, size, inner margin, gutter table); 11pt API default --- docs/umbraformat_specification_document.md | 1 + umbraformat/app.py | 7 +++-- umbraformat/static/js/main.js | 17 +++++------ umbraformat/templates/format.html | 35 +++++++--------------- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/docs/umbraformat_specification_document.md b/docs/umbraformat_specification_document.md index 18554fb..0ce395b 100644 --- a/docs/umbraformat_specification_document.md +++ b/docs/umbraformat_specification_document.md @@ -200,6 +200,7 @@ To support non-English target languages (e.g., Spanish, German, CJK, Arabic): [ Layout Transformer & Pagination Builder ] ├── Enforce Recto / Verso Page Assignments ├── Apply Margins, Gutters, and Bleed Settings + │ └── Resolve dynamic gutter to fixed point (render → page count → rebuild) ├── Build Running Headers & Suppressions └── Resolve Graphic Positions / Stripping Logic │ diff --git a/umbraformat/app.py b/umbraformat/app.py index 7742cd2..db624cc 100644 --- a/umbraformat/app.py +++ b/umbraformat/app.py @@ -105,8 +105,11 @@ def api_format(): # Extract formatting options font_name = data.get("font", "Caladea") - font_size = int(data.get("fontSize", 12)) - inner_margin = float(data.get("innerMargin", 0.500)) + # Body typography is fixed by the WA style family (spec 2.2: Caladea 11pt); + # font/fontSize are accepted for backward compatibility and only affect + # the invisible runs that host inline images. + font_size = int(data.get("fontSize", 11)) + inner_margin = float(data.get("innerMargin", 0.500)) # ignored: dynamic gutter trim_size = data.get("trimSize", "5.5x8.5") bleed = float(data.get("bleed", 0.0)) author = data.get("author", "") diff --git a/umbraformat/static/js/main.js b/umbraformat/static/js/main.js index 52d6462..ff7ff13 100644 --- a/umbraformat/static/js/main.js +++ b/umbraformat/static/js/main.js @@ -8,6 +8,8 @@ const WORDS_PER_PAGE = { "Palatino": { 10: 355, 11: 298, 12: 258 } }; +// UmbraFormat spec gutter table (spec section 2.1) — the server resolves +// this same table server-side; the UI only previews the expected value. const MARGIN_TABLES = { umbraformat: [ { min: 0, max: 149, margin: 0.500 }, @@ -36,11 +38,10 @@ function getRecommendedMargin(pageCount, table) { function updateMarginRecommendation() { const recDiv = document.getElementById('marginRecommendation'); const recSpan = document.getElementById('recommendedMargin'); - const marginTable = document.getElementById('marginTableSelect'); if (window._pageCount) { - const rec = getRecommendedMargin(window._pageCount, marginTable.value); - recSpan.textContent = `${rec} in for ${window._pageCount} pages (applied automatically)`; + const rec = getRecommendedMargin(window._pageCount, 'umbraformat'); + recSpan.textContent = `${rec} in for ~${window._pageCount} pages (resolved exactly from the rendered page count)`; recDiv.classList.remove('d-none'); } } @@ -163,12 +164,12 @@ function showResults(data) { function updatePageEstimate() { if (!analysisData) return; - const font = document.getElementById("fontSelect").value; - const fontSize = parseInt(document.getElementById("fontSizeSelect").value); + // Body typography is fixed by the WA styles (Caladea 11pt, spec 2.2), + // so the estimate no longer depends on font selectors. const trimSize = document.getElementById("trimSelect").value; const wordCount = analysisData.chapter_word_count || 0; - const wpp = (WORDS_PER_PAGE[font] && WORDS_PER_PAGE[font][fontSize]) || 300; + const wpp = 300; const trimFactor = trimSize === "6x9" ? 1.35 : 1.0; const bodyPages = Math.ceil(wordCount / (wpp * trimFactor)); const totalPages = bodyPages + 10; // Add 10 for front/back matter @@ -274,8 +275,6 @@ function doFormat() { document.getElementById("formatBtn").disabled = true; showLoading("Formatting document..."); - const font = document.getElementById("fontSelect").value; - const fontSize = document.getElementById("fontSizeSelect").value; const trimSize = document.getElementById("trimSelect").value; const bleed = document.getElementById("bleedCheck").checked ? 0.125 : 0; const author = document.getElementById("authorInput").value.trim(); @@ -290,8 +289,6 @@ function doFormat() { headers: { "Content-Type": "application/json" }, body: JSON.stringify({ upload_id: currentUploadId, - font: font, - fontSize: fontSize, trimSize: trimSize, bleed: bleed, author: author, diff --git a/umbraformat/templates/format.html b/umbraformat/templates/format.html index f8615f4..bb08fe2 100644 --- a/umbraformat/templates/format.html +++ b/umbraformat/templates/format.html @@ -42,24 +42,13 @@
-
- - +
+ +
+ Caladea 11 pt, justified (WA styles, spec 2.2) +
-
- - -
-
+
Computed automatically from the final page count @@ -80,11 +69,10 @@
- - + +
+ UmbraFormat spec (0.50 – 0.75 in, spec 2.1) +
@@ -252,9 +240,6 @@ {% block scripts %} {% endblock %}