![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.plantuml.klimt.drawing.debug.StringBounderDebug Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.klimt.drawing.debug;
import java.util.Random;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.klimt.font.StringBounderRaw;
import net.sourceforge.plantuml.klimt.font.UFont;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
public class StringBounderDebug extends StringBounderRaw {
// ::remove folder when __HAXE__
// ::remove folder when __CORE__
public StringBounderDebug() {
super(FileFormat.gg.getFontRenderContext());
}
@Override
protected XDimension2D calculateDimensionInternal(UFont font, String text) {
final Random rnd = new Random(StringUtils.seed(text));
// We want a random factor between 80% et 130%
final double factor = 0.8 + 0.5 * rnd.nextDouble();
final double size = font.getSize2D();
final double height = size;
final double width = size * text.length() * factor;
return new XDimension2D(width, height);
}
@Override
public double getDescent(UFont font, String text) {
final double descent = font.getSize2D() / 4.5;
return descent;
}
@Override
public boolean matchesProperty(String propertyName) {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy