Examples of charWidth()


Examples of java.awt.FontMetrics.charWidth()

                        nextX = (int) e.nextTabStop((float) nextX, startOffset + i - txtOffset);
                    } else {
                        nextX += metrics.charWidth(' ');
                    }
                } else if (txt[i] == ' ') {
                    nextX += metrics.charWidth(' ') + spaceAddon;
                    if (i <= spaceAddonLeftoverEnd) {
                        nextX++;
                    }
                }
                x = nextX;
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

            SwingUtilities2.drawString(c, g2d, text, x, y);

            if (mnemonicIndex >= 0 && mnemonicIndex < text.length()) {
                int underlineX      = x + SwingUtilities2.stringWidth(c, fm, text.substring(0, mnemonicIndex));
                int underlineY      = y;
                int underlineWidth  = fm.charWidth(text.charAt(mnemonicIndex));
                int underlineHeight = 1;

                g2d.fillRect(underlineX, underlineY + fm.getDescent() - 1, underlineWidth, underlineHeight);
            }
        }
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

            for (int i = 0; i < characterToShow.length(); i++) {

                // this is a separate canvas used for the character so that
                // we can rotate it independently
                int charWidth = fontMetrics.charWidth(characterToShow.charAt(i));
                int charDim = Math.max(maxAdvance, fontHeight);
                int halfCharDim = (charDim / 2);

                BufferedImage charImage =
                        new BufferedImage(charDim, charDim, BufferedImage.TYPE_INT_ARGB);
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

        char c = segmentArray[i + segmentOffset];
        int charWidth;
        if( c == '\t' )
          charWidth = ( int )painter.nextTabStop( width, i ) - width;
        else
          charWidth = fm.charWidth( c );

        if( painter.isBlockCaretEnabled() )
        {
          if( x - charWidth <= width )
            return i;
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

          char c = segmentArray[segmentOffset + offset + i];
          int charWidth;
          if( c == '\t' )
            charWidth = ( int )painter.nextTabStop( width, offset + i ) - width;
          else
            charWidth = fm.charWidth( c );

          if( painter.isBlockCaretEnabled() )
          {
            if( x - charWidth <= width )
              return offset + i;
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

      fPosition = new int[len];
      char ch;
      for( int i = 0; i < len; i++ )
      {
        ch = data[i];
        fCharWidths[i] = fm.charWidth( ch );
        if( fCharWidths[i] > fWidth )
          fWidth = fCharWidths[i];
        fCharStrings[i] = new String( data, i, 1 );
        // small kana and punctuation
        if( sDrawsInTopRight.indexOf( ch ) >= 0 ) // if ch is in
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

    flushIndex = i + 1;
                if (txt[i] == '\t') {
                    if (e != null) {
                        nextX = (int) e.nextTabStop((float) nextX, startOffset + i - txtOffset);
                    } else {
                        nextX += metrics.charWidth(' ');
                    }
                } else if (txt[i] == ' ') {
                    nextX += metrics.charWidth(' ') + spaceAddon;
                    if (i <= spaceAddonLeftoverEnd) {
                        nextX++;
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

                        nextX = (int) e.nextTabStop((float) nextX, startOffset + i - txtOffset);
                    } else {
                        nextX += metrics.charWidth(' ');
                    }
                } else if (txt[i] == ' ') {
                    nextX += metrics.charWidth(' ') + spaceAddon;
                    if (i <= spaceAddonLeftoverEnd) {
                        nextX++;
                    }
                }
    x = nextX;
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

    }

    public void testSetFont() {
        Font oldFont = jtf.getFont();
        FontMetrics fm = jtf.getFontMetrics(oldFont);
        assertEquals(fm.charWidth('m'), jtf.getColumnWidth());
        jtf.wasCallRevalidate = false;
        Font newFont = new java.awt.Font("SimSun", 0, 12);
        jtf.setFont(newFont);
        assertTrue(jtf.wasCallRevalidate);
        fm = jtf.getFontMetrics(newFont);
View Full Code Here

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
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.