congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TextSizingUtility.computeTextHeight
Code IndexAdd Tabnine to your IDE (free)

How to use
computeTextHeight
method
in
ch.sahits.game.openpatrician.javafx.control.TextSizingUtility

Best Java code snippets using ch.sahits.game.openpatrician.javafx.control.TextSizingUtility.computeTextHeight (Showing top 4 results out of 315)

origin: ch.sahits.game/OpenPatricianJavaFX

/**
 * Compute the line height and add it to the page height.
 * @param line to be checked
 * @param currentPageHeight current page height without <code>line</code>
 * @return new page height
 */
private double updatePageHeight(String line, double currentPageHeight) {
  double lineHeigth = sizing.computeTextHeight(font, line, Double.MAX_VALUE);
  currentPageHeight += lineSpacing + lineHeigth;
  return currentPageHeight;
}

origin: ch.sahits.game/OpenPatricianJavaFX

double computeTextHeight(Font font, String text, double wrappingWidth) {
  return computeTextHeight(font, text, wrappingWidth, 0);
}
origin: ch.sahits.game/OpenPatricianJavaFX

/**
 * Calculate the dimensions of a string using the font with the number of characters.
 * The height  and width are the maximum value, the width of a character is an average value.
 * @param size number of carachters for wich to calculate the dimensions
 * @param font to be used
 * @return dimensions of a String containing Tg to calculate the heigth and n for the width calculation.
 */
@Override
public Dimension2D calculate(int size, Font font) {
  double height = computeTextHeight(font, "Tg", Double.MAX_VALUE);
  double width = computeTextWidth(font, "n", Double.MAX_VALUE);
  return new Dimension2D(width*size*.8, height*1.2);
}
origin: ch.sahits.game/OpenPatricianJavaFX

/**
 * Calculate the dimensions of a string using the font with the characters in the string.
 * The height and width are the maximum value. The text will not be wrapped.
 * @param text for which to calculate the dimensions
 * @param font to be used for the calculation
 * @return Bounding box for the text using font.
 */
@Override
public Dimension2D calculate(String text, Font font) {
  double height = computeTextHeight(font, text, Double.MAX_VALUE);
  double width = computeTextWidth(font, text, Double.MAX_VALUE);
  return new Dimension2D(width, height*1.2);
}
ch.sahits.game.openpatrician.javafx.controlTextSizingUtilitycomputeTextHeight

Popular methods of TextSizingUtility

  • <init>
  • calculate
    Calculate the dimensions of a string using the font with the characters in the string. The height an
  • computeTextWidth
  • guessNumberOfCharacters
    Guess the number of characters that can be displayed in destWidth. The number is guessed as an arbit

Popular in Java

  • Finding current android device location
  • runOnUiThread (Activity)
  • startActivity (Activity)
  • getExternalFilesDir (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now