/** * Parse CFF font using byte array, also passing in a byte source for future use. * * @param bytes source bytes * @param source source to re-read bytes from in the future * @return the parsed CFF fonts * @throws IOException If there is an error reading from the stream */ public List<CFFFont> parse(byte[] bytes, ByteSource source) throws IOException { this.source = source; return parse(bytes); }
/** * This will read the required data from the stream. * * @param ttf The font that is being read. * @param data The stream to read the data from. * @throws java.io.IOException If there is an error reading the data. */ public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException { byte[] bytes = data.read((int)getLength()); CFFParser parser = new CFFParser(); cffFont = parser.parse(bytes, new ByteSource(font)).get(0); initialized = true; }
/** * Parse CFF font using byte array, also passing in a byte source for future use. * * @param bytes source bytes * @param source source to re-read bytes from in the future * @return the parsed CFF fonts * @throws IOException If there is an error reading from the stream */ public List<CFFFont> parse(byte[] bytes, ByteSource source) throws IOException { this.source = source; return parse(bytes); }
/** * Parse CFF font using byte array, also passing in a byte source for future use. * * @param bytes source bytes * @param source source to re-read bytes from in the future * @return the parsed CFF fonts * @throws IOException If there is an error reading from the stream */ public List<CFFFont> parse(byte[] bytes, ByteSource source) throws IOException { this.source = source; return parse(bytes); }
cffEmbedded = (CFFType1Font)cffParser.parse(bytes, new ByteSource()).get(0);
try cffFont = cffParser.parse(bytes, new ByteSource()).get(0);
private static CFFFont fontboxParse(byte[] cffData) throws IOException { CFFParser parser = new CFFParser(); List<CFFFont> fonts = parser.parse(cffData); if (fonts.size() > 1) throw new FontNotSupportedException("Multiple CFF fonts in one file are not supported."); return fonts.get(0); }
private List<InputStream> convertOTFToType1(InputStream in) throws IOException { CFFFont f = new CFFParser().parse(IOUtils.toByteArray(in)).get(0); if (!(f instanceof CFFType1Font)) { throw new IOException(getEmbedFileURI() + ": only OTF CFF Type1 font can be converted to Type1"); } List<InputStream> fonts = new ArrayList<InputStream>(); Map<Integer, Integer> glyphs = cidSet.getGlyphs(); int i = 0; for (Map<Integer, Integer> x : splitGlyphs(glyphs)) { String iStr = "." + i; fonts.add(convertOTFToType1(x, f, iStr)); i++; } return fonts; }
@Override protected void initializeFont(FontFileReader in) throws IOException { fontFile = in; fontFile.seekSet(0); CFFParser parser = new CFFParser(); fileFont = parser.parse(in.getAllBytes()).get(0); embedFontName = fileFont.getName(); }
/** * This will read the required data from the stream. * * @param ttf The font that is being read. * @param data The stream to read the data from. * @throws java.io.IOException If there is an error reading the data. */ public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException { byte[] bytes = data.read((int)getLength()); CFFParser parser = new CFFParser(); cffFont = parser.parse(bytes, new ByteSource(font)).get(0); initialized = true; }
/** * This will read the required data from the stream. * * @param ttf The font that is being read. * @param data The stream to read the data from. * @throws java.io.IOException If there is an error reading the data. */ public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException { byte[] bytes = data.read((int)getLength()); CFFParser parser = new CFFParser(); cffFont = parser.parse(bytes, new ByteSource(font)).get(0); initialized = true; }
cffEmbedded = (CFFType1Font)cffParser.parse(bytes, new ByteSource()).get(0);
cffEmbedded = (CFFType1Font)cffParser.parse(bytes, new ByteSource()).get(0);
try cffFont = cffParser.parse(bytes, new ByteSource()).get(0);
try cffFont = cffParser.parse(bytes, new ByteSource()).get(0);