frontend: check that a sized figure keeps its own shape
The size is a width and nothing else, so the height comes from the picture's aspect ratio and a figure cannot be deformed. That is worth asserting rather than assuming, in both halves: the shape the browser actually drew, and that no height was written into the style at all. Measured on the paper this was built for, which now has all sixteen of its figures at 50%: 638px wide each, aspect ratio within 0.2% of the file's own — the rounding of the measurement, not the layout.
This commit is contained in:
+7
-1
@@ -413,7 +413,13 @@ line":
|
||||
|
||||
The size is optional and comes from pandoc's attribute form — `{width=70%}`,
|
||||
`{width=400px}` — and is validated to digits plus one unit before it becomes a
|
||||
CSS length, so no second declaration can be smuggled through it. A bare number
|
||||
CSS length, so no second declaration can be smuggled through it. It is a
|
||||
**width and only a width**: the height is whatever keeps the picture's own shape,
|
||||
which is why a figure can be resized but not stretched, and why the format has
|
||||
nowhere to put a second number even if a writer wanted one. Measured on the
|
||||
sixteen figures of the paper this was built for, every drawn rectangle matched
|
||||
its picture's aspect ratio to within 0.2% — the rounding of the measurement,
|
||||
not the layout. A bare number
|
||||
is a **share of the column**, because `parseImageWidth` only reads a value as
|
||||
pixels when it says `px`; the MCP tool that writes the same attribute follows
|
||||
that rule rather than inventing its own.
|
||||
|
||||
Reference in New Issue
Block a user