Java Code Examples for org.apache.fontbox.ttf.TrueTypeFont#enableVerticalSubstitutions()

The following examples show how to use org.apache.fontbox.ttf.TrueTypeFont#enableVerticalSubstitutions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PDType0Font.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Private. Creates a new PDType0Font font for embedding.
 *
 * @param document
 * @param ttf
 * @param embedSubset
 * @param closeTTF whether to close the ttf parameter after embedding. Must be true when the ttf
 * parameter was created in the load() method, false when the ttf parameter was passed to the
 * load() method.
 * @param vertical
 * @throws IOException
 */
private PDType0Font(PDDocument document, TrueTypeFont ttf, boolean embedSubset,
        boolean closeTTF, boolean vertical) throws IOException
{
    if (vertical)
    {
        ttf.enableVerticalSubstitutions();
    }
    embedder = new PDCIDFontType2Embedder(document, dict, ttf, embedSubset, this, vertical);
    descendantFont = embedder.getCIDFont();
    readEncoding();
    fetchCMapUCS2();
    if (closeTTF)
    {
        if (embedSubset)
        {
            this.ttf = ttf;
            document.registerTrueTypeFontForClosing(ttf);
        }
        else
        {
            // the TTF is fully loaded and it is safe to close the underlying data source
            ttf.close();
        }
    }
}
 
Example 2
Source File: PDType0Font.java    From sambox with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param document
 * @param ttf
 * @param embedSubset
 * @param closeTTF whether to close the ttf parameter after embedding. Must be true when the ttf parameter was
 * created in the load() method, false when the ttf parameter was passed to the load() method.
 * @param vertical
 * @throws IOException
 */
private PDType0Font(PDDocument document, TrueTypeFont ttf, boolean embedSubset,
        boolean closeTTF, boolean vertical) throws IOException
{
    if (vertical)
    {
        ttf.enableVerticalSubstitutions();
    }
    embedder = new PDCIDFontType2Embedder(document, dict, ttf, embedSubset, this, vertical);
    descendantFont = embedder.getCIDFont();
    readEncoding();
    fetchCMapUCS2();
    if (closeTTF)
    {
        if (embedSubset)
        {
            this.ttf = ttf;
            document.registerTrueTypeFontForClosing(ttf);
        }
        else
        {
            // the TTF is fully loaded and it is safe to close the underlying data source
            ttf.close();
        }
    }
}