public class

FontUtils

extends Object
java.lang.Object
   ↳ org.andengine.opengl.font.FontUtils

Class Overview

(c) Zynga 2012

Summary

Nested Classes
enum FontUtils.MeasureDirection  
Public Constructors
FontUtils()
Public Methods
static int breakText(IFont pFont, CharSequence pText, FontUtils.MeasureDirection pMeasureDirection, float pWidthMaximum, float[] pMeasuredWidth)
Measure the text, stopping early if the measured width exceeds pMaximumWidth.
static float measureText(IFont pFont, CharSequence pText, float[] pWidths)
static float measureText(IFont pFont, CharSequence pText, int pStart, int pEnd)
static float measureText(IFont pFont, CharSequence pText, int pStart, int pEnd, float[] pWidths)
Does not respect linebreaks!
static float measureText(IFont pFont, CharSequence pText)
static <L extends List<CharSequence>> L splitLines(CharSequence pText, L pResult)
static <L extends List<CharSequence>> L splitLines(IFont pFont, CharSequence pText, L pResult, Text.TextOptions.AutoWrap pAutoWrap, float pAutoWrapWidth)
Does not respect linebreaks!
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public FontUtils ()

Public Methods

public static int breakText (IFont pFont, CharSequence pText, FontUtils.MeasureDirection pMeasureDirection, float pWidthMaximum, float[] pMeasuredWidth)

Measure the text, stopping early if the measured width exceeds pMaximumWidth.

Parameters
pMeasureDirection If FORWARDS, starts with the first character in the CharSequence. If BACKWARDS starts with the last character in the CharSequence.
pMeasuredWidth (optional) If not null, returns the actual width measured. Must be an Array of size 1 or bigger.
Returns
  • the number of chars that were measured.

public static float measureText (IFont pFont, CharSequence pText, float[] pWidths)

Parameters
pWidths (optional) If not null, returns the actual width measured.
Returns
  • the width of pText.

public static float measureText (IFont pFont, CharSequence pText, int pStart, int pEnd)

Parameters
pStart the index of the first character to start measuring.
pEnd 1 beyond the index of the last character to measure.
Returns
  • the width of pText.

public static float measureText (IFont pFont, CharSequence pText, int pStart, int pEnd, float[] pWidths)

Does not respect linebreaks!

Parameters
pStart the index of the first character to start measuring.
pEnd 1 beyond the index of the last character to measure.
pWidths (optional) If not null, returns the actual width after each character.
Returns
  • the width of pText.

public static float measureText (IFont pFont, CharSequence pText)

Returns
  • the width of pText.

public static L splitLines (CharSequence pText, L pResult)

public static L splitLines (IFont pFont, CharSequence pText, L pResult, Text.TextOptions.AutoWrap pAutoWrap, float pAutoWrapWidth)

Does not respect linebreaks!