Package java.awt.font

Examples of java.awt.font.GlyphVector


        if ( graphics.getFont().getSize() > threshold && level > NONE ) {
            prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
       
        GlyphVector vector = graphics.getFont().createGlyphVector(
                graphics.getFontRenderContext(), string);
       
        adjustGlyphPositions(string, info, vector);
       
        graphics.drawGlyphVector(vector, x, y);
View Full Code Here


       
        if ( graphics.getFont().getSize() > threshold && level > NONE ) {
            prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
        GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector();
        graphics.drawGlyphVector(vector, (int)x, (int)y );
        if ( graphics.getFont().getSize() > threshold && level > NONE ) {
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
        }
    }
View Full Code Here

        if (awtFont.getSize() > threshold && level > NONE ) {
            prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
       
        GlyphVector vector = awtFont.createGlyphVector(
                graphics.getFontRenderContext(),
                text);
        float[] result = vector.getGlyphPositions(0, text.length() + 1, null);
       
        if (awtFont.getSize() > threshold && level > NONE ) {
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
        }
       
View Full Code Here

        if (awtFont.getSize() > threshold && level > NONE ) {
            prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
       
        GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector();
       
        Rectangle result = vector.getGlyphPixelBounds(index, graphics.getFontRenderContext(), x, y);
       
        if (awtFont.getSize() > threshold && level > NONE ) {
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
        }
       
View Full Code Here

        if (awtFont.getSize() > threshold && level > NONE ) {
            prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
       
        GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector();
       
        float[] result = vector.getGlyphPositions(0, vector.getNumGlyphs() + 1, null);
       
        if (awtFont.getSize() > threshold && level > NONE ) {
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
        }
       
View Full Code Here

        if (awtFont.getSize() > threshold && level > NONE ) {
            prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
       
        GlyphVector vector = awtFont.createGlyphVector(
                graphics.getFontRenderContext(),
                text);
       
        if (awtFont.getSize() > threshold && level > NONE ) {
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
View Full Code Here

    protected void renderString(Graphics g, String string, int x, int y) {
        if (g instanceof Graphics2D) {
            Graphics2D g2 = (Graphics2D) g;
            if (getTextMatteColor() != null) {
                FontRenderContext context = g2.getFontRenderContext();
                GlyphVector glyphVector = g2.getFont()
                        .createGlyphVector(context, string);
                Shape outline = glyphVector.getOutline();
                g2.translate(x, y);
                g2.setStroke(getTextMatteStroke());
                g2.setColor(getTextMatteColor());
                g2.draw(outline);
                g2.translate(-x, -y);
View Full Code Here

  }


  protected void updateText(final String text, final float x, final float y, final Font font, final FontRenderContext frc) {
    final char[] textChars = text.toCharArray();
    final GlyphVector gv   = font.layoutGlyphVector(frc, textChars, 0, textChars.length, 0);
    pathLabels.append(gv.getOutline(x, y), false);
  }
View Full Code Here

   
    /** Layouts out glyphs on the texture. */
    private void layoutGlyphs() {
      if ( name == null ) return;
     
      GlyphVector glyphVector;
      java.awt.font.GlyphMetrics gm = null;
      int lowest = 1;
      int highest = 200;
      float overrun;
      int lastsize = 0;
     
        size = 100;
      
        // Binary search for optimal font size
        do {
          font = new Font(name, style, size);
          glyphVector = font.createGlyphVector(frc, chars);
            nextx = maxHeight = 0;
            nexty = 1;
          for (int i = 0; i < chars.length; i++) {
            gm = glyphVector.getGlyphMetrics(i);
              metrics[i].setMetrics(gm);
          }
          overrun = (metrics[chars.length-1].boundy + maxHeight) - image.getHeight();
          if ( overrun > 0 ) {
            lastsize = highest = size;
View Full Code Here

    public void drawString(String s, float x, float y) {
        if (super.textAsShapes) {
            Font font = super.getFont();
            FontRenderContext frc = super.getFontRenderContext();
            GlyphVector gv = font.createGlyphVector(frc, s);
            Shape glyphOutline = gv.getOutline(x, y);
            super.fill(glyphOutline);
        } else {
            super.drawString(s, x, y);
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.font.GlyphVector

Copyright © 2018 www.massapicom. 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.