Package java.awt

Examples of java.awt.Font.canDisplayUpTo()


        catch (ClassCastException e) {
        }
        if (font == null) {
            if (attributes.get(TextAttribute.FAMILY) != null) {           
                font = Font.getFont(attributes);
                if (font.canDisplayUpTo(text, start, limit) != -1) {
                    return null;
                }
            } else {
                FontResolver resolver = FontResolver.getInstance();
                CodePointIterator iter = CodePointIterator.create(text, start, limit);
View Full Code Here


      Font font = fonts.get(fontName);
      if (font == null) {
        font = new Font(fontName, fallbackFont.getStyle(), fallbackFont.getSize());
      }

      if (font.canDisplayUpTo(text) == -1) {
        logger.info("Font '{}' was capable, returning", fontName);
        font = font.deriveFont(fallbackFont.getSize2D());
        return font;
      }
    }
View Full Code Here

    String text = label.getText();
    if (text == null) {
      return;
    }
    Font font = label.getFont();
    int canDisplay = font.canDisplayUpTo(text);
    if (canDisplay != -1) {
      logger.warn("Default font ('{}') was unable to display text ('{}'), searching for alternative.", font.getName(),
          text);

      // if the label contains undisplayable characters, look for a
View Full Code Here

     */
    private int checkFontSetting(Font font,String content){
      if(font.canDisplayUpTo(content) >= 0){
          //try default chinese font
          Font tryFont = Font.decode("新宋体");
          if(tryFont.canDisplayUpTo(content) == -1){
            return 0;
          } else {
            return -1;
          }
      }
View Full Code Here

        else
        {
            // mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage
            // for font with bad cmaps?
            // Type1 fonts are not affected as they don't have cmaps
            if (!isType1Font() && awtFont.canDisplayUpTo(string) != -1)
            {
                LOG.warn("Changing font on <" + string + "> from <"
                        + awtFont.getName() + "> to the default font");
                awtFont = Font.decode(null).deriveFont(1f);
            }
View Full Code Here

            int style = (rt[i].isBold() ? Font.BOLD : 0) | (rt[i].isItalic() ? Font.ITALIC : 0);
            Font f = new Font(mappedFont, style, rt[i].getFontSize());
           
            // check for unsupported characters and add a fallback font for these
            char textChr[] = text.toCharArray();
            int nextEnd = f.canDisplayUpTo(textChr, start, end);
            boolean isNextValid = nextEnd == start;
            for (int last = start; nextEnd != -1 && nextEnd <= end; ) {
                if (isNextValid) {
                    nextEnd = f.canDisplayUpTo(textChr, nextEnd, end);
                    isNextValid = false;
View Full Code Here

            char textChr[] = text.toCharArray();
            int nextEnd = f.canDisplayUpTo(textChr, start, end);
            boolean isNextValid = nextEnd == start;
            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;
View Full Code Here

        Theme theme = Theme.getTheme();
        Font font = theme.getFont();

        // Search for a font that can support the sample string
        String sampleResource = (String)resources.get("firstName");
        if (font.canDisplayUpTo(sampleResource) != -1) {
            Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();

            for (int i = 0; i < fonts.length; i++) {
                if (fonts[i].canDisplayUpTo(sampleResource) == -1) {
                    theme.setFont(fonts[i].deriveFont(Font.PLAIN, 12));
View Full Code Here

   */
  public boolean canDisplayAllText() {
    String text = getText();
    Font font = getFont();
    if ((text != null) && (font != null)) {
      return (font.canDisplayUpTo(text) == -1);
    }
    return true;
  }

  /**
 
View Full Code Here

        else
        {
            // mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage
            // for font with bad cmaps?
            // Type1 fonts are not affected as they don't have cmaps
            if (!isType1Font() && awtFont.canDisplayUpTo(string) != -1)
            {
                LOG.warn("Changing font on <" + string + "> from <"
                        + awtFont.getName() + "> to the default font");
                awtFont = Font.decode(null).deriveFont(1f);
            }
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.