private int addLabelsInternal(GL10 gl,Paint textPaint,boolean drawToCanvas,LabelData[] labels){
  int u=0;
  int v=0;
  int lineHeight=0;
  for (  LabelData label : labels) {
    int ascent=0;
    int descent=0;
    int measuredTextWidth=0;
    int height=0;
    int width=0;
    int fontSize=label.getFontSize();
    do {
      textPaint.setColor(0xff000000 | label.getColor());
      textPaint.setTextSize(fontSize * mRes.getDisplayMetrics().density);
      ascent=(int)Math.ceil(-textPaint.ascent());
      descent=(int)Math.ceil(textPaint.descent());
      measuredTextWidth=(int)Math.ceil(textPaint.measureText(label.getText()));
      height=ascent + descent;
      width=measuredTextWidth;
      fontSize--;
    }
 while (fontSize > 0 && width > mRes.getDisplayMetrics().widthPixels);
    int nextU;
    if (u + width > mStrikeWidth) {
      u=0;
      nextU=width;
      v+=lineHeight;
      lineHeight=0;
    }
 else {
      nextU=u + width;
    }
    lineHeight=Math.max(lineHeight,height);
    if (v + lineHeight > mStrikeHeight && drawToCanvas) {
      throw new IllegalArgumentException("Out of texture space.");
    }
    int vBase=v + ascent;
    if (drawToCanvas) {
      mCanvas.drawText(label.getText(),u,vBase,textPaint);
      label.setTextureData(width,height,u,v + height,width,-height,mTexelWidth,mTexelHeight);
    }
    u=nextU;
  }
  return v + lineHeight;
}

private int addLabelsInternal ( GL10 gl , Paint textPaint , boolean drawToCanvas , LabelData [ ] labels ) { int u = 0 ; int v = 0 ; int lineHeight = 0 ; for ( LabelData label : labels ) { int ascent = 0 ; int descent = 0 ; int measuredTextWidth = 0 ; int height = 0 ; int width = 0 ; int fontSize = label . getFontSize ( ) ; do { textPaint . setColor ( 0xff000000 | label . getColor ( ) ) ; textPaint . setTextSize ( fontSize * mRes . getDisplayMetrics ( ) . density ) ; ascent = ( int ) Math . ceil ( - textPaint . ascent ( ) ) ; descent = ( int ) Math . ceil ( textPaint . descent ( ) ) ; measuredTextWidth = ( int ) Math . ceil ( textPaint . measureText ( label . getText ( ) ) ) ; height = ascent + descent ; width = measuredTextWidth ; fontSize -- ; } while ( fontSize > 0 && width > mRes . getDisplayMetrics ( ) . widthPixels ) ; int nextU ; if ( u + width > mStrikeWidth ) { u = 0 ; nextU = width ; v += lineHeight ; lineHeight = 0 ; } else { nextU = u + width ; } lineHeight = Math . max ( lineHeight , height ) ; if ( v + lineHeight > mStrikeHeight && drawToCanvas ) { throw new IllegalArgumentException ( "Out of texture space." ) ; } int vBase = v + ascent ; if ( drawToCanvas ) { mCanvas . drawText ( label . getText ( ) , u , vBase , textPaint ) ; label . setTextureData ( width , height , u , v + height , width , - height , mTexelWidth , mTexelHeight ) ; } u = nextU ; } return v + lineHeight ; }
call to add a list of labels
