Okay spent the afternoon (and a cup of tea) looking at this a bit more ...
0) Use of System properties
All manner/combinations of system properties did not have any effect ...
-Dawt.useSystemAAFontSettings=lcd
-Dswing.aatext=true
-J-Dswing.aatext=false
-J-Dawt.useSystemAAFontSettings=off
-J-Dapple.awt.graphics.UseQuartz=false
1) Use of Evil
Making up a new "weight" ... and modifying the style prior to the test!
String osName = System.getProperty("os.name", "unknown");
String osVersion = System.getProperty("os.version","unknown");
if( osName.equals("Mac OS X") && osVersion.startsWith("10.9")){
Rule rule = style.featureTypeStyles().get(0).rules().get(0);
TextSymbolizer text = (TextSymbolizer)
rule.symbolizers().get(1);
FontImpl font = (FontImpl) text.getFont();
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
font.setWeight( ff.literal("light") );
}
And then to understand this new weight modifying SLDStyleFactory.styleFont
method ...
if ("light".equalsIgnoreCase(reqWeight)) {
Map<TextAttribute, Object> attributes = new
HashMap<TextAttribute, Object>();
attributes.put(TextAttribute.WEIGHT,
Float.valueOf(TextAttribute.WEIGHT_EXTRA_LIGHT) );
attributes.put(TextAttribute.SIZE, size );
return javaFont.deriveFont( attributes );
}
This result was visually very close to the reference image (but still
differed by 1000+ pixels). I also tried (with no effect) using an
AffineTransform.scale(0.5,0.5) combined with a size*2.
2) Use of various combinations of Hints in Streaming Renderer
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF );
graphics.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY );
Turning off AntiAliasing did not look very similar, but differed by 800+
pixels.
3) Changing OSX Font Smoothing preferences ... effects every other program
except Java (yes I restarted eclipse).
4) OSX 10.9 Reference Images
Since this is a known JDK bug I do not want to put a great deal of effort
into a workaround, I recommend carrying additional "osx" references images
in or codebase until it is resolved.
I was unable to directly do a pull request against your repository andrea,
if you want cherry-pick the commit here it is:
https://github.com/jodygarnett/geotools/commit/591591db05d623affd9a0e847898c00d99b6fef6
--
Jody
Jody Garnett
On Sun, Apr 27, 2014 at 1:31 PM, Jody Garnett <jody.garn...@gmail.com>wrote:
> Failure is:
>
> Tests run: 4, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.079 sec
> <<< FAILURE! - in org.geotools.renderer.lite.LabelShieldTest
> testLabelShieldMultiline(org.geotools.renderer.lite.LabelShieldTest) Time
> elapsed: 0.029 sec <<< FAILURE!
> java.lang.AssertionError: Images are visibly different, found 1036
> different pixels, against a threshold of 300
> at
> org.geotools.image.test.ImageAssert.assertImagesResemble(ImageAssert.java:124)
> at
> org.geotools.image.test.ImageAssert.assertEquals(ImageAssert.java:58)
> at
> org.geotools.renderer.lite.LabelShieldTest.testLabelShieldMultiline(LabelShieldTest.java:82)
>
> testLabelShieldMultilineStretch(org.geotools.renderer.lite.LabelShieldTest)
> Time elapsed: 0.029 sec <<< FAILURE!
> java.lang.AssertionError: Images are visibly different, found 1112
> different pixels, against a threshold of 300
> at
> org.geotools.image.test.ImageAssert.assertImagesResemble(ImageAssert.java:124)
> at
> org.geotools.image.test.ImageAssert.assertEquals(ImageAssert.java:58)
> at
> org.geotools.renderer.lite.LabelShieldTest.testLabelShieldMultilineStretch(LabelShieldTest.java:97)
>
> Jody Garnett
>
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel