⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 truetypefont.java

📁 Java生成PDF Java生成PDF Java生成PDF
💻 JAVA
字号:
// $Id: TrueTypeFont.java,v 1.5 2003/11/04 17:16:01 mike Exp $package org.faceless.pdf;import java.util.*;import java.io.*;/** * <p> * A concrete subclass of <code>PDFSimpleFont</code> representing a * <code>TrueType</code> font. * </p> * <p> * TrueType fonts are the standard font used by both Microsoft Windows * and Apple's MacOS. They can be used and embedded in PDF documents, and * the full range of Unicode characters used. This class can handle both * Macintosh and Windows varients. * </p> * @see PDFEncoding * @see Type1Font * @version $Revision: 1.5 $ */ public class TrueTypeFont extends PDFSimpleFont{    /**     * Create a new TrueType font from the specified InputStream. The     * <code>embed</code> flag controls whether the font is embedded     * or not. Some fonts have restrictions on embedding - these can     * still be embedded but a warning is printed to <code>System.err</code>.     * <i>Since 1.1, if this constructor is used and the font is embedded,     * the font is subset by default.</i>     *     * @param file the TrueType font file     * @param embed whether to embed the font in the PDF document or not.     * @throws IOException if the font file can't be fully read or parsed     * @throws IllegalArgumentException if the font file contains invalid data     */    public TrueTypeFont(InputStream file, boolean embed)        throws IOException, IllegalArgumentException    {	super(new org.faceless.pdf2.OpenTypeFont(file, embed ? 2 : 1));	((org.faceless.pdf2.OpenTypeFont)font).setEmbed(embed);    }    /**     * <p>     * Create a new TrueType font from the specified InputStream. The     * <code>embed</code> flag controls whether the font is embedded     * or not. Some fonts have restrictions on embedding - these can     * still be embedded but a warning is printed to <code>System.err</code>.     * </p>     * <p>     * Since 1.1, the library has the ability to <b>subset</b> embedded     * TrueType fonts. This can result in a smaller file, but may be a     * time-consuming process. Font subsets contain only the characters     * that are actually used in the document, which can result in large     * space savings when the font has many glyphs that aren't used. On     * the other hand the font may wind up missing common characters,     * making it useless outside the context of the PDF it's embededded     * in (which may be an advantage in some situations).     * </p>     *     * @param file the TrueType font file     * @param embed whether to embed the font in the PDF document     * @param subset whether to subset the font (only if the font is embedded)     * @throws IOException if the font file can't be fully read or parsed     * @throws IllegalArgumentException if the font file contains invalid data     * @since 1.1     */    public TrueTypeFont(InputStream file, boolean embed, boolean subset)        throws IOException, IllegalArgumentException    {	super(new org.faceless.pdf2.OpenTypeFont(file, embed ? 2 : 1));	((org.faceless.pdf2.OpenTypeFont)font).setEmbed(embed);	((org.faceless.pdf2.OpenTypeFont)font).setSubset(subset);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -