int spanX = (int) getPreferredSpan(X_AXIS); int spanY = (int) getPreferredSpan(Y_AXIS); Rectangle dummyAlloc = new Rectangle(0, 0, spanX, spanY); Position.Bias[] biasRet = new Position.Bias[1]; int offset1 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet); int offset2 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet); Segment txt = getText(offset1, offset2); BreakIterator lineBreaker = BreakIterator.getLineInstance(); lineBreaker.setText(txt); int breakLoc = lineBreaker.previous(); if (breakLoc == offset1) weight = View.BadBreakWeight; else if(breakLoc ==  BreakIterator.DONE) weight = View.GoodBreakWeight; else weight = View.ExcellentBreakWeight;
weight = GoodBreakWeight;
  public int getBreakWeight(int axis, float pos, float len)  {    int weight;    if (axis == Y_AXIS)      weight = super.getBreakWeight(axis, pos, len);    else      {        // Determine the model locations at pos and pos + len.        int spanX = (int) getPreferredSpan(X_AXIS);        int spanY = (int) getPreferredSpan(Y_AXIS);        Rectangle dummyAlloc = new Rectangle(0, 0, spanX, spanY);        Position.Bias[] biasRet = new Position.Bias[1];        int offset1 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet);        int offset2 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet);        Segment txt = getText(offset1, offset2);        BreakIterator lineBreaker = BreakIterator.getLineInstance();        lineBreaker.setText(txt);        int breakLoc = lineBreaker.previous();        if (breakLoc == offset1)          weight = View.BadBreakWeight;        else if(breakLoc ==  BreakIterator.DONE)          weight = View.GoodBreakWeight;        else          weight = View.ExcellentBreakWeight;      }    return weight;  }