Examples of canDisplay()


Examples of java.awt.Font.canDisplay()

            for (int last = start; nextEnd != -1 && nextEnd <= end; ) {
                if (isNextValid) {
                    nextEnd = f.canDisplayUpTo(textChr, nextEnd, end);
                    isNextValid = false;
                } else {
                    if (nextEnd >= end || f.canDisplay(Character.codePointAt(textChr, nextEnd, end)) ) {
                        at.addAttribute(TextAttribute.FAMILY, fallbackFont, last, Math.min(nextEnd,end));
                        if (nextEnd >= end) break;
                        last = nextEnd;
                        isNextValid = true;
                    } else {
View Full Code Here

Examples of java.awt.Font.canDisplay()

  private Rectangle2D getMaxCharBounds(Graphics2D g2d) {
    int maxWidth = 0;
    int maxHeight = 0;
    for (char c = 0; c < 256; c++) {
      Font f = g2d.getFont();
      if (f.canDisplay(c)) {
        TextLayout tl = new TextLayout("" + c, f, g2d.getFontRenderContext());
        Rectangle2D b = tl.getBounds();
        maxWidth = (int) Math.max(maxWidth, b.getWidth() + 5);
        maxHeight = (int) Math.max(maxHeight, b.getHeight() + 5);
      }
View Full Code Here

Examples of java.awt.Font.canDisplay()

        public void runTest(Object ctx, int numReps) {
            Font font = ((TextContext)ctx).font;
            boolean b = false;
            do {
                for (int i = 0; i < 0x10000; i += 0x64) {
                    b ^= font.canDisplay((char)i);
                }
            } while (--numReps >= 0);
        }
    }
View Full Code Here

Examples of java.awt.Font.canDisplay()

            int bestCount = 0;
            for (int i = 0; i < fontsToTry.length; ++i) {
                Font font = fontsToTry[i];
                int count = 0;
                for (int j = 0, limit = text.length(); j < limit; ++j) {
                    if (font.canDisplay(text.charAt(j))) {
                        ++count;
                    }
                }
                if (count > bestCount) {
                    bestFont = font;
View Full Code Here

Examples of java.awt.Font.canDisplay()

         */
        char c = text.setIndex(start);
        Map ff = text.getAttributes();
        Font font = Font.getFont(ff);

        while (!font.canDisplay(c) && (text.getRunLimit() < limit)) {
                text.setIndex(text.getRunLimit());
                font = Font.getFont(text.getAttributes());
        }

        if (!font.canDisplay(c)) {
View Full Code Here

Examples of java.awt.Font.canDisplay()

        while (!font.canDisplay(c) && (text.getRunLimit() < limit)) {
                text.setIndex(text.getRunLimit());
                font = Font.getFont(text.getAttributes());
        }

        if (!font.canDisplay(c)) {
            text.setIndex(start);
            String[] families =
                GraphicsEnvironment.getLocalGraphicsEnvironment(
                                        ).getAvailableFontFamilyNames();
            for (int i = 0; i < families.length; ++i) {
View Full Code Here

Examples of java.awt.Font.canDisplay()

            for (int i = 0; i < families.length; ++i) {
                        Hashtable ht = new Hashtable();
                        ht.putAll(ff);
                ht.put(TextAttribute.FAMILY, families[i]);
                font = Font.getFont((Map)ht);
                if (font.canDisplay(c)) {
                    break;
                }
            }

            if (!font.canDisplay(c)) {
View Full Code Here

Examples of java.awt.Font.canDisplay()

                if (font.canDisplay(c)) {
                    break;
                }
            }

            if (!font.canDisplay(c)) {
                font = Font.getFont(ff);
            }
        }

        return font;
View Full Code Here

Examples of java.awt.Font.canDisplay()

           
            // this will handle most numeric formats like decimal, hex and octal
            character = (char) Integer.decode(code).intValue();
           
            // handle charmap code reporting issues
            if(!font.canDisplay(character))
                character = (char) (0xF000 | character);
           
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(
                    "Invalid character specification " + fontElements[1], e);
View Full Code Here

Examples of java.awt.Font.canDisplay()

        char c = 0xF041;
        System.out.println((int) c);

        Font font = new Font("Wingdings", Font.PLAIN, 60);
        for (int i = 0; i < 65536; i++)
            if (font.canDisplay(i))
                System.out.println(((int) i) + ": " + Long.toHexString(i));
        GlyphVector textGlyphVector = font.createGlyphVector(FONT_RENDER_CONTEXT, new char[] { c });
        Shape shape = textGlyphVector.getOutline();
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.translate(150, 150);
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.