Package java.awt.font

Examples of java.awt.font.FontRenderContext


         * but the docs say nothing about what particular character is used.
         * '0' looks a good choice.
         */
        char defaultChar = '0';
      
        FontRenderContext frc = new FontRenderContext(null, true, true);

        HSSFWorkbook wb = new HSSFWorkbook(book);
        HSSFFont defaultFont = wb.getFontAt((short) 0);

        str = new AttributedString("" + defaultChar);
View Full Code Here


    public void shear(double d, double d1) {
        throw new RuntimeException("Not implemented");
    }

    public FontRenderContext getFontRenderContext() {
        return new FontRenderContext(transform, true, true);
    }
View Full Code Here

    /**
     * Adjust the size of the TextBox so it encompasses the text inside it.
     */
    public void resizeToFitText(){
        try{
        FontRenderContext frc = new FontRenderContext(null, true, true);
        RichTextRun rt = _txtrun.getRichTextRuns()[0];
        int size = rt.getFontSize();
        int style = 0;
        if (rt.isBold()) style |= Font.BOLD;
        if (rt.isItalic()) style |= Font.ITALIC;
View Full Code Here

                        , this);
                float[] comps = coverScreenData
                .getTextColor().getColorArray();
                g2d.setColor(new Color(comps[0],comps[1],comps[2]));
                Font font = new Font("Arial", Font.BOLD,20);
                FontRenderContext frc1 = new FontRenderContext(null, true, true);
                Rectangle2D rec = font.getStringBounds(coverScreenData.getMessage(), frc1);
                int w = (int) (rec.getWidth());
                int h = (int) (rec.getHeight());
                g2d.setFont(font);
                g2d.drawString(coverScreenData.getMessage()
View Full Code Here

                        , this);
                float[] comps = coverScreenData
                .getTextColor().getColorArray();
                g2d.setColor(new Color(comps[0],comps[1],comps[2]));
                Font font = new Font("Arial", Font.BOLD,20);
                FontRenderContext frc1 = new FontRenderContext(null, true, true);
                Rectangle2D rec = font.getStringBounds(coverScreenData.getMessage(), frc1);
                int w = (int) (rec.getWidth());
                int h = (int) (rec.getHeight());
                g2d.setFont(font);
                g2d.drawString(coverScreenData.getMessage()
View Full Code Here

    public static void generatePdf(ReportContext context, Report report,
            OutputStream out) throws IOException {
        try {
            PageStore pageStore = new PageStore();
            FontRenderContext frc = new FontRenderContext(null, true, true);
            Formatter fmt = new Formatter(report, context, frc, pageStore);
            PageLayout layout = report.getPageLayout();
            Rectangle2D bounds = layout.getBounds(Unit.PT);
            Rectangle2D drawable = layout.getDrawableArea(Unit.PT);
            Paper paper = new Paper();
View Full Code Here

                    RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                    RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
                    RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
            FontRenderContext frc = g2d.getFontRenderContext();
            LineBreakMeasurer lbm = new LineBreakMeasurer(
                    textBuilder.getIterator(), frc);
            float width = getWidth()-15;
            float x = 8;
            float y = 0;
View Full Code Here

                    Report report = ReportReader.load(Test4.class.getResource("test4.xml"));
                    ReportContext context = new ReportContext();
                    context.define("items", items);
                    PdfGenerator.generatePdf(context, report, new File("out4.pdf"));
                    PageStore pageStore = new PageStore();
                    FontRenderContext frc = new FontRenderContext(null, true, true);
                    Formatter fmt = new Formatter(report, context, frc, pageStore);
                    long tm = System.currentTimeMillis();
                    tm = System.currentTimeMillis()-tm;
                    System.out.println("Time for formatting: " + tm + "ms");
                    PreviewDialog frame = new PreviewDialog(null, fmt, pageStore);
View Full Code Here

    public static double drawTextAt(final String text, final Font font,
            final Graphics2D g2, final int width, final double aY,
            final Color foreGround) {
        double y = aY;
        if (text != null && text.length() > 0) {
            FontRenderContext context = g2.getFontRenderContext();
            TextLayout layout = new TextLayout(text, font, context);
            Rectangle2D bounds = layout.getBounds();
            g2.setColor(foreGround);
            float textX = (float) (width - bounds.getWidth()) / 2;
            y = (float) (y + layout.getLeading() + 2 * layout.getAscent());
 
View Full Code Here

      double shearX = rng.nextDouble() * 0.2;
      double shearY = rng.nextDouble() * 0.2;
      CharAttributes cf = new CharAttributes(ch, fontName, rotation, rise, shearX, shearY);
      charAttsList.add(cf);
      text = new TextLayout(ch + "", getFont(fontName), new FontRenderContext(null, false,
        false));
      textAt = new AffineTransform();
      textAt.rotate(rotation);
      textAt.shear(shearX, shearY);
      shape = text.getOutline(textAt);
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.