currently graphics using real-world units as size are rendered too small when a custom DPI is requested via WMS vendor parameter.
Consider the following CSS rule:
What happens is the following:
A style visitor rescales the size due to the DPI vendor parameter, but as a result the unit of the size is omitted (GraphicsAwareDpiRescaleStyleVisitor)
Another style visitor rescales the size due the real world unit, calculates the pixel size. However, the result is wrong because 1) has omitted the unit.
In my opinion the problem is RescaleMode.Pixels.rescaleToStringInternal(), which should conditionally return the unit. RescaleMode.Pixels.rescaleToExpression() already behaves like this.
I did some research in the code and found a unit test for the DpiRescaleStyleVisitorTest.
However, it tests RescaleMode.Pixels.rescaleToExpression() only.
I have extended the test to exercise RescaleMode.Pixels.rescaleToStringInternal(), too, extended RescaleMode.Pixels.rescaleToStringInternal() and added a more complex test for this issue in GraphicsAwareDpiRescaleStyleVisitorTest.
I will provide a pull request as proposed solution. I would be glad if somebody could review and hopefully merge it.
With best regards,
BTW: The GeoTools functionality is pretty impressive. Good job!