Package java.awt.font

Examples of java.awt.font.FontRenderContext


        RotatedTextIcon(FadingTabbedPanel.Orientation orient, String text) {
            this.orient = orient;

            Font font = getFont();
            FontRenderContext fcr = new FontRenderContext(null, true, true);
            glyphs = font.createGlyphVector(fcr, text);
            width = (int) glyphs.getLogicalBounds().getWidth() + 4;
            height = (int) glyphs.getLogicalBounds().getHeight();

            LineMetrics lineMetrics = font.getLineMetrics(text, fcr);
View Full Code Here


        );
        return xform.createTransformedShape(shape);
    }

    private static Shape stringToShape(Graphics2D g, String s, float size) {
        FontRenderContext context = g.getFontRenderContext();
        Font font = g.getFont();
        font = font.deriveFont(size);
        TextLayout text = new TextLayout(s, font, context);
        Shape shape = text.getOutline(null);
        shape = justify(shape);
View Full Code Here

        g.setPaint(oldPaint);

        String text = getText();

        Font font = g.getFont();
        FontRenderContext fontContext = g.getFontRenderContext();
        TextLayout layout = new TextLayout(text, font, fontContext);
        Rectangle2D textBounds = layout.getBounds();

        int textH = x + (int) Math.round(w - textBounds.getWidth()) / 2;
        int textV = y + (int) Math.round(h + textBounds.getHeight()) / 2;
View Full Code Here

      g.setColor(LABEL_COLOR);
      Font font = new Font(LBL_FONT_NAME, Font.PLAIN, LBL_FONT_SIZE);
      g.setFont(font);
      FontMetrics fm = g.getFontMetrics();
      int yFontOffset = fm.getMaxAscent();
      FontRenderContext frc = fm.getFontRenderContext();
      {
        double dx = envelope.getViewXMax() - envelope.getViewXMin();
        double step = Tools.FTOI(dx / (double) xnum);
        if (step < 1.0)
          step = 1.0;
View Full Code Here

        res.font = new Font(this.fontName, fontStyle, this.fontSize);
      }
      g.setFont(res.font);
      FontMetrics fm = g.getFontMetrics();
      res.yOffset = fm.getMaxAscent();
      FontRenderContext frc = fm.getFontRenderContext();
      for (TextRow row : pRows) {
        Rectangle2D rect = res.font.getStringBounds(row.text, frc);
        row.width = (int) (rect.getWidth() + 0.5);
        row.height = (int) (rect.getHeight() + 0.5);
        if (this.mode == Mode.OUTLINE) {
View Full Code Here

    }

    public FontRenderContext getFontRenderContext() {
        Graphics2D g2d = getBogusGraphics2D();

        FontRenderContext fontRenderContext = g2d.getFontRenderContext();

        g2d.dispose();

        return fontRenderContext;
    }
View Full Code Here

    }

    public FontRenderContext getFontRenderContext() {
        Graphics2D g2d = getBogusGraphics2D(true);

        FontRenderContext fontRenderContext = g2d.getFontRenderContext();

        g2d.dispose();

        return fontRenderContext;
    }
View Full Code Here

                    shearY = ran.nextDouble() * config.getTextShear();
                }
                CharAttributes cf = new CharAttributes(chars[i], fontName, dRotation, rise, shearX, shearY);
                charAttsList.add(cf);
                text = new TextLayout(chars[i] + "", getFont(fontName),
                        new FontRenderContext(null, config.isFontAntialiasing(), false));
                textAt = new AffineTransform();
                if (config.getTextRotation() > 0)
                    textAt.rotate(dRotation);
                if (config.getTextShear() > 0.0)
                    textAt.shear(shearX, shearY);               
View Full Code Here

        Graphics2D gfx = (Graphics2D) this.image.getGraphics();
        if (config.isFontAntialiasing())
            gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        int curWidth = config.getTextMarginLeft();
        FontRenderContext ctx = new FontRenderContext(null, config.isFontAntialiasing(), false);       
        for (int i = 0; i < charAttsList.size(); i++)
        {
            CharAttributes cf = (CharAttributes) charAttsList.get(i);
            TextLayout text = new TextLayout(cf.getChar() + "", getFont(cf.getName()), ctx); //gfx.getFontRenderContext());
            AffineTransform textAt = new AffineTransform();
View Full Code Here

    final double xorig     = posX+(origX-minX)*xStep;
    final double yorig     = isSouth  ? posY-yStep*(origY-minY)+labelHeight : posY-yStep*(origY-minY)-2;
    final double width     = shape.getGridWidth()/2.;
    final double tmp     = isSouth ? width : -width;
    final Font font     = fontMetrics.getFont();
    final FontRenderContext frc = new FontRenderContext(null, true, true);
    double i;
    double j;
    String label;
    float x;
    final float yPos = (float)(yorig+tmp);
View Full Code Here

TOP

Related Classes of java.awt.font.FontRenderContext

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.