Examples of charsWidth()


Examples of java.awt.FontMetrics.charsWidth()

          // But, we assume the approximation is close enough for
          // our drawing a dot for the space.

          // "flushLen+1" ensures text is aligned correctly (or,
          // aligned the same as in getWidth()).
          nextX = x+fm.charsWidth(text, flushIndex,flushLen+1);
          int width = fm.charWidth(' ');

          // Paint background.
          if (bg!=null) {
            paintBackground(x,y, nextX-x,height, g,
View Full Code Here

Examples of java.awt.FontMetrics.charsWidth()

          break;

      }
    }

    nextX = x+fm.charsWidth(text, flushIndex,flushLen);

    if (flushLen>0 && nextX>=clipStart) {
      if (bg!=null) {
        paintBackground(x,y, nextX-x,height, g,
              ascent, host, bg);
View Full Code Here

Examples of java.awt.FontMetrics.charsWidth()

    // Note different token types (MLC's, whitespace) could possibly be
    // using different fonts, which means we can't cache the actual width
    // of a tab as it may be different per-token-type.  We could keep a
    // per-token-type cache, but we'd have to clear it whenever they
    // modified token styles.
    int tabW = fm.charsWidth(tabBuf, 0, tabSize);

    // Draw any tab lines.  Here we're assuming that "x" is the left
    // margin of the editor.
    g.setColor(host.getTabLineColor());
    int x0 = x + tabW;
View Full Code Here

Examples of java.awt.FontMetrics.charsWidth()

    g.setFont(new Font(font.getName(), font.getStyle(), fontSize));

    FontMetrics fontMetrics = g.getFontMetrics();
    int vMargin = fontSize + height / 8;
    int hMargin = (width - fontMetrics.charsWidth(text.toCharArray(), 0,
        text.length())) / 2;

    g.setColor(color);
    g.drawString(text, x + hMargin, y + vMargin);
  }
View Full Code Here

Examples of java.awt.FontMetrics.charsWidth()

            SWContext swctx = (SWContext)ctx;
            FontMetrics fm = swctx.fm;
            char[] chars = swctx.chars;
            int wid = 0;
            do {
                wid += fm.charsWidth(chars, 0, chars.length);
            } while (--numReps >= 0);
        }
    }

    public static class CharsBounds extends TextMeasureTests {
View Full Code Here

Examples of java.awt.FontMetrics.charsWidth()

            char[] chars = swctx.chars;
            int wid = 0;
            Rectangle r = null;
            do {
                r = null;
                int dx = fm.charsWidth(chars, 0, chars.length);
                int dy = fm.getAscent() + fm.getDescent() + fm.getLeading();
                int x = 0;
                int y = -fm.getAscent();
                r = new Rectangle(x, y, dx, dy);
            } while (--numReps >= 0);
View Full Code Here

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

                x += button.image.getWidth() + 2;
            }
            else if( button.text != null )
            {
                final String text = button.text;
                final int width = font.charsWidth(
                        text.toCharArray(),
                        0,
                        text.length()
                ) + 2;
                if( isSelected )
View Full Code Here

Examples of org.albite.font.AlbiteFont.charsWidth()

                        if (parser.length == 0) {
                            continue line;
                        }

                        wordPixelWidth = font.charsWidth(buffer,
                                parser.position, parser.length);

                        if (!firstWord) {
                            /*
                             * If it is not the first word, it will need the
View Full Code Here

Examples of org.albite.font.AlbiteFont.charsWidth()

                                 * wordInfo.length - 2: starts from one before
                                 * the last
                                 */
                                for (int i = parser.length - 2; i > 0; i--) {
                                    if (info.isHyphenationPossible(i)) {
                                        wordPixelWidth = font.charsWidth(buffer,
                                                parser.position, i) + dashWidth;

                                        /*
                                         * This part of the word fits on the line
                                         */
 
View Full Code Here

Examples of org.albite.font.AlbiteFont.charsWidth()

                            /*
                             * The word could not be hyphenated. Could it fit
                             * into a single line at all?
                             */
                            if (font.charsWidth(buffer, parser.position,
                                    parser.length) > width) {

                                /* This word neither hyphenates, nor does it
                                 * fit at all on a single line, so one should
                                 * force hyphanation on it!
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.