in src/java/org/apache/fop/render/pdf/pdfbox/FOPPDFSingleByteFont.java [74:120]
public FOPPDFSingleByteFont(COSDictionary fontData, String name) throws IOException {
super(null, EmbeddingMode.FULL);
if (fontData.getItem(COSName.SUBTYPE) == COSName.TRUE_TYPE) {
setFontType(FontType.TRUETYPE);
}
width = new int[0];
font = getFont(fontData);
setFirstChar(font.getFirstChar());
setLastChar(font.getLastChar());
shortFontName = MergeFontsPDFWriter.getName(font.font.getName());
loadFontFile(font);
float[] bBoxF = font.getBoundingBox();
int[] bBox = new int[bBoxF.length];
for (int i = 0; i < bBox.length; i++) {
bBox[i] = (int)bBoxF[i];
}
setFontBBox(bBox);
setFontName(name);
Object cmap = getCmap(font);
for (int i = font.getFirstChar(); i <= font.getLastChar(); i++) {
String mappedChar = getChar(cmap, i);
if (mappedChar != null && !charMapGlobal.containsKey(mappedChar)) {
charMapGlobal.put(mappedChar, i);
}
}
//mark font as used
notifyMapOperation();
FOPPDFMultiByteFont.setProperties(this, font.font);
if (font.getWidths() != null) {
//if width contains 0 we cant rely on codeToNameMap
boolean usesZero = font.getWidths().contains(0);
Set<Integer> codeToName = getCodeToName(font.getEncoding()).keySet();
for (int i = getFirstChar();
i <= Math.min(getLastChar(), getFirstChar() + font.getWidths().size()); i++) {
if (usesZero || codeToName.contains(i) || codeToName.isEmpty()) {
int w = font.getWidths().get(i - getFirstChar());
newWidth.put(i, w);
} else {
newWidth.put(i, 0);
}
}
}
mapping = new FOPPDFEncoding();
encodingSkip = font.getLastChar() + 1;
addEncoding(font);
}