congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
TrueTypeUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
TrueTypeUtil
in
org.xhtmlrenderer.pdf

Best Java code snippets using org.xhtmlrenderer.pdf.TrueTypeUtil (Showing top 20 results out of 315)

origin: org.xhtmlrenderer/core-renderer

public static void populateDescription(String path, BaseFont font, FontDescription descr) 
    throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException {
  RandomAccessFileOrArray rf = null;
  try {
    rf = new RandomAccessFileOrArray(getTTCName(path));
    
    rf = populateDescription0(path, font, descr, rf);
  } finally {
    if (rf != null) {
      try {
        rf.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}

origin: org.xhtmlrenderer/flying-saucer-pdf-itext5

/**
 * Utility method which uses iText libraries to determine the family name(s) for the font at the given path.
 * The iText APIs seem to indicate there can be more than one name, but this method will return a set of them.
 * Use a name from this list when referencing the font in CSS for PDF output. Note that family names as reported
 * by iText may vary from those reported by the AWT Font class, e.g. "Arial Unicode MS" for iText and
 * "ArialUnicodeMS" for AWT.
 *
 * @param path local path to the font file
 * @param encoding same as what you would use for {@link #addFont(String, String, boolean)}
 * @param embedded same as what you would use for {@link #addFont(String, String, boolean)}
 * @return set of all family names for the font file, as reported by iText libraries
 */
public static Set getDistinctFontFamilyNames(String path, String encoding, boolean embedded) {
  BaseFont font = null;
  try {
    font = BaseFont.createFont(path, encoding, embedded);
    String[] fontFamilyNames = TrueTypeUtil.getFamilyNames(font);
    Set distinct = new HashSet();
    for (int i = 0; i < fontFamilyNames.length; i++) {
      distinct.add(fontFamilyNames[i]);
    }
    return distinct;
  } catch (DocumentException e) {
    throw new RuntimeException(e);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

  fontFamilyNames = new String[] { fontFamilyNameOverride };
} else {
  fontFamilyNames = TrueTypeUtil.getFamilyNames(font);
    TrueTypeUtil.populateDescription(uri, afmttf, font, descr);
  } catch (Exception e) {
    throw new XRRuntimeException(e.getMessage(), e);
origin: org.xhtmlrenderer/core-renderer

private static RandomAccessFileOrArray populateDescription0(String path,
    BaseFont font, FontDescription descr, RandomAccessFileOrArray rf)
      throws NoSuchFieldException, IllegalAccessException, DocumentException, IOException {
  Map tables = extractTables(font);
  descr.setStyle(guessStyle(font));
origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public static void populateDescription(String path, byte[] contents, BaseFont font, FontDescription descr)
    throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException {
  RandomAccessFileOrArray rf = null;
  try {
    rf = new RandomAccessFileOrArray(contents);
    rf = populateDescription0(path, font, descr, rf);
  } finally {
    if (rf != null) {
      try {
        rf.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}
origin: org.xhtmlrenderer/core-renderer

BaseFont font = BaseFont.createFont(uri, encoding, embedded, false, afmttf, pfb);
String fontFamilyName = TrueTypeUtil.getFamilyName(font);
FontFamily fontFamily = getFontFamily(fontFamilyName);
  TrueTypeUtil.populateDescription(uri, afmttf, font, descr);
} catch (Exception e) {
  throw new XRRuntimeException(e.getMessage(), e);
origin: pebbleblog/pebble

fontFamilyName = TrueTypeUtil.getFamilyName(font);
origin: org.xhtmlrenderer/flying-saucer-pdf-itext5

  fontFamilyNames = new String[] { fontFamilyNameOverride };
} else {
  fontFamilyNames = TrueTypeUtil.getFamilyNames(font);
    TrueTypeUtil.populateDescription(uri, afmttf, font, descr);
  } catch (Exception e) {
    throw new XRRuntimeException(e.getMessage(), e);
origin: org.xhtmlrenderer/flying-saucer-pdf

private static RandomAccessFileOrArray populateDescription0(String path,
                              BaseFont font, FontDescription descr, RandomAccessFileOrArray rf)
    throws NoSuchFieldException, IllegalAccessException, DocumentException, IOException {
  Map<String, int[]> tables = extractTables(font);
  descr.setStyle(guessStyle(font));
origin: org.xhtmlrenderer/core-renderer

public static void populateDescription(String path, byte[] contents, BaseFont font, FontDescription descr) 
    throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException {
  RandomAccessFileOrArray rf = null;
  try {
    rf = new RandomAccessFileOrArray(contents);
    
    rf = populateDescription0(path, font, descr, rf);
  } finally {
    if (rf != null) {
      try {
        rf.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}    
origin: org.xhtmlrenderer/core-renderer

BaseFont font = BaseFont.createFont(path, encoding, embedded);
String fontFamilyName = TrueTypeUtil.getFamilyName(font);
FontFamily fontFamily = getFontFamily(fontFamilyName);
  TrueTypeUtil.populateDescription(path, font, descr);
} catch (Exception e) {
  throw new XRRuntimeException(e.getMessage(), e);
origin: org.xhtmlrenderer/flying-saucer-pdf

  fontFamilyNames = new String[] { fontFamilyNameOverride };
} else {
  fontFamilyNames = TrueTypeUtil.getFamilyNames(font);
    TrueTypeUtil.populateDescription(path, font, descr);
  } catch (Exception e) {
    throw new XRRuntimeException(e.getMessage(), e);
origin: org.xhtmlrenderer/flying-saucer-pdf-openpdf

public static void populateDescription(String path, BaseFont font, FontDescription descr)
    throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException {
  RandomAccessFileOrArray rf = null;
  try {
    rf = new RandomAccessFileOrArray(getTTCName(path));
    rf = populateDescription0(path, font, descr, rf);
  } finally {
    if (rf != null) {
      try {
        rf.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}
origin: org.xhtmlrenderer/flying-saucer-pdf-openpdf

private static RandomAccessFileOrArray populateDescription0(String path,
                              BaseFont font, FontDescription descr, RandomAccessFileOrArray rf)
    throws NoSuchFieldException, IllegalAccessException, DocumentException, IOException {
  Map<String, int[]> tables = extractTables(font);
  descr.setStyle(guessStyle(font));
origin: org.xhtmlrenderer/flying-saucer-pdf

public static void populateDescription(String path, byte[] contents, BaseFont font, FontDescription descr)
    throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException {
  RandomAccessFileOrArray rf = null;
  try {
    rf = new RandomAccessFileOrArray(contents);
    rf = populateDescription0(path, font, descr, rf);
  } finally {
    if (rf != null) {
      try {
        rf.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}
origin: org.xhtmlrenderer/flying-saucer-pdf

/**
 * Utility method which uses iText libraries to determine the family name(s) for the font at the given path.
 * The iText APIs seem to indicate there can be more than one name, but this method will return a set of them.
 * Use a name from this list when referencing the font in CSS for PDF output. Note that family names as reported
 * by iText may vary from those reported by the AWT Font class, e.g. "Arial Unicode MS" for iText and
 * "ArialUnicodeMS" for AWT.
 *
 * @param path local path to the font file
 * @param encoding same as what you would use for {@link #addFont(String, String, boolean)}
 * @param embedded same as what you would use for {@link #addFont(String, String, boolean)}
 * @return set of all family names for the font file, as reported by iText libraries
 */
public static Set getDistinctFontFamilyNames(String path, String encoding, boolean embedded) {
  BaseFont font = null;
  try {
    font = BaseFont.createFont(path, encoding, embedded);
    String[] fontFamilyNames = TrueTypeUtil.getFamilyNames(font);
    Set distinct = new HashSet();
    for (int i = 0; i < fontFamilyNames.length; i++) {
      distinct.add(fontFamilyNames[i]);
    }
    return distinct;
  } catch (DocumentException e) {
    throw new RuntimeException(e);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
origin: org.xhtmlrenderer/flying-saucer-pdf-itext5

  fontFamilyNames = new String[] { fontFamilyNameOverride };
} else {
  fontFamilyNames = TrueTypeUtil.getFamilyNames(font);
    TrueTypeUtil.populateDescription(path, font, descr);
  } catch (Exception e) {
    throw new XRRuntimeException(e.getMessage(), e);
origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public static void populateDescription(String path, BaseFont font, FontDescription descr)
    throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException {
  RandomAccessFileOrArray rf = null;
  try {
    rf = new RandomAccessFileOrArray(getTTCName(path));
    rf = populateDescription0(path, font, descr, rf);
  } finally {
    if (rf != null) {
      try {
        rf.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}
origin: org.xhtmlrenderer/flying-saucer-pdf-itext5

private static RandomAccessFileOrArray populateDescription0(String path,
                              BaseFont font, FontDescription descr, RandomAccessFileOrArray rf)
    throws NoSuchFieldException, IllegalAccessException, DocumentException, IOException {
  Map<String, int[]> tables = extractTables(font);
  descr.setStyle(guessStyle(font));
origin: org.xhtmlrenderer/flying-saucer-pdf-itext5

public static void populateDescription(String path, byte[] contents, BaseFont font, FontDescription descr)
    throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException {
  RandomAccessFileOrArray rf = null;
  try {
    rf = new RandomAccessFileOrArray(contents);
    rf = populateDescription0(path, font, descr, rf);
  } finally {
    if (rf != null) {
      try {
        rf.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}
org.xhtmlrenderer.pdfTrueTypeUtil

Javadoc

Uses code from iText's DefaultFontMapper and TrueTypeFont classes. See http://sourceforge.net/projects/itext/ for license information.

Most used methods

  • extractTables
  • getTTCName
  • guessStyle
  • populateDescription
  • populateDescription0
  • getFamilyNames
  • getFamilyName

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now