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, CharSequence text, int pixel, float size)
          get index into text from a given pixel position.
static char getNextCharacter(CharSequence text, int i)
           
static char getPrevCharacter(CharSequence text, int i)
           
static int getVisibleCharactersFromEnd(RenderFont font, CharSequence 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, CharSequence 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,
                                                CharSequence 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,
                                              CharSequence 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,
                                                     CharSequence 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(CharSequence text,
                                    int i)
Parameters:
text -
i -
Returns:

getPrevCharacter

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


Copyright © 2012. All Rights Reserved.