MCPcopy Create free account
hub / github.com/apache/pdfbox / Type1Font

Class Type1Font

fontbox/src/main/java/org/apache/fontbox/type1/Type1Font.java:42–576  ·  view source on GitHub ↗

Represents an Adobe Type 1 (.pfb) font. Thread safe. @author John Hewson

Source from the content-addressed store, hash-verified

40 * @author John Hewson
41 */
42public final class Type1Font implements Type1CharStringReader, EncodedFont, FontBoxFont
43{
44 /**
45 * Constructs a new Type1Font object from a .pfb stream.
46 *
47 * @param pfbStream .pfb input stream, including headers
48 * @return a type1 font
49 *
50 * @throws IOException if something went wrong
51 */
52 public static Type1Font createWithPFB(InputStream pfbStream) throws IOException
53 {
54 PfbParser pfb = new PfbParser(pfbStream);
55 Type1Parser parser = new Type1Parser();
56 return parser.parse(pfb.getSegment1(), pfb.getSegment2());
57 }
58
59 /**
60 * Constructs a new Type1Font object from a .pfb stream.
61 *
62 * @param pfbBytes .pfb data, including headers
63 * @return a type1 font
64 *
65 * @throws IOException if something went wrong
66 */
67 public static Type1Font createWithPFB(byte[] pfbBytes) throws IOException
68 {
69 PfbParser pfb = new PfbParser(pfbBytes);
70 Type1Parser parser = new Type1Parser();
71 return parser.parse(pfb.getSegment1(), pfb.getSegment2());
72 }
73
74 /**
75 * Constructs a new Type1Font object from two header-less .pfb segments.
76 *
77 * @param segment1 The first segment, without header
78 * @param segment2 The second segment, without header
79 * @return A new Type1Font instance
80 * @throws IOException if something went wrong
81 */
82 public static Type1Font createWithSegments(byte[] segment1, byte[] segment2) throws IOException
83 {
84 Type1Parser parser = new Type1Parser();
85 return parser.parse(segment1, segment2);
86 }
87
88 // font dictionary
89 String fontName = "";
90 Encoding encoding = null;
91 int paintType;
92 int fontType;
93 List<Number> fontMatrix = Collections.emptyList();
94 List<Number> fontBBox = Collections.emptyList();
95 int uniqueID;
96 float strokeWidth;
97 String fontID = "";
98
99 // FontInfo dictionary

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…