/**
* creates a new BuggyFontRendererDetector.
*/
protected BuggyFontRendererDetector()
{
final ExtendedConfiguration extConfiguration =
ClassicEngineBoot.getInstance().getExtendedConfig();
isAliased = extConfiguration.getBoolProperty
(ClassicEngineCoreModule.FONTRENDERER_USEALIASING_KEY);
// Another funny thing for the docs: On JDK 1.4 the font renderer changed.
// in previous versions, the font renderer was sensitive to fractional metrics,
// so that fonts were always rendered with FractionalMetrics enabled.
// Since 1.4, fonts are always rendered with FractionalMetrics disabled.
// On a 1.4 version, the aliasing has no influence on non-fractional metrics
// aliasing has no influence on any version if fractional metrics are enabled.
final FontRenderContext frcAlias = new FontRenderContext(null, true, false);
final FontRenderContext frcNoAlias = new FontRenderContext(null, false, false);
final Font font = new Font("Serif", Font.PLAIN, 10);
final String myText = "A simple text with some characters to calculate the length.";
final double wAlias = font.getStringBounds(myText, 0, myText.length(), frcAlias)
.getWidth();
final double wNoAlias =
font.getStringBounds(myText, 0, myText.length(), frcNoAlias).getWidth();
isBuggyVersion = (wAlias != wNoAlias);
final boolean buggyOverride =
extConfiguration.getBoolProperty(ClassicEngineCoreModule.FONTRENDERER_ISBUGGY_FRC_KEY);
if (DefaultSizeCalculator.VERBOSE_LOGGING)
{
DefaultSizeCalculator.logger.debug("This is a buggy version of the font-renderer context: " + isBuggyVersion);
DefaultSizeCalculator.logger.debug("The buggy-value is defined in the configuration : " + buggyOverride);