Package net.sf.jasperreports.engine.fonts

Examples of net.sf.jasperreports.engine.fonts.FontFace


      }
      else
      {
        //fontName found in font extensions
        FontFamily family = fontInfo.getFontFamily();
        FontFace face = fontInfo.getFontFace();
        int faceStyle = java.awt.Font.PLAIN;

        if (face == null)
        {
          //fontName matches family name in font extension
          if (jrFont.isBold() && jrFont.isItalic())
          {
            face = family.getBoldItalicFace();
            faceStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC;
          }
         
          if (face == null && jrFont.isBold())
          {
            face = family.getBoldFace();
            faceStyle = java.awt.Font.BOLD;
          }
         
          if (face == null && jrFont.isItalic())
          {
            face = family.getItalicFace();
            faceStyle = java.awt.Font.ITALIC;
          }
         
          if (face == null)
          {
            face = family.getNormalFace();
            faceStyle = java.awt.Font.PLAIN;
          }
           
//          if (face == null)
//          {
//            throw new JRRuntimeException("Font family '" + family.getName() + "' does not have the normal font face.");
//          }
        }
        else
        {
          //fontName matches face name in font extension; not family name
          faceStyle = fontInfo.getStyle();
        }
       
        String pdfFontName = null;
        int pdfFontStyle = java.awt.Font.PLAIN;
        if (jrFont.isBold() && jrFont.isItalic())
        {
          pdfFontName = family.getBoldItalicPdfFont();
          pdfFontStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC;
        }
       
        if (pdfFontName == null && jrFont.isBold())
        {
          pdfFontName = family.getBoldPdfFont();
          pdfFontStyle = java.awt.Font.BOLD;
        }
       
        if (pdfFontName == null && jrFont.isItalic())
        {
          pdfFontName = family.getItalicPdfFont();
          pdfFontStyle = java.awt.Font.ITALIC;
        }
       
        if (pdfFontName == null)
        {
          pdfFontName = family.getNormalPdfFont();
          pdfFontStyle = java.awt.Font.PLAIN;
        }

        if (pdfFontName == null)
        {
          //in theory, face file cannot be null here
          pdfFontName = (face == null || face.getFile() == null ? jrFont.getPdfFontName() : face.getFile());
          pdfFontStyle = faceStyle;//FIXMEFONT not sure this is correct, in case we inherit pdfFontName from default properties
        }

//        String ttf = face.getFile();
//        if (ttf == null)
View Full Code Here


      {
        if (name.equals(family.getName()))
        {
          return new FontInfo(family, null, Font.PLAIN);
        }
        FontFace face = family.getNormalFace();
        if (face != null && name.equals(face.getName()))
        {
          return new FontInfo(family, face, Font.PLAIN);
        }
        face = family.getBoldFace();
        if (face != null && name.equals(face.getName()))
        {
          return new FontInfo(family, face, Font.BOLD);
        }
        face = family.getItalicFace();
        if (face != null && name.equals(face.getName()))
        {
          return new FontInfo(family, face, Font.ITALIC);
        }
        face = family.getBoldItalicFace();
        if (face != null && name.equals(face.getName()))
        {
          return new FontInfo(family, face, Font.BOLD | Font.ITALIC);
        }
      }
    }
View Full Code Here

   
    if (fontInfo != null)
    {
      int faceStyle = Font.PLAIN;
      FontFamily family = fontInfo.getFontFamily();
      FontFace face = fontInfo.getFontFace();
      if (face == null)
      {
        if (((style & Font.BOLD) > 0) && ((style & Font.ITALIC) > 0))
        {
          face = family.getBoldItalicFace();
          faceStyle = Font.BOLD | Font.ITALIC;
        }
       
        if (face == null && ((style & Font.BOLD) > 0))
        {
          face = family.getBoldFace();
          faceStyle = Font.BOLD;
        }
       
        if (face == null && ((style & Font.ITALIC) > 0))
        {
          face = family.getItalicFace();
          faceStyle = Font.ITALIC;
        }
       
        if (face == null)
        {
          face = family.getNormalFace();
          faceStyle = Font.PLAIN;
        }
         
//        if (face == null)
//        {
//          throw new JRRuntimeException("Font family '" + family.getName() + "' does not have the normal font face.");
//        }
      }
      else
      {
        faceStyle = fontInfo.getStyle();
      }

      if (face == null)
      {
        // The font family does not specify any font face, not even a normal one.
        // In such case, we take the family name and consider it as JVM available font name.
        checkAwtFont(family.getName(), ignoreMissingFont);
       
        awtFont = new Font(family.getName(), style, size);
      }
      else
      {
        awtFont = face.getFont();
        if (awtFont == null)
        {
          throw new JRRuntimeException("The '" + face.getName() + "' font face in family '" + family.getName() + "' returns a null font.");
        }

        awtFont = awtFont.deriveFont((float)size);
       
        awtFont = awtFont.deriveFont(style & ~faceStyle);
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.fonts.FontFace

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.