@Override public boolean hasGlyph(int code) throws IOException { return font.getCharProc(code) != null; } }
private void parseCharStrings() { COSDictionary charProcDict = ((org.apache.pdfbox.pdmodel.font.PDType3Font) this.pdFontLike).getCharProcs(); if (charProcDict != null) { Set<COSName> keySet = charProcDict.keySet(); Map<String, PDContentStream> map = new HashMap<>(keySet.size()); for (COSName cosName : keySet) { PDType3CharProc charProc = ((org.apache.pdfbox.pdmodel.font.PDType3Font) this.pdFontLike) .getCharProc(cosName); PBoxPDContentStream pdContentStream = new PBoxPDContentStream(charProc, this.resources, this.document, this.flavour); map.put(cosName.getName(), pdContentStream); } this.charStrings = Collections.unmodifiableMap(map); } else { this.charStrings = Collections.emptyMap(); } } }
/** * Called when a glyph is to be processed.This method is intended for overriding in subclasses, * the default implementation does nothing. * * @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub> * @param font the current font * @param code internal PDF character code for the glyph * @param unicode the Unicode text for this glyph, or null if the PDF does provide it * @param displacement the displacement (i.e. advance) of the glyph in text space * @throws IOException if the glyph cannot be processed */ protected void showType3Glyph(Matrix textRenderingMatrix, PDType3Font font, int code, String unicode, Vector displacement) throws IOException { PDType3CharProc charProc = font.getCharProc(code); if (charProc != null) { processType3Stream(charProc, textRenderingMatrix); } }
private void calcBBox(PDType3Font font) throws IOException { double minX = 0; double maxX = 0; double minY = 0; double maxY = 0; for (int index = 0; index <= 255; ++index) { PDType3CharProc charProc = font.getCharProc(index); if (charProc == null) { continue; } PDRectangle glyphBBox = charProc.getGlyphBBox(); if (glyphBBox == null) { continue; } minX = Math.min(minX, glyphBBox.getLowerLeftX()); maxX = Math.max(maxX, glyphBBox.getUpperRightX()); minY = Math.min(minY, glyphBBox.getLowerLeftY()); maxY = Math.max(maxY, glyphBBox.getUpperRightY()); } fontBBox = new PDRectangle((float) minX, (float) minY, (float) (maxX - minX), (float) (maxY - minY)); }
@Override public float getWidthFromFont(int code) throws IOException { PDType3CharProc charProc = getCharProc(code); if (charProc == null || charProc.getContentStream() == null || charProc.getContentStream().getLength() == 0) { return 0; } return charProc.getWidth(); }
private PDType3CharProc getCharProc(int code) throws ValidationException { PDType3CharProc charProc = font.getCharProc(code); if (charProc == null) { // There are no character description, we declare the Glyph as Invalid. If the character // is used in a Stream, the GlyphDetail will throw an exception. GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, code, font.getName() + ": The CharProcs \"" + font.getEncoding().getName(code) + "\" doesn't exist"); this.fontContainer.markAsInvalid(code, glyphEx); } return charProc; }
@Override public boolean hasGlyph(int code) throws IOException { return font.getCharProc(code) != null; } }
@Override public boolean hasGlyph(int code) throws IOException { return font.getCharProc(code) != null; } }
PDType3CharProc charProc = t3Font.getCharProc(code); if (charProc != null)
@Override public float getWidthFromFont(int code) throws IOException { PDType3CharProc charProc = getCharProc(code); if (charProc == null) { return 0; } return charProc.getWidth(); }
/** * Called when a glyph is to be processed.This method is intended for overriding in subclasses, * the default implementation does nothing. * * @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub> * @param font the current font * @param code internal PDF character code for the glyph * @param unicode the Unicode text for this glyph, or null if the PDF does provide it * @param displacement the displacement (i.e. advance) of the glyph in text space * @throws IOException if the glyph cannot be processed */ protected void showType3Glyph(Matrix textRenderingMatrix, PDType3Font font, int code, String unicode, Vector displacement) throws IOException { PDType3CharProc charProc = font.getCharProc(code); if (charProc != null) { processType3Stream(charProc, textRenderingMatrix); } }
/** * Called when a glyph is to be processed.This method is intended for overriding in subclasses, * the default implementation does nothing. * * @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub> * @param font the current font * @param code internal PDF character code for the glyph * @param unicode the Unicode text for this glyph, or null if the PDF does provide it * @param displacement the displacement (i.e. advance) of the glyph in text space * @throws IOException if the glyph cannot be processed */ protected void showType3Glyph(Matrix textRenderingMatrix, PDType3Font font, int code, String unicode, Vector displacement) throws IOException { PDType3CharProc charProc = font.getCharProc(code); if (charProc != null) { processType3Stream(charProc, textRenderingMatrix); } }
@Override public float getWidthFromFont(int code) throws IOException { PDType3CharProc charProc = getCharProc(code); if (charProc == null || charProc.getContentStream() == null || charProc.getContentStream().getLength() == 0) { return 0; } return charProc.getWidth(); }
private PDType3CharProc getCharProc(int code) throws ValidationException { PDType3CharProc charProc = font.getCharProc(code); if (charProc == null) { // There are no character description, we declare the Glyph as Invalid. If the character // is used in a Stream, the GlyphDetail will throw an exception. GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, code, font.getName() + ": The CharProcs \"" + font.getEncoding().getName(code) + "\" doesn't exist"); this.fontContainer.markAsInvalid(code, glyphEx); } return charProc; }
private PDType3CharProc getCharProc(int code) throws ValidationException { PDType3CharProc charProc = font.getCharProc(code); if (charProc == null) { // There are no character description, we declare the Glyph as Invalid. If the character // is used in a Stream, the GlyphDetail will throw an exception. GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, code, font.getName() + ": The CharProcs \"" + font.getEncoding().getName(code) + "\" doesn't exist"); this.fontContainer.markAsInvalid(code, glyphEx); } return charProc; }
PDType3CharProc charProc = t3Font.getCharProc(code); if (charProc != null) { BoundingBox fontBBox = t3Font.getBoundingBox();
PDType3CharProc charProc = t3Font.getCharProc(code); if (charProc != null)