de.lessvoid.nifty.elements.tools
Class FontHelper

java.lang.Object
  extended by de.lessvoid.nifty.elements.tools.FontHelper

public class FontHelper
extends Object


Constructor Summary
FontHelper()
           
 
Method Summary
static int getCharacterIndexFromPixelPosition(RenderFont font, String text, int pixel, float size)
          get index into text from a given pixel position.
static char getNextCharacter(String text, int i)
           
static char getPrevCharacter(String text, int i)
           
static int getVisibleCharactersFromEnd(RenderFont font, String text, int width, float size)
          Get character index into the given text that is no more pixel as the given width.
static int getVisibleCharactersFromStart(RenderFont font, String text, int width, float size)
          Get character index into the given text that is no more pixel as the given width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontHelper

public FontHelper()
Method Detail

getVisibleCharactersFromStart

public static int getVisibleCharactersFromStart(RenderFont font,
                                                String text,
                                                int width,
                                                float size)
Get character index into the given text that is no more pixel as the given width.

Parameters:
font - font
text - the string to check
width - the minimum width
Returns:
the character index into the string.

getVisibleCharactersFromEnd

public static int getVisibleCharactersFromEnd(RenderFont font,
                                              String text,
                                              int width,
                                              float size)
Get character index into the given text that is no more pixel as the given width.

Parameters:
font - font
text - the string to check
width - the minimum width
Returns:
the character index into the string.

getCharacterIndexFromPixelPosition

public static int getCharacterIndexFromPixelPosition(RenderFont font,
                                                     String text,
                                                     int pixel,
                                                     float size)
get index into text from a given pixel position.

Parameters:
font - font
text - text string
pixel - pixel index
size - font size
Returns:
index into text string

getNextCharacter

public static char getNextCharacter(String text,
                                    int i)
Parameters:
text -
i -
Returns:

getPrevCharacter

public static char getPrevCharacter(String text,
                                    int i)
Parameters:
text -
i -
Returns:


Copyright © 2011. All Rights Reserved.