/** * Constructor. * * @param ttfFont TrueType font */ TTFGlyph2D(PDTrueTypeFont ttfFont) throws IOException { this(ttfFont.getTrueTypeFont(), ttfFont, false); vectorFont = ttfFont; }
int unitsPerEm = ttFont.getTrueTypeFont().getHeader().getUnitsPerEm(); at.scale(1000d / unitsPerEm, 1000d / unitsPerEm);
@Override protected void processFontFile(PDFontDescriptor fontDescriptor, PDStream fontFile) { if (font.isDamaged()) { this.fContainer.push(new ValidationError(ERROR_FONTS_TRUETYPE_DAMAGED, this.font.getName() + ": The FontFile can't be read")); } else { // there must be exactly one encoding in the "cmap" table if the font is symbolic TrueTypeFont ttf = pdTrueTypeFont.getTrueTypeFont(); try { if (pdTrueTypeFont.isSymbolic() && ttf.getCmap().getCmaps().length != 1) { this.fContainer.push(new ValidationError(ERROR_FONTS_ENCODING, this.font.getName() + ": Symbolic TrueType font has more than one 'cmap' entry")); } } catch (IOException e) { this.fContainer.push(new ValidationError(ERROR_FONTS_TRUETYPE_DAMAGED, this.font.getName() + ": The TTF 'cmap' could not be read")); } } } }
if (font instanceof PDTrueTypeFont) ttf = ((PDTrueTypeFont)font).getTrueTypeFont();
private List<FontProgram> getFontFile() { if (!getSubtype().equals(FontFactory.TYPE_3) && (this.pdFontLike.isEmbedded())) { if (getSubtype().equals(FontFactory.TRUE_TYPE)) { PBoxTrueTypeFontProgram trueTypeFontProgram = new PBoxTrueTypeFontProgram( ((PDTrueTypeFont) this.pdFontLike).getTrueTypeFont(), getisSymbolic()); return PBoxPDFont.getFontProgramList(trueTypeFontProgram); } PDFontDescriptor fontDescriptor = pdFontLike.getFontDescriptor(); PDStream fontFile; if (getSubtype().equals(FontFactory.TYPE_1)) { if (this.pdFontLike instanceof PDType1CFont) { fontFile = fontDescriptor.getFontFile3(); } else { fontFile = fontDescriptor.getFontFile(); } } else if (getSubtype().equals(FontFactory.CID_FONT_TYPE_2)) { fontFile = fontDescriptor.getFontFile2(); } else { fontFile = fontDescriptor.getFontFile3(); } if (fontFile != null) { return PBoxPDFont.getFontProgramList(new PBoxFontProgram(fontFile)); } } return Collections.emptyList(); }
int unitsPerEm = ttFont.getTrueTypeFont().getHeader().getUnitsPerEm(); at.scale(1000d / unitsPerEm, 1000d / unitsPerEm);
int unitsPerEm = ttFont.getTrueTypeFont().getHeader().getUnitsPerEm(); at.scale(1000d / unitsPerEm, 1000d / unitsPerEm);
@Override protected void processFontFile(PDFontDescriptor fontDescriptor, PDStream fontFile) { if (font.isDamaged()) { this.fContainer.push(new ValidationError(ERROR_FONTS_TRUETYPE_DAMAGED, this.font.getName() + ": The FontFile can't be read")); } else { // there must be exactly one encoding in the "cmap" table if the font is symbolic TrueTypeFont ttf = pdTrueTypeFont.getTrueTypeFont(); try { if (pdTrueTypeFont.isSymbolic() && ttf.getCmap().getCmaps().length != 1) { this.fContainer.push(new ValidationError(ERROR_FONTS_ENCODING, this.font.getName() + ": Symbolic TrueType font has more than one 'cmap' entry")); } } catch (IOException e) { this.fContainer.push(new ValidationError(ERROR_FONTS_TRUETYPE_DAMAGED, this.font.getName() + ": The TTF 'cmap' could not be read")); } } } }
@Override protected void processFontFile(PDFontDescriptor fontDescriptor, PDStream fontFile) { if (font.isDamaged()) { this.fContainer.push(new ValidationError(ERROR_FONTS_TRUETYPE_DAMAGED, this.font.getName() + ": The FontFile can't be read")); } else { // there must be exactly one encoding in the "cmap" table if the font is symbolic TrueTypeFont ttf = pdTrueTypeFont.getTrueTypeFont(); try { if (pdTrueTypeFont.isSymbolic() && ttf.getCmap().getCmaps().length != 1) { this.fContainer.push(new ValidationError(ERROR_FONTS_ENCODING, this.font.getName() + ": Symbolic TrueType font has more than one 'cmap' entry")); } } catch (IOException e) { this.fContainer.push(new ValidationError(ERROR_FONTS_TRUETYPE_DAMAGED, this.font.getName() + ": The TTF 'cmap' could not be read")); } } } }
TrueTypeFont ttf = null; if (font instanceof PDTrueTypeFont) { ttf = ((PDTrueTypeFont)font).getTrueTypeFont(); } else if (font instanceof PDType0Font) { PDCIDFont cidFont = ((PDType0Font)font).getDescendantFont();
if (font instanceof PDTrueTypeFont) ttf = ((PDTrueTypeFont)font).getTrueTypeFont();
if (font instanceof PDTrueTypeFont) ttf = ((PDTrueTypeFont)font).getTrueTypeFont();
if (font instanceof PDTrueTypeFont) ttf = ((PDTrueTypeFont)font).getTrueTypeFont();