de.ukn.hci.squidy.designer.util
Class FontUtils

java.lang.Object
  extended by de.ukn.hci.squidy.designer.util.FontUtils

public class FontUtils
extends Object

FontUtils.

 Date: Feb 1, 2009
 Time: 3:41:31 PM
 

Since:
2.0
Version:
$Id: FontUtils.java 30 2009-09-18 22:23:35Z nitsche $
Author:
Roman Rädle, Roman.Raedle@uni-konstanz.de, University of Konstanz

Constructor Summary
FontUtils()
           
 
Method Summary
static String createCroppedLabelIfNecessary(FontMetrics fontMetrics, String label, int availableWidth)
           
static int getLineCount(String text, float width)
           
static String getStringForMaxWidth(FontMetrics fm, String s, int maxWidth)
          Returns a string that fit into the maximum width based on the parameter string.
static int getWidthOfDots(FontMetrics fontMetrics)
           
static int getWidthOfText(FontMetrics fontMetrics, String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontUtils

public FontUtils()
Method Detail

createCroppedLabelIfNecessary

public static String createCroppedLabelIfNecessary(FontMetrics fontMetrics,
                                                   String label,
                                                   int availableWidth)
Parameters:
fontMetrics -
label -
availableWidth -
Returns:

getWidthOfDots

public static int getWidthOfDots(FontMetrics fontMetrics)
Parameters:
fontMetrics -
Returns:

getWidthOfText

public static int getWidthOfText(FontMetrics fontMetrics,
                                 String text)
Parameters:
fontMetrics -
text -
Returns:

getStringForMaxWidth

public static String getStringForMaxWidth(FontMetrics fm,
                                          String s,
                                          int maxWidth)
Returns a string that fit into the maximum width based on the parameter string. It returns the orignal string if it fit into the maximum width otherwise it returns a cut string extended with "..." string.

Parameters:
fm - The metrics of the font to be calculated with.
s - The string to calculate its width.
maxWidth - The maximum width the string is allowed to take.
Returns:
The orignal string if it fit into the maximum width otherwise it returns a cut string extended with "..." string.

getLineCount

public static int getLineCount(String text,
                               float width)
Parameters:
text -
Returns:


Copyright © 2007-2010 Human-Computer-Interaction :: University of Konstanz. All Rights Reserved.