css4j / echosvg

SVG implementation in the Java™ Language, fork of Apache Batik, supporting level 4 selectors and colors.
Apache License 2.0
39 stars 2 forks source link

Deprecate `getPixelToMM()` for removal #59

Closed carlosame closed 1 year ago

carlosame commented 2 years ago

Method getPixelToMM() was intended to be removed from Batik and should be removed from EchoSVG. Also, getPixelUnitToMillimeter() is obsolete and should be replaced by a modern concept of resolution (the pixel/mm ratio was long ago set to a fixed quantity in CSS).

The methods belong to:

and there is also getPixelToMillimeter() that should be removed from css.engine.CSSContext and bridge.BridgeContext.

The following steps could be followed:

1) Deprecate getPixelToMM() and getPixelToMillimeter() for removal. (Milestone 0.2.1)

2) Introduce a new KEY_RESOLUTION_DPI transcoding hint and use it as the basis for resolution computations. (Milestone 0.3)

3) Deprecate getPixelUnitToMillimeter(). (Milestone 0.3)

4) Remove getPixelToMM() and getPixelToMillimeter(). (Milestone 0.3)

EDIT: this issue involves more work (and writing more tests) than anticipated, so the KEY_RESOLUTION_DPI transcoding hint won't be introduced for now.

carlosame commented 1 year ago

Batik was written with the assumption that pixel units would have a fixed resolution, and changing this affects to a number of places (including all the transformations). Modifying this fundamental design decision would involve a large amount of work, including the creation of a number of tests to verify that all the scaling is done properly. This project has limited development resources and there is no justification for the effort.

Unfortunately, this also prevents fixing the non-conformant unit conversions in the CSS module. After a small cleanup, I'm closing this issue as "not planned".