Re: Unit of measure for image dimensions
Posted by hijarian on May 03, 2015; 7:03pm
URL: https://discuss.asciidoctor.org/Unit-of-measure-for-image-dimensions-tp3040p3112.html
To be blunt, when we are talking about authoring PDF based on plaintext sources, we're competing with LaTeX, right? Doesn't matter that DocBook is targeted on tech docs and domain of LaTeX is scientific papers, we have pictures both here and there. My humble opinion is that we need to provide at least the same level of control over the pictures in the PDF as in the LaTeX toolchain. If it's not desirable for some reason, then it should be quite reasonable to allow same level of control as in HTML. In any case it seems quite obvious that the following is needed:
* Ability to specify purely decorative images. Not those from `image::` macro, which are being implicitly placed into container, numbered in TOC and have a subtitle. Not those from `image:` macro, which are treated like a character in line of text. Those which we can just put anywhere on the page and forget about it. As far as I understand, there is no possibility to make such types of images in PDF. Or, rather, to make them in AsciiDoc so PDF will treat them as such. This issue is directly related to the topic of this conversation, it's its context.
* `width` and `height` should allow explicit specification of units, like "500px", "5em", "5ex", etc. Compatible with CSS and whatever PostScript is allowing in the dimensions of blocks.
* If `width` and `height` are specified at all, then it should be treated as *explicit* specification of sizes, and it should be obeyed. Current behavior is not obvious at all, and simply means that we are generating waste code each time we specify `width` and `height` parameters. Both AsciiDoc > HTML and AsciiDoc -> PDF converters are able to guess image aspect ratio correctly without specifying sizes at all. Then, what's the point of these parameters?
* floats should work both in HTML and PDF, no exception. PostScript happily support this feature AFAIK, so there's no technical obstacle to this.
* when the author writes the AsciiDoc and does the following: `image::filename.png[width=45cm,align=center]` we must assume that he knows what he's doing and make it 15 cm wide both in HTML and PDF, keeping proportions (as no height was explicitly specified), and trimming left and right sides of image in PDF, where it obviously cannot fit inside 21cm width of the page. This will allow people to make images without margins in printed pages, spanning from left-hand edge of paper to right-hand one.