Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.Font.charWidth()


        final int stringWidth = font.stringWidth(str);

        if (width >= stringWidth) {
            return str.length();
        }
        final int widthForTruncatedText = width - font.charWidth(truncationMark);
        int availableLength;
        for (availableLength = str.length() - 1 ;
             font.substringWidth(str,0,availableLength) > widthForTruncatedText;
             availableLength-- ) {};
        return availableLength;
View Full Code Here


      currentChar = nextChar;
      // we do not consider kerning for performance reasons. This may result in
      // breaking the line slightly too early, which should be fine.
      // TODO(haustein) consider summing up word lengths instead
      w += currentChar < widths.length ? widths[currentChar] :
        font.charWidth(currentChar);
    }

    TextFragmentWidget next = getNextSibling(parent, myIndex);
    if (next == null) {
      return w <= maxWidth ? Integer.MAX_VALUE : bestPos;
View Full Code Here

                currentLineWidth = 0;
              }
              wordWidth = 0;
            }
            c = d;
            wordWidth += c < widths.length ? widths[c] : font.charWidth(c);
          }
          if (c == '\n') {
            maxW = Math.max(maxW, currentLineWidth);
            currentLineWidth = 0;
          }
View Full Code Here

        int size = 0;
        int L = text.length();
        Font font = g.getFont();
        for(int i = 0;i < L;++i)
        {
            size += font.charWidth(text.charAt(i));
        }

        return size;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.