Examples of FontFactory


Examples of com.google.typography.font.sfntly.FontFactory

    // End TTF creation
   
    // Create a WOFF file from this TTF file using sfntly

    FontFactory fontFactory = FontFactory.getInstance();

    File fontFile = new File(getTTFfilename());
    File outputFile = new File(WOFFfilename);

    byte[] fontBytes = new byte[0];
    try {
      FileInputStream fis = new FileInputStream(fontFile);
      fontBytes = new byte[(int) fontFile.length()];
      fis.read(fontBytes);
    } catch (IOException e) {
      System.out
          .println("Error while creating WOFF File. TTF file not found: "
              + getTTFfilename());
      e.printStackTrace();
    }

    Font[] fontArray = null;
    try {
      fontArray = fontFactory.loadFonts(fontBytes);
    } catch (IOException e) {
      System.out
          .println("Error while creating WOFF File. TTF file could not be read: "
              + getTTFfilename());
      e.printStackTrace();
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.